changeset 59:1f8e66cb0108

deployment
author drewp@bigasterisk.com
date Fri, 06 Sep 2024 16:37:04 -0700
parents 6c7151126a0b
children 3b0595c2bf03
files calsync/main.go deploy.yaml ingress.yaml skaffold.yaml
diffstat 4 files changed, 44 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/calsync/main.go	Thu Sep 05 17:01:23 2024 -0700
+++ b/calsync/main.go	Fri Sep 06 16:37:04 2024 -0700
@@ -59,15 +59,17 @@
 	r := mux.NewRouter()
 	http.Handle("/", r)
 
-	home := func(w http.ResponseWriter, r *http.Request) {
-		w.Write([]byte("calsync service for calendar updates"))
-	}
-	r.HandleFunc("/", home)
-	r.HandleFunc("/gcalendarwatch", home)
+	r.HandleFunc("/", homePage)
+	r.HandleFunc("/gcalendarwatch", homePage)
+	r.HandleFunc("/gcalendarwatch/notifications", notifications.NotificationHandler).Methods("POST")
+	
+	addr:=":8080"
+	log.Println("serving /gcalendarwatch/notifications on", addr)
+	log.Fatal(http.ListenAndServe(addr, nil))
+}
 
-	notificationHandler := func(w http.ResponseWriter, r *http.Request) {
-	}
-	r.HandleFunc("/gcalendarwatch/notification", notificationHandler).Methods("POST")
-	log.Println(("serving /gcalendarwatch/notification on :8080"))
-	log.Fatal(http.ListenAndServe(":8080", nil))
 }
+
+func homePage(w http.ResponseWriter, r *http.Request) {
+						w.Write([]byte("calsync service for calendar updates. See https://console.cloud.google.com/apis/api/calendar-json.googleapis.com/metrics?project=bigasterisk-910"))
+					}
--- a/deploy.yaml	Thu Sep 05 17:01:23 2024 -0700
+++ b/deploy.yaml	Fri Sep 06 16:37:04 2024 -0700
@@ -24,6 +24,12 @@
           - '--port=8000'
           - '--host=0.0.0.0'
           - 'gcalendarwatch:app'
+        - name: calsync
+          image: reg:5000/gcalendarwatch_calsync_image
+          ports:
+            - containerPort: 8080
+          command:
+          - /opt/calsync
 ---
 apiVersion: v1
 kind: Service
@@ -32,6 +38,7 @@
 spec:
   ports:
   - {port: 80, targetPort: 8000, name: metrics}
+  - {port: 8080, targetPort: 8080, name: calsync}
   selector:
     app: gcalendarwatch
 
--- a/ingress.yaml	Thu Sep 05 17:01:23 2024 -0700
+++ b/ingress.yaml	Fri Sep 06 16:37:04 2024 -0700
@@ -25,3 +25,25 @@
   tls:
     - hosts: [bigasterisk.com]
       secretName: bigasterisk.com-tls
+---
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+  name: gcalendarwatch-webhook
+  annotations:
+    cert-manager.io/cluster-issuer: letsencrypt-prod
+    ingress.pomerium.io/allow_public_unauthenticated_access: "true"
+    ingress.pomerium.io/pass_identity_headers: "true"
+    ingress.pomerium.io/preserve_host_header: "true"
+spec:
+  ingressClassName: pomerium
+  rules:
+    - host: "bigasterisk.com"
+      http:
+        paths:
+          - pathType: Prefix
+            path: /gcalendarwatch/notifications
+            backend: { service: { name: gcalendarwatch, port: { number: 8080 } } }
+  tls:
+    - hosts: [bigasterisk.com]
+      secretName: bigasterisk.com-tls
--- a/skaffold.yaml	Thu Sep 05 17:01:23 2024 -0700
+++ b/skaffold.yaml	Fri Sep 06 16:37:04 2024 -0700
@@ -9,6 +9,9 @@
       sync:
         infer:
           - index.html
+    - image: reg:5000/gcalendarwatch_calsync_image
+      context: calsync
+      platforms: [amd64]
   tagPolicy:
     dateTime:
       format: 2006-01-02_15-04-05