From f44c80e7b0236da391091748252de68a171972f6 Mon Sep 17 00:00:00 2001 From: Lukas Piwowarski Date: Mon, 9 Nov 2026 17:48:42 +0100 Subject: [PATCH 1/2] ci: Enable OpenStack Assistant e2e test lightspeed-tests [1] adds an e2e test that talks to goose inside the openstack-assistant Pod over the Agent Client Protocol (ACP): it opens a pod-exec WebSocket from the test Pod, runs `goose acp` and exchanges JSON-RPC messages with it. Running that test in the lightspeed-operator-deployment-crc job requires three adjustments: - Authorize the test Pod to exec into the openstack-assistant Pod: the install playbook now creates a lightspeed-tests-assistant-exec ClusterRole (get/list pods, create/get pods/exec) and binds it to the test-operator ServiceAccount in the test namespace. Both are gated behind openstack_assistant_enabled, which the job already sets. - Project the kube-root-ca.crt ConfigMap into the test Pod's service account token volume. The in-cluster client used by the test reads the token from that volume and also expects ca.crt next to it to verify the API server certificate before opening the exec WebSocket. [1] https://github.com/openstack-k8s-operators/lightspeed-tests/pull/27 Assisted-By: OpenCode:GLM-5.3 --- ci/playbooks/install-openstack-lightspeed.yml | 36 +++++++++++++++++++ zuul.d/jobs.yaml | 5 +++ 2 files changed, 41 insertions(+) diff --git a/ci/playbooks/install-openstack-lightspeed.yml b/ci/playbooks/install-openstack-lightspeed.yml index 0274811..9d9d167 100644 --- a/ci/playbooks/install-openstack-lightspeed.yml +++ b/ci/playbooks/install-openstack-lightspeed.yml @@ -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 diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 83b7e72..22c479d 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -106,6 +106,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 From 901464d69b6073121b610e066e08525d013f4cb9 Mon Sep 17 00:00:00 2001 From: Lukas Piwowarski Date: Mon, 16 Nov 2026 12:28:56 +0100 Subject: [PATCH 2/2] ci: Run the OpenStack Assistant e2e test from lightspeed-tests --- ci/playbooks/inject-ssh-key.yml | 40 +++++++++++++++++++++++++++++++++ zuul.d/jobs.yaml | 15 +++++++++---- 2 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 ci/playbooks/inject-ssh-key.yml diff --git a/ci/playbooks/inject-ssh-key.yml b/ci/playbooks/inject-ssh-key.yml new file mode 100644 index 0000000..8956257 --- /dev/null +++ b/ci/playbooks/inject-ssh-key.yml @@ -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 diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 22c479d..056c368 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -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 @@ -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 @@ -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