1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

nfd-worker: add healthz endpoint

This commit is contained in:
Markus Lehtonen 2024-10-23 15:19:53 +03:00
parent d831fcbdf9
commit 4ba35eb8ce
3 changed files with 18 additions and 1 deletions

View file

@ -20,9 +20,15 @@ spec:
image: gcr.io/k8s-staging-nfd/node-feature-discovery:master
imagePullPolicy: Always
livenessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 10
periodSeconds: 10
readinessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 5
periodSeconds: 10
failureThreshold: 10

View file

@ -47,6 +47,9 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
livenessProbe:
httpGet:
path: /healthz
port: http
{{- with .Values.worker.livenessProbe.initialDelaySeconds }}
initialDelaySeconds: {{ . }}
{{- end }}
@ -60,6 +63,9 @@ spec:
timeoutSeconds: {{ . }}
{{- end }}
readinessProbe:
httpGet:
path: /healthz
port: http
{{- with .Values.worker.readinessProbe.initialDelaySeconds }}
initialDelaySeconds: {{ . }}
{{- end }}

View file

@ -200,6 +200,10 @@ func newDefaultConfig() *NFDConfig {
}
}
func (w *nfdWorker) Healthz(writer http.ResponseWriter, _ *http.Request) {
writer.WriteHeader(http.StatusOK)
}
func (i *infiniteTicker) Reset(d time.Duration) {
switch {
case d > 0:
@ -304,7 +308,8 @@ func (w *nfdWorker) Run() error {
return nil
}
// Start readiness probe (at this point we're "ready and live")
// Register health probe (at this point we're "ready and live")
httpMux.HandleFunc("/healthz", w.Healthz)
// Start HTTP server
httpServer := http.Server{Addr: fmt.Sprintf(":%d", w.args.Port), Handler: httpMux}