Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit eae345a

Browse files
authoredJun 18, 2024··
Merge branch 'kubernetes:master' into ccm_tests
2 parents 4eda344 + a59b8a2 commit eae345a

File tree

10 files changed

+106
-6
lines changed

10 files changed

+106
-6
lines changed
 

‎charts/cinder-csi-plugin/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v1
22
appVersion: v1.30.0
33
description: Cinder CSI Chart for OpenStack
44
name: openstack-cinder-csi
5-
version: 2.30.0
5+
version: 2.30.1-alpha.1
66
home: https://github.com/kubernetes/cloud-provider-openstack
77
icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png
88
maintainers:

‎charts/cinder-csi-plugin/templates/controllerplugin-deployment.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ spec:
5353
env:
5454
- name: ADDRESS
5555
value: /var/lib/csi/sockets/pluginproxy/csi.sock
56+
{{- if .Values.csi.attacher.extraEnv }}
57+
{{- toYaml .Values.csi.attacher.extraEnv | nindent 12 }}
58+
{{- end }}
5659
volumeMounts:
5760
- name: socket-dir
5861
mountPath: /var/lib/csi/sockets/pluginproxy/
@@ -78,6 +81,9 @@ spec:
7881
env:
7982
- name: ADDRESS
8083
value: /var/lib/csi/sockets/pluginproxy/csi.sock
84+
{{- if .Values.csi.provisioner.extraEnv }}
85+
{{- toYaml .Values.csi.provisioner.extraEnv | nindent 12 }}
86+
{{- end }}
8187
volumeMounts:
8288
- name: socket-dir
8389
mountPath: /var/lib/csi/sockets/pluginproxy/
@@ -100,6 +106,9 @@ spec:
100106
env:
101107
- name: ADDRESS
102108
value: /var/lib/csi/sockets/pluginproxy/csi.sock
109+
{{- if .Values.csi.snapshotter.extraEnv }}
110+
{{- toYaml .Values.csi.snapshotter.extraEnv | nindent 12 }}
111+
{{- end }}
103112
volumeMounts:
104113
- mountPath: /var/lib/csi/sockets/pluginproxy/
105114
name: socket-dir
@@ -123,6 +132,9 @@ spec:
123132
env:
124133
- name: ADDRESS
125134
value: /var/lib/csi/sockets/pluginproxy/csi.sock
135+
{{- if .Values.csi.resizer.extraEnv }}
136+
{{- toYaml .Values.csi.resizer.extraEnv | nindent 12 }}
137+
{{- end }}
126138
volumeMounts:
127139
- name: socket-dir
128140
mountPath: /var/lib/csi/sockets/pluginproxy/
@@ -143,6 +155,9 @@ spec:
143155
env:
144156
- name: ADDRESS
145157
value: /var/lib/csi/sockets/pluginproxy/csi.sock
158+
{{- if .Values.csi.livenessprobe.extraEnv }}
159+
{{- toYaml .Values.csi.livenessprobe.extraEnv | nindent 12 }}
160+
{{- end }}
146161
volumeMounts:
147162
- mountPath: /var/lib/csi/sockets/pluginproxy/
148163
name: socket-dir
@@ -173,6 +188,9 @@ spec:
173188
value: /etc/kubernetes/{{ .Values.secret.filename }}
174189
- name: CLUSTER_NAME
175190
value: "{{ .Values.clusterID }}"
191+
{{- if .Values.csi.plugin.extraEnv }}
192+
{{- toYaml .Values.csi.plugin.extraEnv | nindent 12 }}
193+
{{- end }}
176194
ports:
177195
- containerPort: 9808
178196
name: healthz

