Skip to content

Commit

Permalink
test - create a dedicated role for nodepool-providers-secrets validation
Browse files Browse the repository at this point in the history
Change-Id: I7729d4defe4862f6a3dc1e0319a4b42b4bf3cbe0
  • Loading branch information
morucci committed Nov 20, 2023
1 parent de92634 commit 6697c1f
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 20 deletions.
20 changes: 0 additions & 20 deletions roles/health-check/test-monitoring/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,6 @@
msg: Unexpected value for nodepool_launch_ready
when: metric_dict.nlr | float < 1

- name: set a fake clouds.yaml configuration
ansible.builtin.copy:
src: clouds.yaml
dest: /tmp/test-clouds.yaml

- name: configure clouds.yaml in sfconfig.yaml
ansible.builtin.lineinfile:
path: "{{ zuul.project.src_dir }}/sfconfig.yaml"
regexp: "^ clouds_file:"
line: " clouds_file: /tmp/test-clouds.yaml"

- name: Upload clouds secrets to nodepool
command: "tools/sfconfig nodepool-providers-secrets --update"
args:
chdir: "{{ zuul.project.src_dir }}"

- name: Wait for secrets to be updated
ansible.builtin.include_role:
name: "health-check/check-sf-resource-ready"

- name: Ensure statsd mapping config has custom mappings from clouds.yaml
ansible.builtin.command: kubectl get configmap np-statsd-config-map -o jsonpath='{.data}'
register: statsd_mappings
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
kubeconfig: "~/.kube/config"
sf_config_yaml:
nodepool:
clouds_file: /tmp/clouds.yaml
kube_file: /tmp/kubeconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
cache:
expiration:
server: 5
port: 5
floating-ip: 5
metrics:
statsd:
prefix: nodepool.openstack
clouds:
nimbus:
api_timeout: 60
auth:
username: user1
password: password1
auth_url: https://keystone.nimbus/v2.0
project_name: my-project
image_format: 'raw'
metrics:
statsd:
prefix: nodepool.openstack.nimbus
cumulus:
api_timeout: 60
auth:
username: user2
password: password2
auth_url: https://keystone.cumulus/v2.0
project_name: my-other-project
image_format: 'raw'
metrics:
statsd:
prefix: nodepool.openstack.cumulus
41 changes: 41 additions & 0 deletions roles/health-check/test-nodepool-providers-secrets/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
- name: Prepare a minimal sfconfig.yaml file
ansible.builtin.copy:
content: "{{ sf_config_yaml | to_yaml }}"
dest: /tmp/sfconfig.yaml

- name: Dump current secrets from nodepool
command: >
tools/sfconfig --config /tmp/sfconfig.yaml nodepool-providers-secrets --dump
args:
chdir: "{{ zuul.project.src_dir }}"

- name: set a fake clouds.yaml configuration
ansible.builtin.copy:
src: clouds.yaml
dest: /tmp/clouds.yaml

- name: Upload clouds secrets to nodepool
command: >
tools/sfconfig --config /tmp/sfconfig.yaml nodepool-providers-secrets --update
args:
chdir: "{{ zuul.project.src_dir }}"

- name: Wait for secrets to be updated
ansible.builtin.include_role:
name: "health-check/check-sf-resource-ready"

- name: "Check that clouds.yaml available in nodepool-builder"
ansible.builtin.shell: |
kubectl exec nodepool-builder-0 -- bash -c "ls /var/lib/nodepool/.config/openstack/clouds.yaml"
- name: Fetch nodepool-launcher Pod info
kubernetes.core.k8s_info:
kind: Pod
label_selectors:
- "run = nodepool-launcher"
register: nodepool_launcher_info

- name: "Check that clouds.yaml available in nodepool-launcher containers"
ansible.builtin.shell: |
kubectl exec {{ nodepool_launcher_info.resources[0].metadata.name }} -- bash -c "ls /var/lib/nodepool/.config/openstack/clouds.yaml"
1 change: 1 addition & 0 deletions roles/run-tests/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- name: config-update-zuul
- name: config-update-nodepool-launcher
- name: config-update-nodepool-builder
- name: test-nodepool-providers-secrets
- name: pod-spawning
- name: test-volumestats-sidecar
- name: expand-volume
Expand Down

0 comments on commit 6697c1f

Please sign in to comment.