Skip to content

Commit 2b20adb

Browse files
committed
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>
1 parent 3b659db commit 2b20adb

File tree

11 files changed

+39
-65
lines changed

11 files changed

+39
-65
lines changed

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

Lines changed: 0 additions & 6 deletions
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

Lines changed: 0 additions & 6 deletions
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

Lines changed: 0 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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

cmd/manila-csi-plugin/main.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@ func main() {
9191
PVCLister: csi.GetPVCLister(),
9292
}
9393

94-
if provideNodeService {
95-
opts.NodeID = nodeID
96-
opts.NodeAZ = nodeAZ
97-
}
98-
9994
d, err := manila.NewDriver(opts)
10095
if err != nil {
10196
klog.Fatalf("Driver initialization failed: %v", err)
@@ -131,9 +126,15 @@ func main() {
131126

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

134-
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+
}
135133

136134
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+
}
137138

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

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

Lines changed: 1 addition & 1 deletion
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>

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

Lines changed: 4 additions & 5 deletions
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

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,14 @@ spec:
8181
image: registry.k8s.io/provider-os/manila-csi-plugin:v1.31.2
8282
command: ["/bin/sh", "-c",
8383
'/bin/manila-csi-plugin
84-
--nodeid=$(NODE_ID)
8584
--endpoint=$(CSI_ENDPOINT)
8685
--drivername=$(DRIVER_NAME)
8786
--share-protocol-selector=$(MANILA_SHARE_PROTO)
8887
--fwdendpoint=$(FWD_CSI_ENDPOINT)
8988
--pvc-annotations'
90-
# To enable topology awareness and retrieve compute node AZs from the OpenStack Metadata Service, add the following flags:
89+
# To enable topology awareness and retrieve compute node AZs from the OpenStack Metadata Service, add the following flag:
9190
# --with-topology
92-
# --nodeaz=$(curl http://169.254.169.254/openstack/latest/meta_data.json | jq -r .availability_zone)
93-
# Those flags need to be added to csi-nodeplugin.yaml as well.
91+
# This flag needs to be added to csi-nodeplugin.yaml as well.
9492
]
9593
env:
9694
- name: DRIVER_NAME

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,13 @@ spec:
5353
image: registry.k8s.io/provider-os/manila-csi-plugin:v1.31.2
5454
command: ["/bin/sh", "-c",
5555
'/bin/manila-csi-plugin
56-
--nodeid=$(NODE_ID)
5756
--endpoint=$(CSI_ENDPOINT)
5857
--drivername=$(DRIVER_NAME)
5958
--share-protocol-selector=$(MANILA_SHARE_PROTO)
6059
--fwdendpoint=$(FWD_CSI_ENDPOINT)'
61-
# To enable topology awareness and retrieve compute node AZs from the OpenStack Metadata Service, add the following flags:
60+
# To enable topology awareness and retrieve compute node AZs from the OpenStack Metadata Service, add the following flag:
6261
# --with-topology
63-
# --nodeaz=$(curl http://169.254.169.254/openstack/latest/meta_data.json | jq -r .availability_zone)
64-
# Those flags need to be added to csi-controllerplugin.yaml as well.
62+
# This flag needs to be added to csi-controllerplugin.yaml as well.
6563
]
6664
env:
6765
- name: DRIVER_NAME

pkg/csi/manila/driver.go

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,13 @@ import (
3737
"k8s.io/klog/v2"
3838
)
3939

40-
type DriverOpts struct {
41-
DriverName string
42-
NodeID string
43-
NodeAZ string
44-
WithTopology bool
45-
ShareProto string
46-
ClusterID string
47-
48-
ServerCSIEndpoint string
49-
FwdCSIEndpoint string
50-
51-
ManilaClientBuilder manilaclient.Builder
52-
CSIClientBuilder csiclient.Builder
53-
54-
PVCLister v1.PersistentVolumeClaimLister
55-
}
56-
5740
type Driver struct {
58-
nodeID string
59-
nodeAZ string
41+
name string
42+
fqVersion string // Fully qualified version in format {driverVersion}@{CPO version}
43+
shareProto string
44+
clusterID string
45+
6046
withTopology bool
61-
name string
62-
fqVersion string // Fully qualified version in format {driverVersion}@{CPO version}
63-
shareProto string
64-
clusterID string
6547

6648
serverEndpoint string
6749
fwdEndpoint string
@@ -80,6 +62,22 @@ type Driver struct {
8062
pvcLister v1.PersistentVolumeClaimLister
8163
}
8264

65+
type DriverOpts struct {
66+
DriverName string
67+
ShareProto string
68+
ClusterID string
69+
70+
WithTopology bool
71+
72+
ServerCSIEndpoint string
73+
FwdCSIEndpoint string
74+
75+
ManilaClientBuilder manilaclient.Builder
76+
CSIClientBuilder csiclient.Builder
77+
78+
PVCLister v1.PersistentVolumeClaimLister
79+
}
80+
8381
type nonBlockingGRPCServer struct {
8482
wg sync.WaitGroup
8583
server *grpc.Server
@@ -118,8 +116,6 @@ func NewDriver(o *DriverOpts) (*Driver, error) {
118116

119117
d := &Driver{
120118
fqVersion: fmt.Sprintf("%s@%s", driverVersion, version.Version),
121-
nodeID: o.NodeID,
122-
nodeAZ: o.NodeAZ,
123119
withTopology: o.WithTopology,
124120
name: o.DriverName,
125121
serverEndpoint: o.ServerCSIEndpoint,
@@ -139,7 +135,7 @@ func NewDriver(o *DriverOpts) (*Driver, error) {
139135
klog.Infof("Operating on %s shares", d.shareProto)
140136

141137
if d.withTopology {
142-
klog.Infof("Topology awareness enabled, node availability zone: %s", d.nodeAZ)
138+
klog.Infof("Topology awareness enabled")
143139
} else {
144140
klog.Info("Topology awareness disabled")
145141
}

0 commit comments

Comments
 (0)