‎charts/cinder-csi-plugin/templates/nodeplugin-daemonset.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ spec:
4949
valueFrom:
5050
fieldRef:
5151
fieldPath: spec.nodeName
52+
{{- if .Values.csi.nodeDriverRegistrar.extraEnv }}
53+
{{- toYaml .Values.csi.nodeDriverRegistrar.extraEnv | nindent 12 }}
54+
{{- end }}
5255
volumeMounts:
5356
- name: socket-dir
5457
mountPath: /csi
@@ -68,6 +71,10 @@ spec:
6871
{{- tpl . $ | trim | nindent 12 }}
6972
{{- end }}
7073
{{- end }}
74+
env:
75+
{{- if .Values.csi.livenessprobe.extraEnv }}
76+
{{- toYaml .Values.csi.livenessprobe.extraEnv | nindent 12 }}
77+
{{- end }}
7178
volumeMounts:
7279
- name: socket-dir
7380
mountPath: /csi
@@ -95,6 +102,9 @@ spec:
95102
value: unix://csi/csi.sock
96103
- name: CLOUD_CONFIG
97104
value: /etc/kubernetes/{{ .Values.secret.filename }}
105+
{{- if .Values.csi.plugin.extraEnv }}
106+
{{- toYaml .Values.csi.plugin.extraEnv | nindent 12 }}
107+
{{- end }}
98108
ports:
99109
- containerPort: 9808
100110
name: healthz

‎charts/cinder-csi-plugin/values.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ csi:
1212
pullPolicy: IfNotPresent
1313
resources: {}
1414
extraArgs: {}
15+
extraEnv: []
1516
provisioner:
1617
topology: "true"
1718
image:
@@ -20,20 +21,23 @@ csi:
2021
pullPolicy: IfNotPresent
2122
resources: {}
2223
extraArgs: {}
24+
extraEnv: []
2325
snapshotter:
2426
image:
2527
repository: registry.k8s.io/sig-storage/csi-snapshotter
2628
tag: v6.3.2
2729
pullPolicy: IfNotPresent
2830
resources: {}
2931
extraArgs: {}
32+
extraEnv: []
3033
resizer:
3134
image:
3235
repository: registry.k8s.io/sig-storage/csi-resizer
3336
tag: v1.9.2
3437
pullPolicy: IfNotPresent
3538
resources: {}
3639
extraArgs: {}
40+
extraEnv: []
3741
livenessprobe:
3842
image:
3943
repository: registry.k8s.io/sig-storage/livenessprobe
@@ -45,13 +49,15 @@ csi:
4549
periodSeconds: 60
4650
resources: {}
4751
extraArgs: {}
52+
extraEnv: []
4853
nodeDriverRegistrar:
4954
image:
5055
repository: registry.k8s.io/sig-storage/csi-node-driver-registrar
5156
tag: v2.9.2
5257
pullPolicy: IfNotPresent
5358
resources: {}
5459
extraArgs: {}
60+
extraEnv: []
5561
plugin:
5662
image:
5763
repository: registry.k8s.io/provider-os/cinder-csi-plugin
@@ -131,6 +137,7 @@ csi:
131137
podMonitor:
132138
enabled: false
133139
extraArgs: {}
140+
extraEnv: []
134141

135142
# Log verbosity level.
136143
# See https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md

‎charts/manila-csi-plugin/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v1
22
appVersion: v1.30.0
33
description: Manila CSI Chart for OpenStack
44
name: openstack-manila-csi
5-
version: 2.30.0
5+
version: 2.30.1-alpha.1
66
home: http://github.com/kubernetes/cloud-provider-openstack
77
icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png
88
maintainers:

