Skip to content

Commit e81f770

Browse files
committed
Consolidate openstack ns var: cifmw_openstack_namespace
There are multiple variables related to openstack namespace in OCP. This commit tries to consolidate them all with a single variable defined in group_vars. At some places, ns var were being read from cifmw_install_yamls_defaults, thus it is being used as the value for cifmw_openstack_namespace var in group_vars along with default value of openstack. Signed-off-by: Amartya Sinha <amsinha@redhat.com>
1 parent 14b37c7 commit e81f770

File tree

8 files changed

+21
-23
lines changed

8 files changed

+21
-23
lines changed

group_vars/all.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ cifmw_installyamls_repos_relative: src/github.com/openstack-k8s-operators/instal
1010
cifmw_installyamls_repos: "{{ ansible_user_dir }}/{{ cifmw_installyamls_repos_relative }}"
1111
cifmw_architecture_repo_relative: src/github.com/openstack-k8s-operators/architecture
1212
cifmw_architecture_repo: "{{ ansible_user_dir }}/{{ cifmw_architecture_repo_relative }}"
13+
14+
cifmw_openstack_namespace: "{{ cifmw_install_yamls_defaults['NAMESPACE'] | default('openstack') }}"

hooks/playbooks/dz_storage_pre_test_images.yaml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@
88
cirros_version: "0.6.2"
99
cirros_image_name: "cirros-{{ cirros_version }}-x86_64-disk.img"
1010
cirros_download_url: "https://github.com/cirros-dev/cirros/releases/download/{{ cirros_version }}/{{ cirros_image_name }}"
11-
openstack_namespace: "{{ cifmw_openstack_namespace | default('openstack') }}"
1211
tasks:
1312
- name: Check if cirros image already exists
1413
environment:
1514
KUBECONFIG: "{{ cifmw_openshift_kubeconfig | default('/home/' + ansible_user | default('zuul') + '/.kube/config') }}"
1615
PATH: "{{ cifmw_path | default(ansible_env.PATH) }}"
1716
ansible.builtin.command: >-
1817
oc rsh
19-
-n {{ openstack_namespace }}
18+
-n {{ cifmw_openstack_namespace }}
2019
openstackclient
2120
openstack image show {{ cirros_image_name }}
2221
register: _image_exists
@@ -31,7 +30,7 @@
3130
PATH: "{{ cifmw_path | default(ansible_env.PATH) }}"
3231
ansible.builtin.command: >-
3332
oc rsh
34-
-n {{ openstack_namespace }}
33+
-n {{ cifmw_openstack_namespace }}
3534
openstackclient
3635
openstack endpoint list --service keystone --interface public -f value -c URL
3736
register: keystone_url
@@ -41,7 +40,7 @@
4140
KUBECONFIG: "{{ cifmw_openshift_kubeconfig | default('/home/' + ansible_user | default('zuul') + '/.kube/config') }}"
4241
PATH: "{{ cifmw_path | default(ansible_env.PATH) }}"
4342
ansible.builtin.command: >-
44-
oc get secret osp-secret -n {{ openstack_namespace }} -o jsonpath='{.data.AdminPassword}'
43+
oc get secret osp-secret -n {{ cifmw_openstack_namespace }} -o jsonpath='{.data.AdminPassword}'
4544
register: admin_password_b64
4645

4746
- name: Decode admin password
@@ -61,15 +60,15 @@
6160
ansible.builtin.command: >-
6261
oc cp
6362
"/tmp/{{ cirros_image_name }}"
64-
"{{ openstack_namespace }}/openstackclient:/home/cloud-admin/{{ cirros_image_name }}"
63+
"{{ cifmw_openstack_namespace }}/openstackclient:/home/cloud-admin/{{ cirros_image_name }}"
6564
6665
- name: Create cirros image in default glance store (az0)
6766
environment:
6867
KUBECONFIG: "{{ cifmw_openshift_kubeconfig | default('/home/' + ansible_user | default('zuul') + '/.kube/config') }}"
6968
PATH: "{{ cifmw_path | default(ansible_env.PATH) }}"
7069
ansible.builtin.command: >-
7170
oc rsh
72-
-n {{ openstack_namespace }}
71+
-n {{ cifmw_openstack_namespace }}
7372
openstackclient
7473
openstack image create
7574
--disk-format qcow2
@@ -85,7 +84,7 @@
8584
PATH: "{{ cifmw_path | default(ansible_env.PATH) }}"
8685
ansible.builtin.command: >-
8786
oc rsh
88-
-n {{ openstack_namespace }}
87+
-n {{ cifmw_openstack_namespace }}
8988
openstackclient
9089
openstack image show {{ cirros_image_name }} -f value -c status
9190
register: image_status
@@ -99,7 +98,7 @@
9998
PATH: "{{ cifmw_path | default(ansible_env.PATH) }}"
10099
ansible.builtin.command: >-
101100
oc rsh
102-
-n {{ openstack_namespace }}
101+
-n {{ cifmw_openstack_namespace }}
103102
openstackclient
104103
openstack image show {{ cirros_image_name }} -f value -c id
105104
register: image_id
@@ -110,7 +109,7 @@
110109
PATH: "{{ cifmw_path | default(ansible_env.PATH) }}"
111110
ansible.builtin.command: >-
112111
oc rsh
113-
-n {{ openstack_namespace }}
112+
-n {{ cifmw_openstack_namespace }}
114113
openstackclient
115114
glance --os-auth-url {{ keystone_url.stdout | trim }}
116115
--os-project-name admin
@@ -128,7 +127,7 @@
128127
PATH: "{{ cifmw_path | default(ansible_env.PATH) }}"
129128
ansible.builtin.command: >-
130129
oc rsh
131-
-n {{ openstack_namespace }}
130+
-n {{ cifmw_openstack_namespace }}
132131
openstackclient
133132
openstack image show {{ image_id.stdout | trim }} -c properties -f value
134133
register: image_stores

