Skip to content

Commit e8b16cb

Browse files
committed
cinder&glance: allow users to set nodeSelector
Some scenarios may require specific restrictions for the place where the nodes are deployed. This change adds new variable which allows users to set nodeSelector rules for cinder-backup, cinder-volume (per backend) and glance.
1 parent 89f1ec7 commit e8b16cb

File tree

11 files changed

+84
-0
lines changed

11 files changed

+84
-0
lines changed

tests/roles/cinder_adoption/defaults/main.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,8 @@ cinder_volume_pure_vars:
136136
# Vars for cinder-backup
137137
cinder_backup_nfs_backup_mount_point_base: "/var/lib/cinder/backup"
138138
cinder_retry_delay: 5
139+
140+
# Dictionary of nodeSelector key/values as keys of cinder-volume backend names
141+
cinder_volumes_nodeselector: {}
142+
# Dictionary of nodeSelector key/values
143+
cinder_backup_nodeselector: {}

tests/roles/cinder_adoption/tasks/backup_backend.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@
1818
cinder_backup_backend == 'nfs' or
1919
cinder_backup_backend == 'ontap-nfs'
2020
ansible.builtin.include_tasks: cinder_backup_nfs.yaml
21+
22+
- name: Apply additional cinder-backup settings
23+
ansible.builtin.include_tasks: extra_cinder_backup_settings.yaml
24+
when: cinder_backup_nodeselector | length > 0
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
- name: Generate the nodeSelector patch for cinder-backup
3+
ansible.builtin.template:
4+
src: cinder_backup_extra_nodeselector.yaml.j2
5+
dest: /tmp/cinder_backup_extra_nodeselector.yaml
6+
mode: "0600"
7+
8+
- name: Apply the nodeSelector patch for cinder-backup
9+
ansible.builtin.shell: |
10+
{{ shell_header }}
11+
{{ oc_header }}
12+
oc patch openstackcontrolplane openstack --type=merge --patch-file=/tmp/cinder_backup_extra_nodeselector.yaml
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
- name: Generate the nodeSelector patch for the Cinder volumes
3+
ansible.builtin.template:
4+
src: cinder_volumes_extra_nodeselector.yaml.j2
5+
dest: /tmp/cinder_volumes_extra_nodeselector.yaml
6+
mode: "0600"
7+
8+
- name: Apply the nodeSelector patch for the Cinder volumes
9+
ansible.builtin.shell: |
10+
{{ shell_header }}
11+
{{ oc_header }}
12+
oc patch openstackcontrolplane openstack --type=merge --patch-file=/tmp/cinder_volumes_extra_nodeselector.yaml

tests/roles/cinder_adoption/tasks/volume_backend.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@
1515
when: >
1616
cinder_volume_backend == 'pure-fc'
1717
ansible.builtin.include_tasks: cinder_volume_pure.yaml
18+
19+
- name: Apply additional settings to Cinder volumes
20+
ansible.builtin.include_tasks: extra_cinder_volumes_settings.yaml
21+
when: cinder_volumes_nodeselector | length > 0
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
spec:
2+
cinder:
3+
template:
4+
cinderBackup:
5+
nodeSelector:
6+
{% for ns_key, ns_value in cinder_backup_nodeselector.items() %}
7+
{{ ns_key }}: {{ ns_value }}
8+
{% endfor %}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
spec:
2+
cinder:
3+
template:
4+
cinderVolumes:
5+
{% for cv_name, cv_nodeselector in cinder_volumes_nodeselector.items() %}
6+
{{ cv_name }}:
7+
nodeSelector:
8+
{% for ns_key, ns_value in cv_nodeselector.items() %}
9+
{{ ns_key }}: {{ ns_value }}
10+
{% endfor %}
11+
{% endfor %}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# glance_backend can be 'nfs', 'ceph', 'swift', 'cinder'
22
glance_backend: swift
33
glance_retry_delay: 5
4+
5+
# Dictionary of nodeSelector key/values
6+
glance_nodeselector: {}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
- name: Generate the nodeSelector patch for Glance
3+
ansible.builtin.template:
4+
src: glance_extra_nodeselector.yaml.j2
5+
dest: /tmp/glance_extra_nodeselector.yaml
6+
mode: "0600"
7+
8+
- name: Apply the nodeSelector patch for Glance
9+
ansible.builtin.shell: |
10+
{{ shell_header }}
11+
{{ oc_header }}
12+
oc patch openstackcontrolplane openstack --type=merge --patch-file=/tmp/glance_extra_nodeselector.yaml

tests/roles/glance_adoption/tasks/main.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,9 @@
1414
when: glance_backend == 'cinder'
1515
ansible.builtin.include_tasks: glance_cinder.yaml
1616

17+
- name: Apply additional Glance settings
18+
ansible.builtin.include_tasks: extra_glance_settings.yaml
19+
when: glance_nodeselector | length > 0
20+
1721
- name: Check the adopted GlanceAPI
1822
ansible.builtin.include_tasks: check_glance.yaml

0 commit comments

Comments
 (0)