Skip to content

Commit

Permalink
OCPBUGS-45182: move csi-driver-nfs under initContainers`
Browse files Browse the repository at this point in the history
The csi-driver-nfs container needs to start before csi-driver container
otherwise the socket might not be available when the driver is looking
for it.

So in this PR we move the container into a `initContainers` so it'll run
before other containers and this should avoid the pod to restart once.
  • Loading branch information
EmilienM committed Nov 28, 2024
1 parent 753050b commit 7efb110
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,26 +132,6 @@ spec:
name: socket-dir
- mountPath: /etc/kubernetes/static-pod-resources/configmaps/cloud-config
name: cacert
- args:
- --nodeid=$(NODE_ID)
- --endpoint=unix://plugin/csi-nfs.sock
- --mount-permissions=0777
env:
- name: NODE_ID
valueFrom:
fieldRef:
fieldPath: spec.nodeName
image: ${NFS_DRIVER_IMAGE}
imagePullPolicy: IfNotPresent
name: csi-driver-nfs
resources:
requests:
cpu: 10m
memory: 50Mi
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /plugin
name: socket-dir
- args:
- --secure-listen-address=0.0.0.0:9202
- --upstream=http://127.0.0.1:8202/
Expand Down Expand Up @@ -346,6 +326,27 @@ spec:
volumeMounts:
- mountPath: /csi
name: socket-dir
initContainers:
- args:
- --nodeid=$(NODE_ID)
- --endpoint=unix://plugin/csi-nfs.sock
- --mount-permissions=0777
env:
- name: NODE_ID
valueFrom:
fieldRef:
fieldPath: spec.nodeName
image: ${NFS_DRIVER_IMAGE}
imagePullPolicy: IfNotPresent
name: csi-driver-nfs
resources:
requests:
cpu: 10m
memory: 50Mi
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /plugin
name: socket-dir
nodeSelector:
node-role.kubernetes.io/master: ""
priorityClassName: hypershift-control-plane
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,26 +102,6 @@ spec:
name: socket-dir
- mountPath: /etc/kubernetes/static-pod-resources/configmaps/cloud-config
name: cacert
- args:
- --nodeid=$(NODE_ID)
- --endpoint=unix://plugin/csi-nfs.sock
- --mount-permissions=0777
env:
- name: NODE_ID
valueFrom:
fieldRef:
fieldPath: spec.nodeName
image: ${NFS_DRIVER_IMAGE}
imagePullPolicy: IfNotPresent
name: csi-driver-nfs
resources:
requests:
cpu: 10m
memory: 50Mi
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /plugin
name: socket-dir
- args:
- --secure-listen-address=0.0.0.0:9202
- --upstream=http://127.0.0.1:8202/
Expand Down Expand Up @@ -298,6 +278,27 @@ spec:
volumeMounts:
- mountPath: /csi
name: socket-dir
initContainers:
- args:
- --nodeid=$(NODE_ID)
- --endpoint=unix://plugin/csi-nfs.sock
- --mount-permissions=0777
env:
- name: NODE_ID
valueFrom:
fieldRef:
fieldPath: spec.nodeName
image: ${NFS_DRIVER_IMAGE}
imagePullPolicy: IfNotPresent
name: csi-driver-nfs
resources:
requests:
cpu: 10m
memory: 50Mi
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /plugin
name: socket-dir
nodeSelector:
node-role.kubernetes.io/master: ""
priorityClassName: system-cluster-critical
Expand Down
43 changes: 22 additions & 21 deletions assets/overlays/openstack-manila/patches/controller_add_driver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,28 @@ spec:
app: openstack-manila-csi
component: controllerplugin
topologyKey: kubernetes.io/hostname
initContainers:
# TODO: fix manila CSI driver not to require NFS driver socket!
- name: csi-driver-nfs
image: ${NFS_DRIVER_IMAGE}
imagePullPolicy: IfNotPresent
args:
- "--nodeid=$(NODE_ID)"
- "--endpoint=unix://plugin/csi-nfs.sock"
- "--mount-permissions=0777"
env:
- name: NODE_ID
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- name: socket-dir
mountPath: /plugin
resources:
requests:
cpu: 10m
memory: 50Mi
terminationMessagePolicy: FallbackToLogsOnError
containers:
- name: csi-driver
image: ${DRIVER_IMAGE}
Expand Down Expand Up @@ -91,27 +113,6 @@ spec:
cpu: 10m
memory: 50Mi
terminationMessagePolicy: FallbackToLogsOnError
# TODO: fix manila CSI driver not to require NFS driver socket!
- name: csi-driver-nfs
image: ${NFS_DRIVER_IMAGE}
imagePullPolicy: IfNotPresent
args:
- "--nodeid=$(NODE_ID)"
- "--endpoint=unix://plugin/csi-nfs.sock"
- "--mount-permissions=0777"
env:
- name: NODE_ID
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- name: socket-dir
mountPath: /plugin
resources:
requests:
cpu: 10m
memory: 50Mi
terminationMessagePolicy: FallbackToLogsOnError
volumes:
- name: socket-dir
emptyDir: {}
Expand Down

0 comments on commit 7efb110

Please sign in to comment.