From dd625468b4487758b5a184c842bef67751416b7d Mon Sep 17 00:00:00 2001 From: Ashley Felton Date: Tue, 5 Mar 2024 11:15:58 +0800 Subject: [PATCH 1/2] Liveness/readiness endpoints consistent with others. --- geocoder.py | 4 ++-- kustomize/base/deployment.yaml | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/geocoder.py b/geocoder.py index ef8dd80..ac163ff 100644 --- a/geocoder.py +++ b/geocoder.py @@ -25,13 +25,13 @@ def index(): return static_file('index.html', root='caddy/templates') -@app.route('/liveness') +@app.route('/livez') def liveness(): response.content_type = 'application/json' return '{"liveness": "OK"}' -@app.route('/readiness') +@app.route('/readyz') def readiness(): sql = text('SELECT 1') s = Session() diff --git a/kustomize/base/deployment.yaml b/kustomize/base/deployment.yaml index 744897e..302a9dd 100644 --- a/kustomize/base/deployment.yaml +++ b/kustomize/base/deployment.yaml @@ -24,24 +24,36 @@ spec: limits: memory: "2Gi" cpu: "1000m" + startupProbe: + httpGet: + path: /livez + port: 8080 + scheme: HTTP + initialDelaySeconds: 3 + periodSeconds: 15 + timeoutSeconds: 10 + successThreshold: 1 + failureThreshold: 3 livenessProbe: httpGet: - path: /liveness + path: /livez port: 8080 scheme: HTTP + initialDelaySeconds: 0 periodSeconds: 15 successThreshold: 1 failureThreshold: 3 - timeoutSeconds: 5 + timeoutSeconds: 10 readinessProbe: httpGet: - path: /readiness + path: /readyz port: 8080 scheme: HTTP + initialDelaySeconds: 0 periodSeconds: 15 successThreshold: 1 failureThreshold: 3 - timeoutSeconds: 5 + timeoutSeconds: 10 securityContext: runAsNonRoot: true privileged: false From c80132d2c2ed5884443583663f048da0f14e14a0 Mon Sep 17 00:00:00 2001 From: Ashley Felton Date: Tue, 5 Mar 2024 11:46:01 +0800 Subject: [PATCH 2/2] Update Kustomize resource labels. --- kustomize/overlays/prod/deployment_patch.yaml | 6 +++--- kustomize/overlays/prod/pdb.yaml | 2 +- kustomize/overlays/prod/service_patch.yaml | 2 +- kustomize/overlays/uat/deployment_patch.yaml | 6 +++--- kustomize/overlays/uat/pdb.yaml | 2 +- kustomize/overlays/uat/service_patch.yaml | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/kustomize/overlays/prod/deployment_patch.yaml b/kustomize/overlays/prod/deployment_patch.yaml index a0b553a..3e56ece 100644 --- a/kustomize/overlays/prod/deployment_patch.yaml +++ b/kustomize/overlays/prod/deployment_patch.yaml @@ -3,15 +3,15 @@ kind: Deployment metadata: name: caddy-deployment labels: - app: caddy-prod + app: caddy-deployment spec: selector: matchLabels: - app: caddy-prod + app: caddy-deployment template: metadata: labels: - app: caddy-prod + app: caddy-deployment spec: containers: - name: caddy diff --git a/kustomize/overlays/prod/pdb.yaml b/kustomize/overlays/prod/pdb.yaml index 898ac38..81f9c6c 100644 --- a/kustomize/overlays/prod/pdb.yaml +++ b/kustomize/overlays/prod/pdb.yaml @@ -6,5 +6,5 @@ spec: minAvailable: 1 selector: matchLabels: - app: caddy-prod + app: caddy-deployment variant: prod diff --git a/kustomize/overlays/prod/service_patch.yaml b/kustomize/overlays/prod/service_patch.yaml index f4ef207..34bde8c 100644 --- a/kustomize/overlays/prod/service_patch.yaml +++ b/kustomize/overlays/prod/service_patch.yaml @@ -5,5 +5,5 @@ metadata: spec: type: ClusterIP selector: - app: caddy-prod + app: caddy-deployment variant: prod diff --git a/kustomize/overlays/uat/deployment_patch.yaml b/kustomize/overlays/uat/deployment_patch.yaml index 3639050..e028257 100644 --- a/kustomize/overlays/uat/deployment_patch.yaml +++ b/kustomize/overlays/uat/deployment_patch.yaml @@ -3,15 +3,15 @@ kind: Deployment metadata: name: caddy-deployment labels: - app: caddy-uat + app: caddy-deployment spec: selector: matchLabels: - app: caddy-uat + app: caddy-deployment template: metadata: labels: - app: caddy-uat + app: caddy-deployment spec: containers: - name: caddy diff --git a/kustomize/overlays/uat/pdb.yaml b/kustomize/overlays/uat/pdb.yaml index 27e22d8..46ab840 100644 --- a/kustomize/overlays/uat/pdb.yaml +++ b/kustomize/overlays/uat/pdb.yaml @@ -6,5 +6,5 @@ spec: minAvailable: 1 selector: matchLabels: - app: caddy-uat + app: caddy-deployment variant: uat diff --git a/kustomize/overlays/uat/service_patch.yaml b/kustomize/overlays/uat/service_patch.yaml index d1d7cbd..dcdbaa7 100644 --- a/kustomize/overlays/uat/service_patch.yaml +++ b/kustomize/overlays/uat/service_patch.yaml @@ -5,5 +5,5 @@ metadata: spec: type: ClusterIP selector: - app: caddy-uat + app: caddy-deployment variant: uat