hooks/playbooks/validate_podified_deployment.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
99
PATH: "{{ cifmw_path }}"
1010
ansible.builtin.shell: |
11-
oc get pods -n {{ openstack_namespace }} --selector service=nova-api -o jsonpath={.items[*].status.phase}
11+
oc get pods -n {{ cifmw_openstack_namespace }} --selector service=nova-api -o jsonpath={.items[*].status.phase}
1212
register: nova_service
1313
until: nova_service.stdout == "Running"
1414
changed_when: false
@@ -22,5 +22,5 @@
2222
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
2323
PATH: "{{ cifmw_path }}"
2424
ansible.builtin.shell: |
25-
oc rsh -n {{ openstack_namespace }} openstackclient openstack compute service list;
26-
oc rsh -n {{ openstack_namespace }} openstackclient openstack network agent list;
25+
oc rsh -n {{ cifmw_openstack_namespace }} openstackclient openstack compute service list;
26+
oc rsh -n {{ cifmw_openstack_namespace }} openstackclient openstack network agent list;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
openstack_namespace: openstack
2+
cifmw_openstack_namespace: openstack

roles/cifmw_setup/tasks/deploy_architecture.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@
258258
PATH: "{{ cifmw_path }}"
259259
ansible.builtin.command: >-
260260
oc rsh
261-
-n {{ openstack_namespace }}
261+
-n {{ cifmw_openstack_namespace }}
262262
nova-cell0-conductor-0
263263
nova-manage cell_v2 discover_hosts --verbose
264264

roles/shiftstack/molecule/default/cleanup.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
vars:
2020
cifmw_path: "{{ ansible_user_dir }}/.crc/bin:{{ ansible_user_dir }}/.crc/bin/oc:{{ ansible_user_dir }}/bin:{{ ansible_env.PATH }}"
2121
cifmw_openshift_kubeconfig: "{{ ansible_user_dir }}/.crc/machines/crc/kubeconfig"
22-
openstack_namespace_name: openstack
2322
tasks:
2423
- name: Include the shiftstack role and run the cleanup
2524
ansible.builtin.include_role:
@@ -34,4 +33,4 @@
3433
apiVersion: v1
3534
kind: Namespace
3635
metadata:
37-
name: "{{ openstack_namespace_name }}"
36+
name: "{{ cifmw_openstack_namespace }}"

roles/shiftstack/molecule/default/prepare.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
vars:
2121
cifmw_path: "{{ ansible_user_dir }}/.crc/bin:{{ ansible_user_dir }}/.crc/bin/oc:{{ ansible_user_dir }}/bin:{{ ansible_env.PATH }}"
2222
cifmw_openshift_kubeconfig: "{{ ansible_user_dir }}/.crc/machines/crc/kubeconfig"
23-
openstack_namespace_name: openstack
2423
openstack_config_name: openstack-config
2524
openstack_config_secret_name: openstack-config-secret
2625
openstack_root_ca_secret_name: rootca-public
@@ -40,7 +39,7 @@
4039
apiVersion: v1
4140
kind: Namespace
4241
metadata:
43-
name: "{{ openstack_namespace_name }}"
42+
name: "{{ cifmw_openstack_namespace }}"
4443

4544
- name: Create a dummy configmap
4645
kubernetes.core.k8s:
@@ -51,7 +50,7 @@
5150
kind: ConfigMap
5251
metadata:
5352
name: "{{ openstack_config_name }}"
54-
namespace: "{{ openstack_namespace_name }}"
53+
namespace: "{{ cifmw_openstack_namespace }}"
5554
data:
5655
key1: dummy1
5756
key2: dummy2
@@ -65,7 +64,7 @@
6564
kind: Secret
6665
metadata:
6766
name: "{{ openstack_config_secret_name }}"
68-
namespace: "{{ openstack_namespace_name }}"
67+
namespace: "{{ cifmw_openstack_namespace }}"
6968
type: Opaque
7069
data:
7170
secure.yaml: ZHVtbXkK # Base64 encoded value of "dummy"
@@ -79,7 +78,7 @@
7978
kind: Secret
8079
metadata:
8180
name: "{{ openstack_root_ca_secret_name }}"
82-
namespace: "{{ openstack_namespace_name }}"
81+
namespace: "{{ cifmw_openstack_namespace }}"
8382
type: Opaque
8483
data:
8584
ca.crt: ZHVtbXkK # Base64 encoded value of "dummy"

scenarios/centos-9/edpm_ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,3 @@ post_ctlplane_deploy:
4141
podified_validation: "{{ podified_validation | default (false) | bool }}"
4242
cifmw_openshift_kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
4343
cifmw_path: "{{ cifmw_path }}"
44-
openstack_namespace: "{{ cifmw_install_yamls_defaults['NAMESPACE'] }}"

0 commit comments

Comments
 (0)