Skip to content

Commit

Permalink
Merge pull request #77 from ropable/master
Browse files Browse the repository at this point in the history
Update liveness/readiness endpoints and Kustomize labels
  • Loading branch information
ropable authored Mar 5, 2024
2 parents 12ccf3b + c80132d commit b42e7ec
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 16 deletions.
4 changes: 2 additions & 2 deletions geocoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
20 changes: 16 additions & 4 deletions kustomize/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions kustomize/overlays/prod/deployment_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion kustomize/overlays/prod/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ spec:
minAvailable: 1
selector:
matchLabels:
app: caddy-prod
app: caddy-deployment
variant: prod
2 changes: 1 addition & 1 deletion kustomize/overlays/prod/service_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ metadata:
spec:
type: ClusterIP
selector:
app: caddy-prod
app: caddy-deployment
variant: prod
6 changes: 3 additions & 3 deletions kustomize/overlays/uat/deployment_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion kustomize/overlays/uat/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ spec:
minAvailable: 1
selector:
matchLabels:
app: caddy-uat
app: caddy-deployment
variant: uat
2 changes: 1 addition & 1 deletion kustomize/overlays/uat/service_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ metadata:
spec:
type: ClusterIP
selector:
app: caddy-uat
app: caddy-deployment
variant: uat

0 comments on commit b42e7ec

Please sign in to comment.