Implement readinessProbe and livenessProbe for supervisor
Signed-off-by: Ryan Richard <richardry@vmware.com>
This commit is contained in:
parent
3e39800005
commit
fa5f653de6
@ -110,6 +110,10 @@ func startControllers(
|
|||||||
kubeInformers.Start(ctx.Done())
|
kubeInformers.Start(ctx.Done())
|
||||||
pinnipedInformers.Start(ctx.Done())
|
pinnipedInformers.Start(ctx.Done())
|
||||||
|
|
||||||
|
// Wait until the caches are synced before returning.
|
||||||
|
kubeInformers.WaitForCacheSync(ctx.Done())
|
||||||
|
pinnipedInformers.WaitForCacheSync(ctx.Done())
|
||||||
|
|
||||||
go controllerManager.Start(ctx)
|
go controllerManager.Start(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,8 +169,20 @@ func run(serverInstallationNamespace string, cfg *supervisor.Config) error {
|
|||||||
return fmt.Errorf("cannot create listener: %w", err)
|
return fmt.Errorf("cannot create listener: %w", err)
|
||||||
}
|
}
|
||||||
defer l.Close()
|
defer l.Close()
|
||||||
|
|
||||||
start(ctx, l, oidProvidersManager)
|
start(ctx, l, oidProvidersManager)
|
||||||
|
|
||||||
|
//nolint: gosec // Intentionally binding to all network interfaces.
|
||||||
|
healthzListener, err := net.Listen("tcp", ":8080")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("cannot create healthzListener: %w", err)
|
||||||
|
}
|
||||||
|
defer healthzListener.Close()
|
||||||
|
healthzMux := http.NewServeMux()
|
||||||
|
healthzMux.Handle("/healthz", http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
|
||||||
|
_, _ = writer.Write([]byte("ok"))
|
||||||
|
}))
|
||||||
|
start(ctx, healthzListener, healthzMux)
|
||||||
|
|
||||||
klog.InfoS("supervisor is ready", "address", l.Addr().String())
|
klog.InfoS("supervisor is ready", "address", l.Addr().String())
|
||||||
|
|
||||||
gotSignal := waitForSignal()
|
gotSignal := waitForSignal()
|
||||||
|
@ -84,6 +84,24 @@ spec:
|
|||||||
mountPath: /etc/config
|
mountPath: /etc/config
|
||||||
- name: podinfo
|
- name: podinfo
|
||||||
mountPath: /etc/podinfo
|
mountPath: /etc/podinfo
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /healthz
|
||||||
|
port: 8080
|
||||||
|
scheme: HTTP
|
||||||
|
initialDelaySeconds: 2
|
||||||
|
timeoutSeconds: 15
|
||||||
|
periodSeconds: 10
|
||||||
|
failureThreshold: 5
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /healthz
|
||||||
|
port: 8080
|
||||||
|
scheme: HTTP
|
||||||
|
initialDelaySeconds: 2
|
||||||
|
timeoutSeconds: 3
|
||||||
|
periodSeconds: 10
|
||||||
|
failureThreshold: 3
|
||||||
volumes:
|
volumes:
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
configMap:
|
configMap:
|
||||||
|
Loading…
Reference in New Issue
Block a user