Skip to content

Commit dd40bfe

Browse files
committed
[CI] Enable telemetry
Add enable-lightspeed-metrics.yml that enables metric storage in the OpenStack control plane. Mount the OpenStack CA bundle in the test pod and pass its path to the test framework so Prometheus requests can verify TLS certificates.
1 parent 152b839 commit dd40bfe

5 files changed

Lines changed: 107 additions & 2 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
- name: Enable OpenStack Lightspeed metrics collection
3+
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
4+
connection: local
5+
gather_facts: false
6+
vars:
7+
telemetry_namespace: "{{ cifmw_openstack_namespace | default(cifmw_install_yamls_defaults['NAMESPACE'] | default('openstack')) }}"
8+
lightspeed_namespace: "{{ cifmw_openstack_lightspeed_namespace | default('openstack-lightspeed') }}"
9+
lightspeed_metrics_target: "lightspeed-app-server.{{ lightspeed_namespace }}.svc:8443"
10+
environment:
11+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
12+
tasks:
13+
# Configure the owning control plane after Lightspeed is ready.
14+
# Lightspeed Service creation does not trigger MetricStorage reconciliation.
15+
# See docs/development.md#telemetry-metrics-discovery.
16+
- name: Enable metric storage in the OpenStack control plane
17+
kubernetes.core.k8s:
18+
state: present
19+
merge_type: merge
20+
definition:
21+
apiVersion: core.openstack.org/v1beta1
22+
kind: OpenStackControlPlane
23+
metadata:
24+
name: controlplane
25+
namespace: "{{ telemetry_namespace }}"
26+
spec:
27+
telemetry:
28+
enabled: true
29+
template:
30+
metricStorage:
31+
enabled: true
32+
openStackLightspeedNamespace: "{{ lightspeed_namespace }}"
33+
monitoringStack:
34+
alertingEnabled: false
35+
storage:
36+
# CI only needs metrics for the lifetime of this job.
37+
strategy: ephemeral
38+
39+
- name: Wait for metric storage to be ready
40+
kubernetes.core.k8s_info:
41+
api_version: telemetry.openstack.org/v1beta1
42+
kind: MetricStorage
43+
name: metric-storage
44+
namespace: "{{ telemetry_namespace }}"
45+
wait: true
46+
wait_condition:
47+
type: Ready
48+
status: "True"
49+
wait_timeout: 600
50+
register: metric_storage
51+
failed_when: metric_storage is failed or metric_storage.resources | default([]) | length == 0
52+
53+
- name: Wait for telemetry to discover the Lightspeed metrics service
54+
kubernetes.core.k8s_info:
55+
api_version: monitoring.rhobs/v1alpha1
56+
kind: ScrapeConfig
57+
name: telemetry-openstack-lightspeed
58+
namespace: "{{ telemetry_namespace }}"
59+
register: lightspeed_scrape_config
60+
until:
61+
- lightspeed_scrape_config.resources | default([]) | length == 1
62+
- >-
63+
lightspeed_metrics_target in (lightspeed_scrape_config.resources[0].spec.staticConfigs
64+
| map(attribute='targets') | flatten)
65+
retries: 30
66+
delay: 10

‎ci/playbooks/install-openstack-lightspeed.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@
483483
apiVersion: rbac.authorization.k8s.io/v1
484484
kind: ClusterRoleBinding
485485
metadata:
486-
name: "lightspeed-access-{{ cifmw_test_operator_namespace | default('openstack') }}"
486+
name: "lightspeed-tests-access-{{ cifmw_test_operator_namespace | default('openstack') }}"
487487
roleRef:
488488
apiGroup: rbac.authorization.k8s.io
489489
kind: ClusterRole

‎ci/vars-lightspeed.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ pre_tests_01_deploy_lightspeed_operator:
44
type: playbook
55
pre_tests_02_deploy_openstack_assistant:
66
source: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/lightspeed-operator'].src_dir }}/ci/playbooks/deploy-openstack-assistant.yml"
7+
8+
pre_tests_03_enable_lightspeed_metrics:
9+
source: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/lightspeed-operator'].src_dir }}/ci/playbooks/enable-lightspeed-metrics.yml"
710
type: playbook

