Skip to content

Commit

Permalink
OCPBUGS-45182: add startupProbe to csi-driver.
Browse files Browse the repository at this point in the history
The csi-driver-nfs container requires an NFS socket to be created
before the csi-driver container can operate.
If the socket is not available at startup, the pod will restart
unnecessarily due to initialization failure.

Using a postStart hook to check for the socket is not reliable,
as Kubernetes does not guarantee the hook will execute before
the container's entrypoint starts.

This patch introduces a startupProbe to verify the existence of the NFS socket.
The probe will run for up to one minute, allowing sufficient time for the socket
to be created and avoiding premature pod restarts.
The existing livenessProbe remains responsible for ongoing health checks.
  • Loading branch information
EmilienM committed Nov 29, 2024
1 parent 753050b commit 73c6924
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ spec:
requests:
cpu: 10m
memory: 50Mi
startupProbe:
exec:
command:
- sh
- -c
- test -S /plugin/csi-nfs.sock
failureThreshold: 6
initialDelaySeconds: 30
periodSeconds: 5
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ spec:
requests:
cpu: 10m
memory: 50Mi
startupProbe:
exec:
command:
- sh
- -c
- test -S /plugin/csi-nfs.sock
failureThreshold: 6
initialDelaySeconds: 30
periodSeconds: 5
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ spec:
timeoutSeconds: 10
periodSeconds: 30
failureThreshold: 5
# CSI driver initialization requires that the NFS driver socket
# exists which should take less than a minute.
startupProbe:
exec:
command:
- sh
- -c
- "test -S /plugin/csi-nfs.sock"
initialDelaySeconds: 30
periodSeconds: 5
failureThreshold: 6
volumeMounts:
- name: socket-dir
mountPath: /plugin
Expand Down

0 comments on commit 73c6924

Please sign in to comment.