# HG changeset patch # User drewp@bigasterisk.com # Date 1725665824 25200 # Node ID 1f8e66cb0108b9b2e7092de0b1970768e4a923d5 # Parent 6c7151126a0b4409dcbcabede85ab663fd254ca7 deployment diff -r 6c7151126a0b -r 1f8e66cb0108 calsync/main.go --- 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")) + } diff -r 6c7151126a0b -r 1f8e66cb0108 deploy.yaml --- 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 diff -r 6c7151126a0b -r 1f8e66cb0108 ingress.yaml --- 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 diff -r 6c7151126a0b -r 1f8e66cb0108 skaffold.yaml --- 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