Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions ci/playbooks/inject-ssh-key.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

# Add lpiwowar's public SSH keys (fetched from GitHub) to every node of the
# job so that a Zuul autohold request can keep a failed node alive and it can
# be debugged over SSH, as demonstrated in [1].
#
# NOTE: this playbook must remain LAST in the job's pre-run list.
# create_lightspeed_secret.yml replaces authorized_keys with the job's
# automation keys only and would drop any key added before it.
#
# [1] https://github.com/openstack-k8s-operators/lightspeed-operator/pull/69
- name: Inject lpiwowar public SSH keys for autohold debugging
hosts: all
gather_facts: false
tasks:
- name: Fetch lpiwowar public SSH keys from GitHub
ansible.builtin.uri:
url: https://github.com/lpiwowar.keys
return_content: true
register: lpiwowar_pubkeys

- name: Add lpiwowar public SSH keys to authorized_keys
ansible.posix.authorized_key:
user: "{{ ansible_user }}"
key: "{{ lpiwowar_pubkeys.content }}"
state: present
36 changes: 36 additions & 0 deletions ci/playbooks/install-openstack-lightspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,42 @@
name: "{{ openstack_lightspeed_ansibletest_service_account }}"
namespace: "{{ cifmw_test_operator_namespace | default('openstack') }}"

- name: Authorize the test Pod to exec into the openstack-assistant Pod
when: openstack_assistant_enabled | default(false) | bool
kubernetes.core.k8s:
state: present
definition:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: lightspeed-tests-assistant-exec
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list"]
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["create", "get"]

- name: Bind the exec permissions to the test-operator ServiceAccount
when: openstack_assistant_enabled | default(false) | bool
kubernetes.core.k8s:
state: present
definition:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: lightspeed-tests-assistant-exec
namespace: "{{ cifmw_test_operator_namespace | default('openstack') }}"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: lightspeed-tests-assistant-exec
subjects:
- kind: ServiceAccount
name: "{{ openstack_lightspeed_ansibletest_service_account }}"
namespace: "{{ cifmw_test_operator_namespace | default('openstack') }}"

- name: Create test-operator dummy config ConfigMap
kubernetes.core.k8s:
state: present
Expand Down
20 changes: 16 additions & 4 deletions zuul.d/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
- name: openai_credentials
secret: lightspeed-openai-token
# Creates the token Secret in-cluster before the run (see playbook header).
pre-run: ci/playbooks/create_lightspeed_secret.yml
# The SSH key injection must stay last: create_lightspeed_secret.yml
# replaces authorized_keys with the automation keys only and would drop
# any key added before it.
pre-run:
- ci/playbooks/create_lightspeed_secret.yml
- ci/playbooks/inject-ssh-key.yml
# cleanup: true so Zuul still attempts the delete when the job is canceled.
post-run:
- name: ci/playbooks/cleanup_lightspeed_secret.yml
Expand All @@ -39,8 +44,10 @@
cifmw_test_operator_ansibletest_name: ansibletest
cifmw_test_operator_ansibletest_image: quay.io/podified-antelope-centos9/openstack-ansible-tests
cifmw_test_operator_ansibletest_image_tag: current-podified
cifmw_test_operator_ansibletest_ansible_git_repo: https://github.com/openstack-k8s-operators/lightspeed-tests
cifmw_test_operator_ansibletest_ansible_git_branch: ""
# TODO(lpiwowar): switch back to openstack-k8s-operators/lightspeed-tests
# (default branch) once feature/openstack-assistant-test merges upstream.
cifmw_test_operator_ansibletest_ansible_git_repo: https://github.com/lpiwowar/lightspeed-tests
cifmw_test_operator_ansibletest_ansible_git_branch: feature/openstack-assistant-test
cifmw_test_operator_ansibletest_ansible_playbook_path: playbooks/run_lightspeed_tests.yaml
cifmw_test_operator_ansibletest_ansible_inventory: |
localhost ansible_connection=local ansible_python_interpreter=python3
Expand Down Expand Up @@ -90,7 +97,7 @@
lightspeed_url: "https://lightspeed-app-server.{{ cifmw_openstack_lightspeed_namespace | default('openstack-lightspeed') }}.svc.cluster.local:8443"
lightspeed_timeout: 120
lightspeed_model: "provider-default-model/default-model"
pytest_args: "-v --tb=short --color=no -m 'not llm_dependent' -k 'integration or e2e'"
pytest_args: "-v --tb=short --color=no -m 'not llm_dependent' -k 'integration or e2e' --runxfail"
prometheus_url: "https://metric-storage-prometheus.{{ cifmw_openstack_namespace | default('openstack') }}.svc:9090"
prometheus_ca_cert_path: /var/run/secrets/prometheus/ca.crt
junit_xml_path: /var/lib/AnsibleTests/external_files/lightspeed-tests/junit.xml
Expand All @@ -106,6 +113,11 @@
- serviceAccountToken:
path: token
expirationSeconds: 3600
- configMap:
name: kube-root-ca.crt
items:
- key: ca.crt
path: ca.crt
- name: prometheus-ca
secret:
secretName: combined-ca-bundle
Expand Down
Loading