‎charts/manila-csi-plugin/templates/controllerplugin-statefulset.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ spec:
3232
env:
3333
- name: ADDRESS
3434
value: "unix:///var/lib/kubelet/plugins/{{ printf "%s.%s" .protocolSelector $.Values.driverName | lower }}/csi-controllerplugin.sock"
35+
{{- if $.Values.controllerplugin.provisioner.extraEnv }}
36+
{{- toYaml $.Values.controllerplugin.provisioner.extraEnv | nindent 12 }}
37+
{{- end }}
3538
imagePullPolicy: {{ $.Values.controllerplugin.provisioner.image.pullPolicy }}
3639
volumeMounts:
3740
- name: {{ .protocolSelector | lower }}-plugin-dir
@@ -46,6 +49,9 @@ spec:
4649
env:
4750
- name: ADDRESS
4851
value: "unix:///var/lib/kubelet/plugins/{{ printf "%s.%s" .protocolSelector $.Values.driverName | lower }}/csi-controllerplugin.sock"
52+
{{- if $.Values.controllerplugin.snapshotter.extraEnv }}
53+
{{- toYaml $.Values.controllerplugin.snapshotter.extraEnv | nindent 12 }}
54+
{{- end }}
4955
imagePullPolicy: {{ $.Values.controllerplugin.snapshotter.image.pullPolicy }}
5056
volumeMounts:
5157
- name: {{ .protocolSelector | lower }}-plugin-dir
@@ -61,6 +67,9 @@ spec:
6167
env:
6268
- name: ADDRESS
6369
value: "unix:///var/lib/kubelet/plugins/{{ printf "%s.%s" .protocolSelector $.Values.driverName | lower }}/csi-controllerplugin.sock"
70+
{{- if $.Values.controllerplugin.resizer.extraEnv }}
71+
{{- toYaml $.Values.controllerplugin.resizer.extraEnv | nindent 12 }}
72+
{{- end }}
6473
imagePullPolicy: {{ $.Values.controllerplugin.resizer.image.pullPolicy }}
6574
volumeMounts:
6675
- name: {{ .protocolSelector | lower }}-plugin-dir
@@ -107,6 +116,9 @@ spec:
107116
value: "unix://{{ .fwdNodePluginEndpoint.dir }}/{{ .fwdNodePluginEndpoint.sockFile }}"
108117
- name: MANILA_SHARE_PROTO
109118
value: "{{ .protocolSelector }}"
119+
{{- if $.Values.controllerplugin.nodeplugin.extraEnv }}
120+
{{- toYaml $.Values.controllerplugin.nodeplugin.extraEnv | nindent 12 }}
121+
{{- end }}
110122
imagePullPolicy: {{ $.Values.csimanila.image.pullPolicy }}
111123
volumeMounts:
112124
- name: {{ .protocolSelector | lower }}-plugin-dir

‎charts/manila-csi-plugin/templates/nodeplugin-daemonset.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ spec:
2929
valueFrom:
3030
fieldRef:
3131
fieldPath: spec.nodeName
32+
{{- if $.Values.nodeplugin.registrar.extraEnv }}
33+
{{- toYaml $.Values.nodeplugin.registrar.extraEnv | nindent 12 }}
34+
{{- end }}
3235
imagePullPolicy: {{ $.Values.nodeplugin.registrar.image.pullPolicy }}
3336
volumeMounts:
3437
- name: {{ .protocolSelector | lower }}-plugin-dir
@@ -74,6 +77,9 @@ spec:
7477
value: "unix://{{ .fwdNodePluginEndpoint.dir }}/{{ .fwdNodePluginEndpoint.sockFile }}"
7578
- name: MANILA_SHARE_PROTO
7679
value: "{{ .protocolSelector }}"
80+
{{- if $.Values.nodeplugin.nodeplugin.extraEnv }}
81+
{{- toYaml $.Values.nodeplugin.nodeplugin.extraEnv | nindent 12 }}
82+
{{- end }}
7783
imagePullPolicy: {{ $.Values.csimanila.image.pullPolicy }}
7884
volumeMounts:
7985
- name: {{ .protocolSelector | lower }}-plugin-dir

‎charts/manila-csi-plugin/values.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@ nodeplugin:
5656
# CSI Manila container compute resources constraints
5757
nodeplugin:
5858
resources: {}
59+
extraEnv: []
5960
# csi-node-driver-registrar
6061
registrar:
6162
image:
6263
repository: registry.k8s.io/sig-storage/csi-node-driver-registrar
6364
tag: v2.4.0
6465
pullPolicy: IfNotPresent
6566
resources: {}
67+
extraEnv: []
6668
nodeSelector: {}
6769
tolerations: []
6870
affinity: {}
@@ -81,13 +83,15 @@ controllerplugin:
8183
# CSI Manila container compute resources constraints
8284
nodeplugin:
8385
resources: {}
86+
extraEnv: []
8487
# CSI external-provisioner container spec
8588
provisioner:
8689
image:
8790
repository: registry.k8s.io/sig-storage/csi-provisioner
8891
tag: v3.0.0
8992
pullPolicy: IfNotPresent
9093
resources: {}
94+
extraEnv: []
9195
# Whether to pass --extra-create-metadata flag to csi-provisioner.
9296
extraCreateMetadata: false
9397
# CSI external-snapshotter container spec
@@ -97,13 +101,15 @@ controllerplugin:
97101
tag: v5.0.1
98102
pullPolicy: IfNotPresent
99103
resources: {}
104+
extraEnv: []
100105
# CSI external-resizer container spec
101106
resizer:
102107
image:
103108
repository: registry.k8s.io/sig-storage/csi-resizer
104109
tag: v1.8.0
105110
pullPolicy: IfNotPresent
106111
resources: {}
112+
extraEnv: []
107113
nodeSelector: {}
108114
tolerations: []
109115
affinity: {}

