Skip to content

Commit fb7bc49

Browse files
committed
[multiple] 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 fb7bc49

File tree

34 files changed

+86
-93
lines changed

34 files changed

+86
-93
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/apply_cinder_replication_kustomization.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
3131
PATH: "{{ cifmw_path }}"
3232
ansible.builtin.command:
33-
cmd: oc get openstackcontrolplane -n openstack -o yaml
33+
cmd: "oc get openstackcontrolplane -n {{ cifmw_openstack_namespace }} -o yaml"
3434
register: current_controlplane_config
3535

3636
- name: Parse existing Cinder backend configuration
@@ -58,7 +58,7 @@
5858
kind: OpenStackControlPlane
5959
metadata:
6060
name: controlplane
61-
namespace: openstack
61+
namespace: "{{ cifmw_openstack_namespace }}"
6262
spec:
6363
cinder:
6464
template:
@@ -70,4 +70,4 @@
7070
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
7171
PATH: "{{ cifmw_path }}"
7272
ansible.builtin.command:
73-
cmd: oc wait --for=condition=Ready openstackcontrolplane/controlplane -n openstack --timeout=1200s
73+
cmd: "oc wait --for=condition=Ready openstackcontrolplane/controlplane -n {{ cifmw_openstack_namespace }} --timeout=1200s"

hooks/playbooks/delete_all_pre_adoption_resources.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- name: Fetch cloud config to host
1515
kubernetes.core.k8s_cp:
1616
kubeconfig: "{{ cifmw_resource_delete_kubeconfig }}"
17-
namespace: openstack
17+
namespace: "{{ cifmw_openstack_namespace }}"
1818
pod: openstackclient
1919
remote_path: /home/cloud-admin/.config/openstack/
2020
local_path: "/home/zuul/.config/openstack/"

hooks/playbooks/dz_storage_post_deploy_az.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
PATH: "{{ cifmw_path | default(ansible_env.PATH) }}"
1212
ansible.builtin.command: >-
1313
oc rsh
14-
-n openstack
14+
-n "{{ cifmw_openstack_namespace }}"
1515
openstackclient
1616
openstack project show service -c id -f value
1717
register: service_project_result
@@ -26,7 +26,7 @@
2626
PATH: "{{ cifmw_path | default(ansible_env.PATH) }}"
2727
ansible.builtin.command: >-
2828
oc rsh
29-
-n openstack
29+
-n "{{ cifmw_openstack_namespace }}"
3030
openstackclient
3131
openstack volume type create --private
3232
--project "{{ service_project_id }}"
@@ -44,7 +44,7 @@
4444
PATH: "{{ cifmw_path | default(ansible_env.PATH) }}"
4545
ansible.builtin.command: >-
4646
oc rsh
47-
-n openstack
47+
-n "{{ cifmw_openstack_namespace }}"
4848
openstackclient
4949
openstack aggregate create {{ item }} --zone {{ item }}
5050
loop:
@@ -59,7 +59,7 @@
5959
PATH: "{{ cifmw_path | default(ansible_env.PATH) }}"
6060
ansible.builtin.command: >-
6161
oc rsh
62-
-n openstack
62+
-n "{{ cifmw_openstack_namespace }}"
6363
openstackclient
6464
openstack aggregate add host {{ item.az }} {{ item.host }}
6565
loop:

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/ipa-controlplane-config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
kind: Secret
6767
metadata:
6868
name: keystone-domains
69-
namespace: openstack
69+
namespace: "{{ cifmw_openstack_namespace }}"
7070
type: Opaque
7171
stringData: "{{ {keystone_conf_key: keystone_ldap_config_content} }}"
7272
vars:

hooks/playbooks/run_tofu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
- name: Fetch cloud congig to host
3030
kubernetes.core.k8s_cp:
3131
kubeconfig: "{{ cifmw_tofu_kubeconfig }}"
32-
namespace: openstack
32+
namespace: "{{ cifmw_openstack_namespace }}"
3333
pod: openstackclient
3434
remote_path: /home/cloud-admin/.config/openstack/
3535
local_path: "{{ ansible_user_dir }}/.config/openstack/"

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;

playbooks/06-deploy-architecture.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@
281281
PATH: "{{ cifmw_path }}"
282282
ansible.builtin.command: >-
283283
oc rsh
284-
-n openstack
284+
-n "{{ cifmw_openstack_namespace }}"
285285
nova-cell0-conductor-0
286286
nova-manage cell_v2 discover_hosts --verbose
287287

roles/ci_dcn_site/tasks/add_node.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
- name: Run Nova cell discovery for new DCN hosts
108108
kubernetes.core.k8s_exec:
109109
api_key: "{{ _auth_results.openshift_auth.api_key }}"
110-
namespace: openstack
110+
namespace: "{{ cifmw_openstack_namespace }}"
111111
pod: nova-cell0-conductor-0
112112
command: nova-manage cell_v2 discover_hosts --verbose
113113

0 commit comments

Comments
 (0)