Skip to content

Commit 32a5622

Browse files
dgaponcickayrus
andauthored
Fix config drive mount and add flag to control the search order in which the driver retrieves instance metadata (#3141)
* add mount for config drive and add search order flag * rebase and fix conflict * remove duplicate searchorder flag * remove trail newline * Apply suggestion from @kayrus * mount /dev/disk instead of /dev * bump chart version * mount /dev to get access to the config-drive --------- Co-authored-by: pýrus <kayrus@users.noreply.github.com>
1 parent e266965 commit 32a5622

6 files changed

Lines changed: 31 additions & 4 deletions

File tree

charts/manila-csi-plugin/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v1
22
appVersion: v1.36.0
33
description: Manila CSI Chart for OpenStack
44
name: openstack-manila-csi
5-
version: 2.36.1
5+
version: 2.36.2
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/nodeplugin-daemonset.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ spec:
6262
--drivername=$(DRIVER_NAME)
6363
--share-protocol-selector=$(MANILA_SHARE_PROTO)
6464
--fwdendpoint=$(FWD_CSI_ENDPOINT)
65-
--cluster-id=$(CLUSTER_NAME)'
65+
--cluster-id="{{ $.Values.csimanila.clusterID }}"
66+
{{- if $.Values.csimanila.searchOrder }}
67+
--search-order="{{ $.Values.csimanila.searchOrder }}"
68+
{{- end }}'
6669
]
6770
env:
6871
- name: DRIVER_NAME
@@ -91,6 +94,9 @@ spec:
9194
mountPath: /runtimeconfig
9295
readOnly: true
9396
{{- end }}
97+
- name: configdrive-dev
98+
mountPath: /dev
99+
mountPropagation: "HostToContainer"
94100
{{- with $.Values.nodeplugin.volumeMounts }}
95101
{{- toYaml . | nindent 12 }}
96102
{{- end }}
@@ -117,6 +123,10 @@ spec:
117123
name: manila-csi-runtimeconf-cm
118124
{{- end }}
119125
{{- end }}
126+
- name: configdrive-dev
127+
hostPath:
128+
path: /dev
129+
type: Directory
120130
{{- with .Values.nodeplugin.volumes }}
121131
{{- toYaml . | nindent 8 }}
122132
{{- end }}

charts/manila-csi-plugin/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ csimanila:
4848
pullPolicy: IfNotPresent
4949
tag: # defaults to .Chart.AppVersion
5050

51+
# Set the search order in which the driver retrieves metadata relating to the instance (s) in which it runs
52+
searchOrder: ""
53+
5154
# DeamonSet deployment
5255
nodeplugin:
5356
# Component name

cmd/manila-csi-plugin/main.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ var (
5252
userAgentData []string
5353
provideControllerService bool
5454
provideNodeService bool
55+
searchOrder string
5556
)
5657

5758
func validateShareProtocolSelector(v string) error {
@@ -104,8 +105,13 @@ func main() {
104105
}
105106

106107
if provideNodeService {
108+
err = metadata.CheckMetadataSearchOrder(searchOrder)
109+
if err != nil {
110+
klog.Fatalf("Invalid search-order: %v", err)
111+
}
112+
107113
// Initialize metadata
108-
metadata := metadata.GetMetadataProvider("")
114+
metadata := metadata.GetMetadataProvider(searchOrder)
109115

110116
err = d.SetupNodeService(metadata)
111117
if err != nil {
@@ -158,6 +164,7 @@ func main() {
158164

159165
cmd.PersistentFlags().BoolVar(&provideControllerService, "provide-controller-service", true, "If set to true then the CSI driver does provide the controller service (default: true)")
160166
cmd.PersistentFlags().BoolVar(&provideNodeService, "provide-node-service", true, "If set to true then the CSI driver does provide the node service (default: true)")
167+
cmd.PersistentFlags().StringVar(&searchOrder, "search-order", "configDrive,metadataService", "The search order in which the driver retrieves metadata relating to the instance (s) in which it runs")
161168

162169
code := cli.Run(cmd)
163170
os.Exit(code)

docs/manila-csi-plugin/using-manila-csi-plugin.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Option | Default value | Description
4444
`--provide-controller-service` | `true` | If set to true then the CSI driver does provide the controller service.
4545
`--provide-node-service` | `true` | If set to true then the CSI driver does provide the node service.
4646
`--pvc-annotations` | `false` | If set to true then the CSI driver will use PVC annotations as an additional information when creating shares. See [Supported PVC annotations](#supported-pvc-annotations) for more info.
47+
`--search-order` | `configDrive,metadataService` | The search order in which the driver retrieves metadata relating to the instance in which it runs. Only effective when `--provide-node-service=true`.
4748

4849
### Controller Service volume parameters
4950

manifests/manila-csi-plugin/csi-nodeplugin.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ spec:
8080
mountPath: /var/lib/kubelet/plugins/manila.csi.openstack.org
8181
- name: fwd-plugin-dir
8282
mountPath: /var/lib/kubelet/plugins/FWD-NODEPLUGIN
83+
- name: configdrive-dev
84+
mountPath: /dev
85+
mountPropagation: "HostToContainer"
8386
volumes:
8487
- name: registration-dir
8588
hostPath:
@@ -93,4 +96,7 @@ spec:
9396
hostPath:
9497
path: /var/lib/kubelet/plugins/FWD-NODEPLUGIN
9598
type: DirectoryOrCreate
96-
99+
- name: configdrive-dev
100+
hostPath:
101+
path: /dev
102+
type: Directory

0 commit comments

Comments
 (0)