Skip to content

Commit a1afb70

Browse files
authored
manila-csi-plugin: Auto-configure --nodeid, --nodeaz parameters (#2734)
* Stop setting GOPROXY in Dockerfile We're seeing failures in CI related to goproxy.io. There's no need to set this so simply don't. Signed-off-by: Stephen Finucane <stephenfin@redhat.com> * docs: Remove references to the csc tool This has not seen any updates in a long time and does not appear to be maintained. Our own doc is out-of-date and references removed options. Just remove the whole thing. Signed-off-by: Stephen Finucane <stephenfin@redhat.com> * manila-csi-plugin: Enable auto-detection of topology, node ID Same as we do for Cinder. A separate change will deprecate the respective options. Signed-off-by: Stephen Finucane <stephenfin@redhat.com> * manila-csi-plugin: Deprecate --nodeid, --nodeaz flags These are no longer used or necessary, now that we retrieve this information from the metadata service. Signed-off-by: Stephen Finucane <stephenfin@redhat.com> * cinder-csi-plugin: Trivial variable rename To clarify their meaning. Signed-off-by: Stephen Finucane <stephenfin@redhat.com> --------- Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
1 parent f650ac3 commit a1afb70

File tree

18 files changed

+100
-289
lines changed

18 files changed

+100
-289
lines changed

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.31.2
33
description: Manila CSI Chart for OpenStack
44
name: openstack-manila-csi
5-
version: 2.31.2
5+
version: 2.31.3
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

-6
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,8 @@ spec:
8686
command: ["/bin/sh", "-c",
8787
'/bin/manila-csi-plugin
8888
-v={{ $.Values.logVerbosityLevel }}
89-
--nodeid=$(NODE_ID)
9089
{{- if $.Values.csimanila.topologyAwarenessEnabled }}
9190
--with-topology
92-
--nodeaz={{ $.Values.csimanila.nodeAZ }}
9391
{{- end }}
9492
{{- if $.Values.csimanila.runtimeConfig.enabled }}
9593
--runtime-config-file=/runtimeconfig/runtimeconfig.json
@@ -109,10 +107,6 @@ spec:
109107
env:
110108
- name: DRIVER_NAME
111109
value: {{ printf "%s.%s" .protocolSelector $.Values.driverName | lower }}
112-
- name: NODE_ID
113-
valueFrom:
114-
fieldRef:
115-
fieldPath: spec.nodeName
116110
- name: CSI_ENDPOINT
117111
value: "unix:///var/lib/kubelet/plugins/{{ printf "%s.%s" .protocolSelector $.Values.driverName | lower }}/csi-controllerplugin.sock"
118112
- name: FWD_CSI_ENDPOINT

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

-6
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,11 @@ spec:
5050
command: ["/bin/sh", "-c",
5151
'/bin/manila-csi-plugin
5252
-v={{ $.Values.logVerbosityLevel }}
53-
--nodeid=$(NODE_ID)
5453
{{- if $.Values.csimanila.runtimeConfig.enabled }}
5554
--runtime-config-file=/runtimeconfig/runtimeconfig.json
5655
{{- end }}
5756
{{- if $.Values.csimanila.topologyAwarenessEnabled }}
5857
--with-topology
59-
--nodeaz={{ $.Values.csimanila.nodeAZ }}
6058
{{- end }}
6159
--endpoint=$(CSI_ENDPOINT)
6260
--drivername=$(DRIVER_NAME)
@@ -67,10 +65,6 @@ spec:
6765
env:
6866
- name: DRIVER_NAME
6967
value: {{ printf "%s.%s" .protocolSelector $.Values.driverName | lower }}
70-
- name: NODE_ID
71-
valueFrom:
72-
fieldRef:
73-
fieldPath: spec.nodeName
7468
- name: CSI_ENDPOINT
7569
value: "unix:///var/lib/kubelet/plugins/{{ printf "%s.%s" .protocolSelector $.Values.driverName | lower }}/csi.sock"
7670
- name: FWD_CSI_ENDPOINT

charts/manila-csi-plugin/values.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ csimanila:
3535
}
3636
}
3737
38-
# Availability zone for each node. topologyAwarenessEnabled must be set to true for this option to have any effect.
39-
# If your Kubernetes cluster runs atop of Nova and want to use Nova AZs as AZs for the nodes of the cluster, uncomment the line below:
40-
# nodeAZ: "$(curl http://169.254.169.254/openstack/latest/meta_data.json | jq -r .availability_zone)"
41-
4238
# You may set ID of the cluster where manila-csi is deployed. This value will be appended
4339
# to share metadata in newly provisioned shares as `manila.csi.openstack.org/cluster=<cluster ID>`.
4440
clusterID: ""

cmd/cinder-csi-plugin/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func main() {
7676
csi.AddPVCFlags(cmd)
7777

7878
cmd.PersistentFlags().StringVar(&nodeID, "nodeid", "", "node id")
79-
if err := cmd.PersistentFlags().MarkDeprecated("nodeid", "This flag would be removed in future. Currently, the value is ignored by the driver"); err != nil {
79+
if err := cmd.PersistentFlags().MarkDeprecated("nodeid", "This option is now ignored by the driver. It will be removed in a future release."); err != nil {
8080
klog.Fatalf("Unable to mark flag nodeid to be deprecated: %v", err)
8181
}
8282

@@ -129,7 +129,7 @@ func handle() {
129129
}
130130

131131
if provideNodeService {
132-
//Initialize mount
132+
// Initialize mount
133133
mount := mount.GetMountProvider()
134134

135135
cfg, err := openstack.GetConfigFromFiles(cloudConfig)
@@ -138,7 +138,7 @@ func handle() {
138138
return
139139
}
140140

141-
//Initialize Metadata
141+
// Initialize Metadata
142142
metadata := metadata.GetMetadataProvider(cfg.Metadata.SearchOrder)
143143

144144
d.SetupNodeService(mount, metadata, cfg.BlockStorage, additionalTopologies)

cmd/manila-csi-plugin/main.go

+12-7
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"k8s.io/cloud-provider-openstack/pkg/csi/manila/csiclient"
2828
"k8s.io/cloud-provider-openstack/pkg/csi/manila/manilaclient"
2929
"k8s.io/cloud-provider-openstack/pkg/csi/manila/runtimeconfig"
30+
"k8s.io/cloud-provider-openstack/pkg/util/metadata"
3031
"k8s.io/cloud-provider-openstack/pkg/version"
3132
"k8s.io/component-base/cli"
3233
"k8s.io/klog/v2"
@@ -90,11 +91,6 @@ func main() {
9091
PVCLister: csi.GetPVCLister(),
9192
}
9293

93-
if provideNodeService {
94-
opts.NodeID = nodeID
95-
opts.NodeAZ = nodeAZ
96-
}
97-
9894
d, err := manila.NewDriver(opts)
9995
if err != nil {
10096
klog.Fatalf("Driver initialization failed: %v", err)
@@ -108,7 +104,10 @@ func main() {
108104
}
109105

110106
if provideNodeService {
111-
err = d.SetupNodeService()
107+
// Initialize metadata
108+
metadata := metadata.GetMetadataProvider("")
109+
110+
err = d.SetupNodeService(metadata)
112111
if err != nil {
113112
klog.Fatalf("Driver node service initialization failed: %v", err)
114113
}
@@ -127,9 +126,15 @@ func main() {
127126

128127
cmd.PersistentFlags().StringVar(&driverName, "drivername", "manila.csi.openstack.org", "name of the driver")
129128

130-
cmd.PersistentFlags().StringVar(&nodeID, "nodeid", "", "this node's ID. This value is required if the node service is provided by this CSI driver instance.")
129+
cmd.PersistentFlags().StringVar(&nodeID, "nodeid", "", "this node's ID")
130+
if err := cmd.PersistentFlags().MarkDeprecated("nodeid", "This option is now ignored by the driver. It will be removed in a future release."); err != nil {
131+
klog.Fatalf("Unable to mark flag nodeid to be deprecated: %v", err)
132+
}
131133

132134
cmd.PersistentFlags().StringVar(&nodeAZ, "nodeaz", "", "this node's availability zone")
135+
if err := cmd.PersistentFlags().MarkDeprecated("nodeaz", "This option is now ignored by the driver. It will be removed in a future release."); err != nil {
136+
klog.Fatalf("Unable to mark flag nodeaz to be deprecated: %v", err)
137+
}
133138

134139
cmd.PersistentFlags().StringVar(&runtimeConfigFile, "runtime-config-file", "", "path to the runtime configuration file")
135140

docs/cinder-csi-plugin/csc-tool.md

-198
This file was deleted.

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ In addition to the standard set of klog flags, `cinder-csi-plugin` accepts the f
5656
<dl>
5757
<dt>--nodeid &lt;node id&gt;</dt>
5858
<dd>
59-
This argument is deprecated, will be removed in future.
59+
This argument is deprecated. It will be removed in future.
6060

6161
An identifier for the current node which will be used in OpenStack API calls. This can be either the UUID or name of the OpenStack server, but note that if using name it must be unique.
6262
</dd>
@@ -335,8 +335,6 @@ Run sanity tests for cinder CSI driver using:
335335
$ make test-cinder-csi-sanity
336336
```
337337

338-
Optionally, to test the driver csc tool could be used. please refer, [usage guide](./csc-tool.md) for more info.
339-
340338
## In-tree Cinder provisioner to cinder CSI Migration
341339

342340
Starting from Kubernetes 1.21, OpenStack Cinder CSI migration is supported as beta feature and is `ON` by default. Cinder CSI driver must be installed on clusters on OpenStack for Cinder volumes to work. If you have persistence volumes that are created with in-tree `kubernetes.io/cinder` plugin, you could migrate to use `cinder.csi.openstack.org` Container Storage Interface (CSI) Driver.

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

+4-5
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ Option | Default value | Description
3434
-------|---------------|------------
3535
`--endpoint` | `unix:///tmp/csi.sock` | CSI Manila's CSI endpoint
3636
`--drivername` | `manila.csi.openstack.org` | Name of this driver
37-
`--nodeid` | _none_ | ID of this node
38-
`--nodeaz` | _none_ | Availability zone of this node
37+
`--nodeid` | _none_ | **DEPRECATED** ID of this node. This value is now automatically retrieved from the metadata service.
38+
`--nodeaz` | _none_ | **DEPRECATED** Availability zone of this node. This value is now automatically retrieved from the metadata service.
3939
`--runtime-config-file` | _none_ | Path to the [runtime configuration file](#runtime-configuration-file)
4040
`--with-topology` | _none_ | CSI Manila is topology-aware. See [Topology-aware dynamic provisioning](#topology-aware-dynamic-provisioning) for more info
4141
`--share-protocol-selector` | _none_ | Specifies which Manila share protocol to use for this instance of the driver. See [supported protocols](#share-protocol-support-matrix) for valid values.
@@ -103,7 +103,7 @@ With topology awareness enabled, administrators can specify the mapping between
103103
Doing so will instruct the CO scheduler to place the workloads+shares only on nodes that are able to reach the underlying storage.
104104

105105
CSI Manila uses `topology.manila.csi.openstack.org/zone` _topology key_ to identify node's affinity to a certain compute availability zone.
106-
Each node of the cluster then gets labeled with a key/value pair of `topology.manila.csi.openstack.org/zone` / value of [`--nodeaz`](#command-line-arguments) cmd arg.
106+
Each node of the cluster then gets labeled with the `topology.manila.csi.openstack.org/zone` where the value is the value of the AZ retrieved from the Nova metadata service.
107107

108108
This label may be used as a node selector when defining topology constraints for dynamic provisioning.
109109
Administrators are also free to pass arbitrary labels, and as long as they are valid node selectors, they will be honored by the scheduler.
@@ -258,11 +258,10 @@ To test the deployment further, see `examples/csi-manila-plugin`.
258258

259259
If you're deploying CSI Manila with Helm:
260260
1. Set `csimanila.topologyAwarenessEnabled` to `true`
261-
2. Set `csimanila.nodeAZ`. This value will be sourced into the [`--nodeaz`](#command-line-arguments) cmd flag. Bash expressions are also allowed.
262261

263262
If you're deploying CSI Manila manually:
264263
1. Run the [external-provisioner](https://github.com/kubernetes-csi/external-provisioner) with `--feature-gates=Topology=true` cmd flag.
265-
2. Run CSI Manila with [`--with-topology`](#command-line-arguments) and set [`--nodeaz`](#command-line-arguments) to node's availability zone. For Nova, the zone may be retrieved via the Metadata service like so: `--nodeaz=$(curl http://169.254.169.254/openstack/latest/meta_data.json | jq -r .availability_zone)`
264+
2. Run CSI Manila with [`--with-topology`](#command-line-arguments).
266265

267266
See `examples/csi-manila-plugin/nfs/topology-aware` for examples on defining topology constraints.
268267

0 commit comments

Comments
 (0)