‎docs/development.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,29 @@ cd ../..
2323
`PULL_SECRET` is the same pull secret described in the
2424
[installation guide](install_guide.md#access-to-registry-images).
2525

26+
## Telemetry metrics discovery
27+
28+
For new deployments collecting metrics through telemetry-operator, wait for
29+
`OpenStackLightspeed` to become `Ready` before enabling `MetricStorage` through
30+
the `OpenStackControlPlane`. The CRC CI job uses this order so that the
31+
`lightspeed-app-server` service exists when telemetry first discovers scrape
32+
targets.
33+
34+
Telemetry currently discovers Lightspeed during `MetricStorage` reconciliation,
35+
using `spec.openStackLightspeedNamespace` to locate its metrics service. The
36+
service watch does not handle Lightspeed service events or map them to
37+
`MetricStorage` resources in another namespace. If `MetricStorage` has already
38+
reconciled before Lightspeed is installed, creating the service alone does not
39+
trigger discovery. Another reconciliation, caused by an update to `MetricStorage`
40+
or another watched resource, can discover it later. Until then, the
41+
`telemetry-openstack-lightspeed` scrape configuration may be absent even when
42+
`MetricStorage` reports `Ready`.
43+
44+
A future improvement in telemetry-operator would be to watch Lightspeed metrics
45+
service events and reconcile the `MetricStorage` resources whose
46+
`spec.openStackLightspeedNamespace` matches the service's namespace. This would
47+
allow discovery regardless of installation order.
48+
2649
## Releasing to the community catalog
2750

2851
The **Propose community operator release** GitHub Actions workflow uses

‎zuul.d/jobs.yaml‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
- name: ci/playbooks/cleanup_lightspeed_secret.yml
2121
cleanup: true
2222
vars:
23+
# MetricStorage is managed by telemetry-operator and requires COO.
24+
cifmw_deploy_obs: true
2325
cifmw_extras:
2426
- '@scenarios/centos-9/multinode-ci.yml'
2527
- '@scenarios/centos-9/hci_ceph_backends.yml'
@@ -88,7 +90,9 @@
8890
lightspeed_url: "https://lightspeed-app-server.{{ cifmw_openstack_lightspeed_namespace | default('openstack-lightspeed') }}.svc.cluster.local:8443"
8991
lightspeed_timeout: 120
9092
lightspeed_model: "provider-default-model/default-model"
91-
pytest_args: "-v --tb=short --color=no -m 'not llm_dependent' -k integration"
93+
pytest_args: "-v --tb=short --color=no -m 'not llm_dependent' -k 'integration or e2e'"
94+
prometheus_url: "https://metric-storage-prometheus.{{ cifmw_openstack_namespace | default('openstack') }}.svc:9090"
95+
prometheus_ca_cert_path: /var/run/secrets/prometheus/ca.crt
9296
junit_xml_path: /var/lib/AnsibleTests/external_files/lightspeed-tests/junit.xml
9397
cifmw_test_operator_ansibletest_extra_mounts:
9498
- name: lightspeed
@@ -102,10 +106,19 @@
102106
- serviceAccountToken:
103107
path: token
104108
expirationSeconds: 3600
109+
- name: prometheus-ca
110+
secret:
111+
secretName: combined-ca-bundle
112+
items:
113+
- key: tls-ca-bundle.pem
114+
path: ca.crt
105115
mounts:
106116
- name: lightspeed-client-token
107117
mountPath: /var/run/secrets/kubernetes.io/serviceaccount
108118
readOnly: true
119+
- name: prometheus-ca
120+
mountPath: /var/run/secrets/prometheus
121+
readOnly: true
109122

110123
# Fake LLM only; real-provider credentials are a follow-up.
111124
cifmw_openstack_lightspeed_mock_enabled: true

0 commit comments

Comments
 (0)