Skip to content

Commit

Permalink
Add readiness and liveness checks for Kubeops (#1405)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonAlling authored and absoludity committed Jan 6, 2020
1 parent 803e614 commit 938f56e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chart/kubeapps/templates/kubeops-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ spec:
ports:
- name: http
containerPort: {{ .Values.kubeops.service.port }}
{{- if .Values.kubeops.livenessProbe }}
livenessProbe: {{- toYaml .Values.kubeops.livenessProbe | nindent 12 }}
{{- end }}
{{- if .Values.kubeops.readinessProbe }}
readinessProbe: {{- toYaml .Values.kubeops.readinessProbe | nindent 12 }}
{{- end }}
env:
- name: POD_NAMESPACE
valueFrom:
Expand Down
15 changes: 15 additions & 0 deletions chart/kubeapps/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,21 @@ kubeops:
requests:
cpu: 25m
memory: 32Mi
## Kubeops containers' liveness and readiness probes
## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes
##
livenessProbe:
httpGet:
path: /live
port: 8080
initialDelaySeconds: 60
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 0
timeoutSeconds: 5
nodeSelector: {}
tolerations: []
affinity: {}
Expand Down
6 changes: 6 additions & 0 deletions cmd/kubeops/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"github.com/gorilla/mux"
"github.com/heptiolabs/healthcheck"
"github.com/kubeapps/kubeapps/cmd/kubeops/internal/handler"
"github.com/kubeapps/kubeapps/pkg/agent"
"github.com/kubeapps/kubeapps/pkg/auth"
Expand Down Expand Up @@ -59,6 +60,11 @@ func main() {
withAgentConfig := handler.WithAgentConfig(storageForDriver, options)
r := mux.NewRouter()

// Healthcheck
health := healthcheck.NewHandler()
r.Handle("/live", health)
r.Handle("/ready", health)

// Routes
// Auth not necessary here with Helm 3 because it's done by Kubernetes.
apiv1 := r.PathPrefix("/v1").Subrouter()
Expand Down

0 comments on commit 938f56e

Please sign in to comment.