Skip to content

Commit c6a8f80

Browse files
committed
[cinder-csi-plugin] Support of one storage class for Multi region/clouds
1 parent 29f3f0b commit c6a8f80

File tree

3 files changed

+194
-188
lines changed

3 files changed

+194
-188
lines changed

docs/cinder-csi-plugin/multi-region-clouds.md

Lines changed: 42 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
### Multi cluster Configuration file
44

5-
Create a configuration file with a subsection per openstack cluster to manage (pay attention to enable ignore-volume-az in BlockStorage section).
5+
Create a configuration file with a subsection per openstack cluster to manage.
66

7-
Example of configuration with 3 regions (The default is backward compatible with mono cluster configuration but not mandatory).
7+
Example of configuration with 3 zones (The default is backward compatible with mono cluster configuration but not mandatory).
88
```yaml
99
apiVersion: v1
1010
kind: Secret
@@ -16,64 +16,37 @@ stringData:
1616
cloud.conf: |-
1717
[BlockStorage]
1818
bs-version=v3
19-
ignore-volume-az=True
19+
ignore-volume-az=false
2020
2121
[Global]
22-
auth-url="https://auth.cloud.openstackcluster.region-default.local/v3"
23-
username="region-default-username"
24-
password="region-default-password"
22+
auth-url="https://auth.cloud.openstackcluster.zone-default.local/v3"
23+
username="zone-default-username"
24+
password="zone-default-password"
2525
region="default"
26-
tenant-id="region-default-tenant-id"
27-
tenant-name="region-default-tenant-name"
26+
tenant-id="zone-default-tenant-id"
27+
tenant-name="zone-default-tenant-name"
2828
domain-name="Default"
2929
30-
[Global "region-one"]
31-
auth-url="https://auth.cloud.openstackcluster.region-one.local/v3"
32-
username="region-one-username"
33-
password="region-one-password"
30+
[Global "zone-one"]
31+
auth-url="https://auth.cloud.openstackcluster.zone-one.local/v3"
32+
username="zone-one-username"
33+
password="zone-one-password"
3434
region="one"
35-
tenant-id="region-one-tenant-id"
36-
tenant-name="region-one-tenant-name"
35+
tenant-id="zone-one-tenant-id"
36+
tenant-name="zone-one-tenant-name"
3737
domain-name="Default"
3838
39-
[Global "region-two"]
40-
auth-url="https://auth.cloud.openstackcluster.region-two.local/v3"
41-
username="region-two-username"
42-
password="region-two-password"
39+
[Global "zone-two"]
40+
auth-url="https://auth.cloud.openstackcluster.zone-two.local/v3"
41+
username="zone-two-username"
42+
password="zone-two-password"
4343
region="two"
44-
tenant-id="region-two-tenant-id"
45-
tenant-name="region-two-tenant-name"
44+
tenant-id="zone-two-tenant-id"
45+
tenant-name="zone-two-tenant-name"
4646
domain-name="Default"
4747
```
4848
4949
50-
51-
### Create region/cloud secrets
52-
53-
Create a secret per openstack cluster which contains a key `cloud` and as value the subsection's name of corresponding openstack cluster in configuration file.
54-
55-
These secrets are referenced in storageClass definitions to identify openstack cluster associated to the storageClass.
56-
57-
```yaml
58-
apiVersion: v1
59-
kind: Secret
60-
metadata:
61-
name: openstack-config-region-one
62-
namespace: kube-system
63-
type: Opaque
64-
stringData:
65-
cloud: region-one
66-
---
67-
apiVersion: v1
68-
kind: Secret
69-
metadata:
70-
name: openstack-config-region-two
71-
namespace: kube-system
72-
type: Opaque
73-
stringData:
74-
cloud: region-two
75-
```
76-
7750
### Create storage Class for dedicated cluster
7851
7952
```yaml
@@ -82,83 +55,45 @@ kind: StorageClass
8255
metadata:
8356
annotations:
8457
storageclass.kubernetes.io/is-default-class: "true"
85-
name: sc-region-one
86-
allowVolumeExpansion: true
87-
allowedTopologies:
88-
- matchLabelExpressions:
89-
- key: topology.cinder.csi.openstack.org/zone
90-
values:
91-
- nova
92-
- key: topology.kubernetes.io/region
93-
values:
94-
- region-one
95-
parameters:
96-
csi.storage.k8s.io/controller-publish-secret-name: openstack-config-region-one
97-
csi.storage.k8s.io/controller-publish-secret-namespace: kube-system
98-
csi.storage.k8s.io/node-publish-secret-name: openstack-config-region-one
99-
csi.storage.k8s.io/node-publish-secret-namespace: kube-system
100-
csi.storage.k8s.io/node-stage-secret-name: openstack-config-region-one
101-
csi.storage.k8s.io/node-stage-secret-namespace: kube-system
102-
csi.storage.k8s.io/provisioner-secret-name: openstack-config-region-one
103-
csi.storage.k8s.io/provisioner-secret-namespace: kube-system
104-
csi.storage.k8s.io/controller-expand-secret-name: openstack-config-region-one
105-
csi.storage.k8s.io/controller-expand-secret-namespace: kube-system
106-
provisioner: cinder.csi.openstack.org
107-
reclaimPolicy: Delete
108-
volumeBindingMode: Immediate
109-
---
110-
apiVersion: storage.k8s.io/v1
111-
kind: StorageClass
112-
metadata:
113-
name: sc-region-two
58+
name: sc-multi-zones
11459
allowVolumeExpansion: true
11560
allowedTopologies:
11661
- matchLabelExpressions:
11762
- key: topology.cinder.csi.openstack.org/zone
11863
values:
11964
- nova
120-
- key: topology.kubernetes.io/region
65+
- key: topology.kubernetes.io/zone
12166
values:
122-
- region-two
123-
parameters:
124-
csi.storage.k8s.io/controller-publish-secret-name: openstack-config-region-two
125-
csi.storage.k8s.io/controller-publish-secret-namespace: kube-system
126-
csi.storage.k8s.io/node-publish-secret-name: openstack-config-region-two
127-
csi.storage.k8s.io/node-publish-secret-namespace: kube-system
128-
csi.storage.k8s.io/node-stage-secret-name: openstack-config-region-two
129-
csi.storage.k8s.io/node-stage-secret-namespace: kube-system
130-
csi.storage.k8s.io/provisioner-secret-name: openstack-config-region-two
131-
csi.storage.k8s.io/provisioner-secret-namespace: kube-system
132-
csi.storage.k8s.io/controller-expand-secret-name: openstack-config-region-two
133-
csi.storage.k8s.io/controller-expand-secret-namespace: kube-system
67+
- zone-one
68+
- zone-two
13469
provisioner: cinder.csi.openstack.org
13570
reclaimPolicy: Delete
13671
volumeBindingMode: Immediate
13772
```
13873
13974
### Create a csi-cinder-nodeplugin daemonset per cluster openstack
14075
141-
Daemonsets should deploy pods on nodes from proper openstack context. We suppose that the node have a label `topology.kubernetes.io/region` with the openstack cluster name as value (you could manage this with kubespray, manually, whatever, it should be great to implement this in openstack cloud controller manager).
76+
Daemonsets should deploy pods on nodes from proper openstack context. We suppose that the node have a label `topology.kubernetes.io/zone` with the openstack cluster name as value (you could manage this with kubespray, manually, whatever, it should be great to implement this in openstack cloud controller manager).
14277