‎pkg/csi/cinder/nodeserver.go

+20-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol
398398
options = append(options, collectMountOptions(fsType, mountFlags)...)
399399
}
400400
// Mount
401-
err = m.Mounter().FormatAndMount(devicePath, stagingTarget, fsType, options)
401+
err = ns.formatAndMountRetry(devicePath, stagingTarget, fsType, options)
402402
if err != nil {
403403
return nil, status.Error(codes.Internal, err.Error())
404404
}
@@ -426,6 +426,25 @@ func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol
426426
return &csi.NodeStageVolumeResponse{}, nil
427427
}
428428

429+
// formatAndMountRetry attempts to format and mount a device at the given path.
430+
// If the initial mount fails, it rescans the device and retries the mount operation.
431+
func (ns *nodeServer) formatAndMountRetry(devicePath, stagingTarget, fsType string, options []string) error {
432+
m := ns.Mount
433+
err := m.Mounter().FormatAndMount(devicePath, stagingTarget, fsType, options)
434+
if err != nil {
435+
klog.Infof("Initial format and mount failed: %v. Attempting rescan.", err)
436+
// Attempting rescan if the initial mount fails
437+
rescanErr := blockdevice.RescanDevice(devicePath)
438+
if rescanErr != nil {
439+
klog.Infof("Rescan failed: %v. Returning original mount error.", rescanErr)
440+
return err
441+
}
442+
klog.Infof("Rescan succeeded, retrying format and mount")
443+
err = m.Mounter().FormatAndMount(devicePath, stagingTarget, fsType, options)
444+
}
445+
return err
446+
}
447+
429448
func (ns *nodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
430449
klog.V(4).Infof("NodeUnstageVolume: called with args %+v", protosanitizer.StripSecrets(*req))
431450

‎pkg/util/blockdevice/blockdevice_linux.go

+25-3
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ func checkBlockDeviceSize(devicePath string, deviceMountPath string, newSize int
8585
return nil
8686
}
8787

88+
func triggerRescan(blockDeviceRescanPath string) error {
89+
klog.V(4).Infof("Rescanning %q block device geometry", blockDeviceRescanPath)
90+
err := os.WriteFile(blockDeviceRescanPath, []byte{'1'}, 0666)
91+
if err != nil {
92+
klog.Errorf("Error rescanning new block device geometry: %v", err)
93+
return err
94+
}
95+
return nil
96+
}
97+
8898
func RescanBlockDeviceGeometry(devicePath string, deviceMountPath string, newSize int64) error {
8999
if newSize == 0 {
90100
klog.Error("newSize is empty, skipping the block device rescan")
@@ -106,13 +116,25 @@ func RescanBlockDeviceGeometry(devicePath string, deviceMountPath string, newSiz
106116
}
107117

108118
klog.V(3).Infof("Resolved block device path from %q to %q", devicePath, blockDeviceRescanPath)
109-
klog.V(4).Infof("Rescanning %q block device geometry", devicePath)
110-
err = os.WriteFile(blockDeviceRescanPath, []byte{'1'}, 0666)
119+
err = triggerRescan(blockDeviceRescanPath)
111120
if err != nil {
112-
klog.Errorf("Error rescanning new block device geometry: %v", err)
113121
// no need to run checkBlockDeviceSize second time here, return the saved error
114122
return bdSizeErr
115123
}
116124

117125
return checkBlockDeviceSize(devicePath, deviceMountPath, newSize)
118126
}
127+
128+
func RescanDevice(devicePath string) error {
129+
blockDeviceRescanPath, err := findBlockDeviceRescanPath(devicePath)
130+
if err != nil {
131+
return fmt.Errorf("Device does not have rescan path " + devicePath)
132+
}
133+
134+
klog.V(3).Infof("Resolved block device path from %q to %q", devicePath, blockDeviceRescanPath)
135+
err = triggerRescan(blockDeviceRescanPath)
136+
if err != nil {
137+
return fmt.Errorf("Error rescanning new block device geometry " + devicePath)
138+
}
139+
return nil
140+
}

0 commit comments

Comments
 (0)
Please sign in to comment.