Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Basic Healthchecks
Browse files Browse the repository at this point in the history
  • Loading branch information
cpressland authored and terrycain committed Oct 5, 2022
1 parent 8ecd966 commit 3a37780
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ RUN poetry build

FROM python:3.10-slim
COPY --from=0 /app/dist/*.whl /
ADD healthcheck.sh /
RUN pip install keyvault2kube-*.*.*-py3-none-any.whl

ENV PYTHONUNBUFFERED=1
Expand Down
12 changes: 12 additions & 0 deletions deploy/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ spec:
env:
- name: KEY_VAULT_URLS
value: https://foo.vault.azure.net/
securityContext:
readOnlyRootFilesystem: true
startupProbe:
exec:
command: ["test", "-f", "/tmp/done"]
periodSeconds: 120
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
cpu: 1000m
memory: 64Mi
volumeMounts:
- mountPath: /tmp
name: tmp
volumes:
- name: tmp
emptyDir: {}
2 changes: 2 additions & 0 deletions keyvault2kube/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import signal
import sys
import time
from pathlib import Path

import pylogrus

Expand Down Expand Up @@ -71,6 +72,7 @@ def stop_signal_handler(signal_number, frame) -> None:

try:
kube.update_secrets(secrets)
Path("/tmp/done").touch()
except Exception as err:
logger.exception("Failed to update Kubernetes secrets", exc_info=err)

Expand Down

0 comments on commit 3a37780

Please sign in to comment.