14378
Do as follows:
14479
- Use nodeSelector to match proper nodes labels
145-
- Add cli argument `--additional-topology topology.kubernetes.io/region=region-one`, which should match node labels, to container cinder-csi-plugin
146-
- Add cli argument `--cloud-name="region-one"`, which should match configuration file subsection name, to container cinder-csi-plugin.
80+
- Add cli argument `--additional-topology topology.kubernetes.io/zone=zone-one`, which should match node labels, to container cinder-csi-plugin
81+
- Add cli argument `--cloud-name="zone-one"`, which should match configuration file subsection name, to container cinder-csi-plugin.
14782

14883
```yaml
14984
apiVersion: apps/v1
15085
kind: DaemonSet
15186
metadata:
152-
name: csi-cinder-nodeplugin-region-one
87+
name: csi-cinder-nodeplugin-zone-one
15388
namespace: kube-system
15489
spec:
15590
selector:
15691
matchLabels:
157-
app: csi-cinder-nodeplugin-region-one
92+
app: csi-cinder-nodeplugin-zone-one
15893
template:
15994
metadata:
16095
labels:
161-
app: csi-cinder-nodeplugin-region-one
96+
app: csi-cinder-nodeplugin-zone-one
16297
spec:
16398
containers:
16499
- name: node-driver-registrar
@@ -171,9 +106,9 @@ spec:
171106
- /bin/cinder-csi-plugin
172107
- --endpoint=$(CSI_ENDPOINT)
173108
- --cloud-config=$(CLOUD_CONFIG)
174-
- --cloud-name="region-one"
109+
- --cloud-name="zone-one"
175110
- --additional-topology
176-
- topology.kubernetes.io/region=region-one
111+
- topology.kubernetes.io/zone=zone-one
177112
env:
178113
- name: CSI_ENDPOINT
179114
value: unix://csi/csi.sock
@@ -187,7 +122,7 @@ spec:
187122
readOnly: true
188123
...
189124
nodeSelector:
190-
topology.kubernetes.io/region: region-one
125+
topology.kubernetes.io/zone: zone-one
191126
volumes:
192127
...
193128
- name: secret-cinderplugin
@@ -199,16 +134,16 @@ spec:
199134
apiVersion: apps/v1
200135
kind: DaemonSet
201136
metadata:
202-
name: csi-cinder-nodeplugin-region-two
137+
name: csi-cinder-nodeplugin-zone-two
203138
namespace: kube-system
204139
spec:
205140
selector:
206141
matchLabels:
207-
app: csi-cinder-nodeplugin-region-two
142+
app: csi-cinder-nodeplugin-zone-two
208143
template:
209144
metadata:
210145
labels:
211-
app: csi-cinder-nodeplugin-region-two
146+
app: csi-cinder-nodeplugin-zone-two
212147
spec:
213148
containers:
214149
- name: node-driver-registrar
@@ -221,9 +156,9 @@ spec:
221156
- /bin/cinder-csi-plugin
222157
- --endpoint=$(CSI_ENDPOINT)
223158
- --cloud-config=$(CLOUD_CONFIG)
224-
- --cloud-name="region-two"
159+
- --cloud-name="zone-two"
225160
- --additional-topology
226-
- topology.kubernetes.io/region=region-two
161+
- topology.kubernetes.io/zone=zone-two
227162
env:
228163
- name: CSI_ENDPOINT
229164
value: unix://csi/csi.sock
@@ -237,7 +172,7 @@ spec:
237172
readOnly: true
238173
...
239174
nodeSelector:
240-
topology.kubernetes.io/region: region-two
175+
topology.kubernetes.io/zone: zone-two
241176
volumes:
242177
...
243178
- name: secret-cinderplugin
@@ -251,7 +186,7 @@ spec:
251186

252187
Enable Topology feature-gate on container csi-provisioner of csi-cinder-controllerplugin deployment by adding cli argument ``--feature-gates="Topology=true"
253188

254-
Add cli argument `--cloud-name="region-one"` for each managed openstack cluster, name should match configuration file subsection name, to container `cinder-csi-plugin`.
189+
Add cli argument `--cloud-name="zone-one"` for each managed openstack cluster, name should match configuration file subsection name, to container `cinder-csi-plugin`.
255190

256191

257192
```yaml
@@ -288,8 +223,8 @@ spec:
288223
- --endpoint=$(CSI_ENDPOINT)
289224
- --cloud-config=$(CLOUD_CONFIG)
290225
- --cluster=$(CLUSTER_NAME)
291-
- --cloud-name="region-one"
292-
- --cloud-name="region-two"
226+
- --cloud-name="zone-one"
227+
- --cloud-name="zone-two"
293228
env:
294229
- name: CSI_ENDPOINT
295230
value: unix://csi/csi.sock

0 commit comments

Comments
 (0)