Skip to content

Commit 9c9ab71

Browse files
cescginaopenshift-merge-bot[bot]
authored andcommitted
Enable NFS server as cinder backend
Deploy an NFS server in a compute node using cifmw and use it as backend for cinder. This is needed to test volume migrations and depending on the result we might enable it in all jobs or only in some.
1 parent 1ca6ebb commit 9c9ab71

File tree

7 files changed

+217
-1
lines changed

7 files changed

+217
-1
lines changed

.zuul.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@
235235
voting: false
236236
description: |
237237
A Zuul job consuming content from openstack-meta-content-provider-master
238-
and deploying EDPM with master content.
238+
and deploying EDPM with master content. It configures an NFS server in a
239+
compute node as storage backend for cinder.
239240
vars:
240241
cifmw_repo_setup_branch: master
241242
# To consume containers from meta content provider
@@ -246,6 +247,19 @@
246247
watcher_services_tag: watcher_latest
247248
watcher_registry_url: "{{ content_provider_os_registry_url }}"
248249
cifmw_test_operator_tempest_image_tag: watcher_latest
250+
cifmw_extras:
251+
- "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/ci-framework'].
252+
src_dir }}/scenarios/centos-9/multinode-ci.yml"
253+
- "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/ci-framework'].
254+
src_dir }}/scenarios/centos-9/horizon.yml"
255+
- "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/watcher-operator'].
256+
src_dir }}/ci/scenarios/edpm.yml"
257+
- "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/watcher-operator'].
258+
src_dir }}/ci/tests/watcher-tempest.yml"
259+
- "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/watcher-operator'].
260+
src_dir }}/ci/tests/watcher-tempest-nfs.yml"
261+
- "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/watcher-operator'].
262+
src_dir }}/ci/scenarios/nfs.yml"
249263

