diff --git a/manifest.yaml b/manifest.yaml index b881c94..4f8294d 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -32,6 +32,13 @@ spec: - name: webhook image: jasonrichardsmith/sentry:0.1 imagePullPolicy: IfNotPresent + resources: + limits: + memory: 500Mi + cpu: 300m + requests: + memory: 500Mi + cpu: 300m volumeMounts: - name: webhook-certs mountPath: /etc/webhook/certs @@ -40,6 +47,20 @@ spec: mountPath: /config.yaml subPath: config.yaml readOnly: true + readinessProbe: + httpGet: + path: /healthz + port: 443 + scheme: HTTPS + initialDelaySeconds: 1 + periodSeconds: 10 + livenessProbe: + httpGet: + path: /healthz + port: 443 + scheme: HTTPS + initialDelaySeconds: 5 + periodSeconds: 10 volumes: - name: webhook-certs secret: diff --git a/sentry/sentry.go b/sentry/sentry.go index 1ea0dd2..bb6b7d0 100644 --- a/sentry/sentry.go +++ b/sentry/sentry.go @@ -63,6 +63,12 @@ func (sh SentryHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } } log.Info("Received request") + if r.URL.Path == "/healthz" { + log.Info("Received health check") + w.WriteHeader(http.StatusOK) + w.Write([]byte("200 - Healthy")) + return + } contentType := r.Header.Get("Content-Type") if contentType != "application/json" { log.Errorf("contentType=%s, expect application/json", contentType)