|
| 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 |
0 commit comments