250264
extra-vars:
251265
# Override zuul meta content provider provided content_provider_dlrn_md5_hash
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
- name: Kustomize ControlPlane for cinder over NFS
3+
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
4+
gather_facts: false
5+
vars:
6+
cifmw_controlplane_kustomizations_path: "{{ cifmw_basedir }}/artifacts/manifests/kustomizations/controlplane"
7+
_cinder_nfs_secret_files:
8+
- cinder-volume-nfs-secrets.yaml
9+
- cinder-volume-nfs-secrets-2.yaml
10+
tasks:
11+
- name: Ensure the kustomizations dir exists
12+
ansible.builtin.file:
13+
path: "{{ cifmw_controlplane_kustomizations_path }}"
14+
state: directory
15+
16+
- name: Create the cinder-backup OpenStackControlPlane configuration file
17+
ansible.builtin.copy:
18+
dest: "{{ cifmw_controlplane_kustomizations_path }}/cinder-backup.yaml"
19+
content: |
20+
apiVersion: core.openstack.org/v1beta1
21+
kind: OpenStackControlPlane
22+
metadata:
23+
name: openstack
24+
spec:
25+
cinder:
26+
template:
27+
cinderBackup:
28+
replicas: 1
29+
customServiceConfig: |
30+
[DEFAULT]
31+
backup_driver=cinder.backup.drivers.nfs.NFSBackupDriver
32+
backup_mount_options=nosharecache
33+
customServiceConfigSecrets:
34+
- cinder-backup-nfs-secrets
35+
networkAttachments:
36+
- storage
37+
38+
- name: Create the definition of the secrets for the cinder backup
39+
ansible.builtin.template:
40+
dest: "{{ cifmw_controlplane_kustomizations_path }}/cinder-backup-nfs-sercrets.yaml"
41+
src: "cinder-backup-nfs-secrets.yaml.j2"
42+
mode: '640'
43+
44+
- name: Create the definition of the secrets
45+
vars:
46+
share: "{{ cifmw_nfs_shares[indx] }}"
47+
name: "{{ filename | splitext | first }}"
48+
ansible.builtin.template:
49+
dest: "{{ cifmw_controlplane_kustomizations_path }}/{{ filename }}"
50+
src: "cinder-volume-nfs-secrets.yaml.j2"
51+
mode: '640'
52+
loop: "{{ _cinder_nfs_secret_files }}"
53+
loop_control:
54+
loop_var: filename
55+
index_var: indx
56+
57+
- name: Apply the secrets
58+
environment:
59+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
60+
PATH: "{{ cifmw_path }}"
61+
ansible.builtin.shell: |
62+
oc project {{ namespace }}
63+
oc apply -f {{ cifmw_controlplane_kustomizations_path }}/{{ item }}
64+
register: apply_result
65+
changed_when: ('stdout' in apply_result) and ('unchanged' not in apply_result.stdout)
66+
failed_when: ( apply_result.rc | int ) > 1
67+
loop: "{{ _cinder_nfs_secret_files + ['cinder-backup-nfs-sercrets.yaml'] }}"
68+
69+
- name: Create the nfs backend cinderVolume patch
70+
ansible.builtin.template:
71+
dest: "{{ cifmw_controlplane_kustomizations_path }}/nfs_backend.yaml"
72+
src: "nfs_backend.yaml.j2"
73+
mode: '640'
74+
75+
# FIXME: copy with inline content does not support templating, so this should be reworked
76+
- name: Create kustomization to really enable NFS shares as backends for cinder and cinder-backup
77+
ansible.builtin.copy:
78+
dest: "{{ cifmw_controlplane_kustomizations_path }}/90-cinder-nfs.yaml"
79+
content: |-
80+
apiVersion: kustomize.config.k8s.io/v1beta1
81+
kind: Kustomization
82+
resources:
83+
namespace: {{ namespace }}
84+
# FIXME: patch the IP address of the NFS share using a better way to identify the exact volume
85+
patches:
86+
- target:
87+
kind: OpenStackControlPlane
88+
name: .*
89+
patch: |-
90+
- op: replace
91+
path: /metadata/name
92+
value: openstack
93+
- target:
94+
kind: OpenStackControlPlane
95+
name: .*
96+
patch: |-
97+
- op: remove
98+
path: /metadata/namespace
99+
- path: {{ cifmw_controlplane_kustomizations_path + '/nfs_backend.yaml'}}
100+
- path: {{ cifmw_controlplane_kustomizations_path + '/cinder-backup.yaml' }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
labels:
6+
service: cinder
7+
component: cinder-backup
8+
name: cinder-backup-nfs-secrets
9+
type: Opaque
10+
stringData:
11+
nfs-secrets.conf: |
12+
[DEFAULT]
13+
backup_share = {{ cifmw_nfs_ip }}:{{ '/data/' + cifmw_nfs_shares[-1] }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
labels:
6+
service: cinder
7+
component: cinder-volume
8+
name: {{ name }}
9+
type: Opaque
10+
stringData:
11+
{{ name }}: |
12+
[nfs]
13+
nas_host={{ cifmw_nfs_ip }}
14+
nas_share_path={{ '/data/' + share }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Deploy a cinder NFS backend, with sensitive server settings (the nas_host
2+
# and nas_share_path) stored in the "cinder-volume-nfs-secrets" Secret.
3+
#
4+
# NOTE: Rather than using a shares-config file, the driver uses the nas_host
5+
# and nas_share_path parameters in the secrets file. For multiple shares,
6+
# configure a separate cinder-volume backend and secrets file for each share.
7+
8+
apiVersion: core.openstack.org/v1beta1
9+
kind: OpenStackControlPlane
10+
metadata:
11+
name: openstack
12+
spec:
13+
cinder:
14+
template:
15+
cinderVolumes:
16+
nfs:
17+
networkAttachments:
18+
- storage
19+
customServiceConfig: |
20+
[nfs]
21+
volume_backend_name=nfs
22+
volume_driver=cinder.volume.drivers.nfs.NfsDriver
23+
nfs_snapshot_support=true
24+
nas_secure_file_operations=false
25+
nas_secure_file_permissions=false
26+
customServiceConfigSecrets:
27+
- cinder-volume-nfs-secrets
28+
nfs-2:
29+
networkAttachments:
30+
- storage
31+
customServiceConfig: |
32+
[nfs]
33+
volume_backend_name=nfs
34+
volume_driver=cinder.volume.drivers.nfs.NfsDriver
35+
nfs_snapshot_support=true
36+
nas_secure_file_operations=false
37+
nas_secure_file_permissions=false
38+
customServiceConfigSecrets:
39+
- cinder-volume-nfs-secrets-2

ci/scenarios/nfs.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
watcher_repo: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/watcher-operator"
3+
cifmw_edpm_deploy_nfs: true
4+
cifmw_nfs_shares:
5+
- cinder_backend_1
6+
- cinder_backend_2
7+
- cinderbackup
8+
9+
cifmw_update_containers_cindervolumes:
10+
- nfs
11+
- nfs-2
12+
13+
# NOTE(jgilaber): we might want to merge this file into scenarios/edpm.yml,
14+
# depending on how many jobs will have cinder volumes enabled
15+
ci_framework_base_src_dir: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/ci-framework'].src_dir }}"
16+
nfs_kustomize_hook: "{{ watcher_repo }}/ci/playbooks/cinder-nfs-enable.yaml"
17+
post_deploy:
18+
- name: Download needed tools
19+
type: playbook
20+
inventory: "/home/zuul/src/github.com/openstack-k8s-operators/install_yamls/devsetup/hosts"
21+
source: "/home/zuul/src/github.com/openstack-k8s-operators/install_yamls/devsetup/download_tools.yaml"
22+
- name: Patch Openstack Prometheus to enable admin API
23+
type: playbook
24+
source: "{{ prometheus_admin_api_hook }}"
25+
- name: 81 Kustomize Openstack CR to enable a Generic NFS-based backend
26+
type: playbook
27+
source: "{{ nfs_kustomize_hook }}"
28+
- name: 82 Kustomize and update Control Plane
29+
type: playbook
30+
source: "{{ ci_framework_base_src_dir }}/hooks/playbooks/control_plane_kustomize_deploy.yml"

ci/tests/watcher-tempest-nfs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# get the tempest configuration from watcher-waster.yml, with the exception of
2+
# not skipping volume_migration tests
3+
cifmw_test_operator_tempest_exclude_list: |
4+
watcher_tempest_plugin.*client_functional.*
5+
watcher_tempest_plugin.tests.scenario.test_execute_strategies.TestExecuteStrategies.test_execute_storage_capacity_balance_strategy
6+
watcher_tempest_plugin.*\[.*\breal_load\b.*\].*

0 commit comments

Comments
 (0)