Skip to content

Commit 00943b0

Browse files
eshulman2openshift-merge-bot[bot]
authored andcommitted
[shiftstack] Support passing extra vars into shiftstackclient pod
Add support for injecting environment-specific variables into the shiftstackclient pod via a ConfigMap volume mount. When cifmw_shiftstack_extra_vars is set, the role creates a ConfigMap with the variables as a YAML file, mounts it in the pod, and passes it to ansible-navigator with -e @path/to/extra-vars.yaml. This enables the telco/NFV verification job to keep environment- specific configuration (network names, flavors, CIDRs) in ci-framework-jobs while the generic job definition stays in shiftstack-qa. Signed-off-by: Ella Shulman <eshulman@redhat.com> Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f786a36 commit 00943b0

4 files changed

Lines changed: 30 additions & 0 deletions

File tree

roles/shiftstack/defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,6 @@ cifmw_shiftstack_storage_access_mode:
4848
- ReadWriteOnce
4949
- ReadWriteMany
5050
- ReadOnlyMany
51+
cifmw_shiftstack_extra_vars: {}
52+
cifmw_shiftstack_extra_vars_configmap_name: "shiftstack-extra-vars"
53+
cifmw_shiftstack_extra_vars_mount_path: "/home/cloud-admin/extra-vars"

roles/shiftstack/tasks/deploy_shiftstackclient_pod.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,21 @@
4848
src: "{{ (cifmw_shiftstack_manifests_dir, cifmw_shiftstack_client_pvc_manifest) | path_join }}"
4949
proxy: "{{ cifmw_shiftstack_proxy | default(omit) }}"
5050

51+
- name: Create ConfigMap with extra vars for the shiftstackclient pod
52+
when: cifmw_shiftstack_extra_vars | length > 0
53+
kubernetes.core.k8s:
54+
state: present
55+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
56+
definition:
57+
apiVersion: v1
58+
kind: ConfigMap
59+
metadata:
60+
name: "{{ cifmw_shiftstack_extra_vars_configmap_name }}"
61+
namespace: "{{ cifmw_shiftstack_client_pod_namespace }}"
62+
data:
63+
extra-vars.yaml: "{{ cifmw_shiftstack_extra_vars | to_nice_yaml }}"
64+
proxy: "{{ cifmw_shiftstack_proxy | default(omit) }}"
65+
5166
- name: Render the pod manifest from a template
5267
ansible.builtin.template:
5368
src: "templates/shiftstackclient_pod.yml.j2"

roles/shiftstack/tasks/test_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
cd shiftstack-qa &&
3636
ansible-navigator run playbooks/{{ cifmw_shiftstack_run_playbook }}
3737
-e @jobs_definitions/{{ testconfig }}
38+
{% if cifmw_shiftstack_extra_vars | length > 0 %}-e @{{ cifmw_shiftstack_extra_vars_mount_path }}/extra-vars.yaml{% endif %}
3839
-e ocp_cluster_name={{ cifmw_shiftstack_cluster_name }}
3940
-e user_cloud={{ cifmw_shiftstack_project_name }}
4041
-e hypervisor={{ cifmw_shiftstack_hypervisor }}

roles/shiftstack/templates/shiftstackclient_pod.yml.j2

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ spec:
4343
- name: {{ cifmw_shiftstack_client_incluster_secret_name }}-volume
4444
mountPath: {{ cifmw_shiftstack_shiftstackclient_incluster_kubeconfig_dir }}
4545
readOnly: true
46+
{% if cifmw_shiftstack_extra_vars | length > 0 %}
47+
- name: extra-vars
48+
mountPath: {{ cifmw_shiftstack_extra_vars_mount_path }}
49+
readOnly: true
50+
{% endif %}
4651
dnsPolicy: ClusterFirst
4752
enableServiceLinks: true
4853
preemptionPolicy: PreemptLowerPriority
@@ -79,3 +84,9 @@ spec:
7984
- name: installation-volume
8085
persistentVolumeClaim:
8186
claimName: {{ cifmw_shiftstack_client_pod_name }}-pvc
87+
{% if cifmw_shiftstack_extra_vars | length > 0 %}
88+
- name: extra-vars
89+
configMap:
90+
defaultMode: 420
91+
name: {{ cifmw_shiftstack_extra_vars_configmap_name }}
92+
{% endif %}

0 commit comments

Comments
 (0)