From ba5957850e7aa370e80dcff95ba83a8f9ad12a65 Mon Sep 17 00:00:00 2001 From: Alex Figueiredo Date: Fri, 31 Oct 2025 17:15:08 -0300 Subject: [PATCH] [openstack-prometheus-exporter] OSH-I Chart Integration The prometheus-openstack-exporter Helm Chart [1] is currently available in the Openstack-Helm-Infra (OSH-I) repo but not yet integrated into the stx-openstack application. This change integrates the prometheus-openstack-exporter Helm Chart into the openstack-armada-app repos. For this, this change: - updates the OSH-I Debian package to include the chart - creates the Helm chart's plugin without applying any overrides - creates the FluxCD manifests by replicating the default configs available in the values.yaml - disables the Helm chart so it's not deployed by the app Test Plan: [PASS] build openstack packages and tarball [PASS] upload and apply the app in a vbox AIO-SX system [PASS] prometheus-openstack-exporter Helm chart included in starlingx chart repo (helm search repo starlingx) [PASS] prometheus-openstack-exporter Helm Release not installed (helm list -n openstack) [1]https://opendev.org/openstack/openstack-helm-infra/src/commit/05f2f45971abcf483189358d663e2b46c3fc2fe8/prometheus-openstack-exporter Story: 2011581 Task: 53013 Change-Id: I3ed19b00413e14ba56dd107fb85f85138d18c7e3 Signed-off-by: Alex Figueiredo --- openstack-helm-infra/debian/deb_folder/rules | 1 + .../k8sapp_openstack/common/constants.py | 2 + .../helm/prometheus_openstack_exporter.py | 34 +++ .../k8sapp_openstack/setup.cfg | 1 + .../files/metadata.yaml | 1 + .../manifests/kustomization.yaml | 1 + .../helmrelease.yaml | 41 +++ .../kustomization.yaml | 22 ++ ...s-openstack-exporter-static-overrides.yaml | 240 ++++++++++++++++++ ...s-openstack-exporter-system-overrides.yaml | 0 10 files changed, 343 insertions(+) create mode 100644 python3-k8sapp-openstack/k8sapp_openstack/k8sapp_openstack/helm/prometheus_openstack_exporter.py create mode 100644 stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/prometheus-openstack-exporter/helmrelease.yaml create mode 100644 stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/prometheus-openstack-exporter/kustomization.yaml create mode 100644 stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/prometheus-openstack-exporter/prometheus-openstack-exporter-static-overrides.yaml create mode 100644 stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/prometheus-openstack-exporter/prometheus-openstack-exporter-system-overrides.yaml diff --git a/openstack-helm-infra/debian/deb_folder/rules b/openstack-helm-infra/debian/deb_folder/rules index c0700f86a..ef4001d67 100755 --- a/openstack-helm-infra/debian/deb_folder/rules +++ b/openstack-helm-infra/debian/deb_folder/rules @@ -17,6 +17,7 @@ override_dh_auto_build: make openvswitch make rabbitmq make ceph-rgw + make prometheus-openstack-exporter override_dh_auto_install: # Install the chart tar files. diff --git a/python3-k8sapp-openstack/k8sapp_openstack/k8sapp_openstack/common/constants.py b/python3-k8sapp-openstack/k8sapp_openstack/k8sapp_openstack/common/constants.py index 628c0a3c6..5d2c11b90 100644 --- a/python3-k8sapp-openstack/k8sapp_openstack/k8sapp_openstack/common/constants.py +++ b/python3-k8sapp-openstack/k8sapp_openstack/k8sapp_openstack/common/constants.py @@ -40,6 +40,7 @@ HELM_CHART_NGINX_PORTS_CONTROL = "nginx-ports-control" HELM_CHART_NOVA = 'nova' HELM_CHART_NOVA_API_PROXY = 'nova-api-proxy' HELM_CHART_PCI_IRQ_AFFINITY_AGENT = 'pci-irq-affinity-agent' +HELM_CHART_PROMETHEUS_OPENSTACK_EXPORTER = 'prometheus-openstack-exporter' HELM_CHART_OPENVSWITCH = 'openvswitch' HELM_CHART_PLACEMENT = 'placement' HELM_CHART_RABBITMQ = 'rabbitmq' @@ -72,6 +73,7 @@ FLUXCD_HELMRELEASE_NGINX_PORTS_CONTROL = "nginx-ports-control" FLUXCD_HELMRELEASE_NOVA = 'nova' FLUXCD_HELMRELEASE_NOVA_API_PROXY = 'nova-api-proxy' FLUXCD_HELMRELEASE_PCI_IRQ_AFFINITY_AGENT = 'pci-irq-affinity-agent' +FLUXCD_HELMRELEASE_PROMETHEUS_OPENSTACK_EXPORTER = 'prometheus-openstack-exporter' FLUXCD_HELMRELEASE_OPENVSWITCH = 'openvswitch' FLUXCD_HELMRELEASE_PLACEMENT = 'placement' FLUXCD_HELMRELEASE_RABBITMQ = 'rabbitmq' diff --git a/python3-k8sapp-openstack/k8sapp_openstack/k8sapp_openstack/helm/prometheus_openstack_exporter.py b/python3-k8sapp-openstack/k8sapp_openstack/k8sapp_openstack/helm/prometheus_openstack_exporter.py new file mode 100644 index 000000000..c22bf86e6 --- /dev/null +++ b/python3-k8sapp-openstack/k8sapp_openstack/k8sapp_openstack/helm/prometheus_openstack_exporter.py @@ -0,0 +1,34 @@ +# +# Copyright (c) 2025 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +from sysinv.common import exception +from sysinv.helm import common + +from k8sapp_openstack.common import constants as app_constants +from k8sapp_openstack.helm import openstack + + +class PrometheusOpenstackExporterHelm(openstack.OpenstackBaseHelm): + """Class to encapsulate helm operations for the Openstack Exporter chart""" + + CHART = app_constants.HELM_CHART_PROMETHEUS_OPENSTACK_EXPORTER + HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_PROMETHEUS_OPENSTACK_EXPORTER + + def get_overrides(self, namespace=None): + + overrides = { + common.HELM_NS_OPENSTACK: { + # TODO: add helm overrides + } + } + + if namespace in self.SUPPORTED_NAMESPACES: + return overrides[namespace] + elif namespace: + raise exception.InvalidHelmNamespace(chart=self.CHART, + namespace=namespace) + else: + return overrides diff --git a/python3-k8sapp-openstack/k8sapp_openstack/setup.cfg b/python3-k8sapp-openstack/k8sapp_openstack/setup.cfg index 0cd6f4b71..293a3cb06 100644 --- a/python3-k8sapp-openstack/k8sapp_openstack/setup.cfg +++ b/python3-k8sapp-openstack/k8sapp_openstack/setup.cfg @@ -62,6 +62,7 @@ systemconfig.helm_plugins.openstack = 027_dcdbsync = k8sapp_openstack.helm.dcdbsync:DcdbsyncHelm 028_pci-irq-affinity-agent = k8sapp_openstack.helm.pci_irq_affinity_agent:PciIrqAffinityAgentHelm 029_clients = k8sapp_openstack.helm.clients:ClientsHelm + 030_prometheus-openstack-exporter = k8sapp_openstack.helm.prometheus_openstack_exporter:PrometheusOpenstackExporterHelm systemconfig.fluxcd.kustomize_ops = openstack = k8sapp_openstack.kustomize.kustomize_openstack:OpenstackFluxCDKustomizeOperator diff --git a/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/files/metadata.yaml b/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/files/metadata.yaml index 022d6a035..9cec949ea 100644 --- a/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/files/metadata.yaml +++ b/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/files/metadata.yaml @@ -11,6 +11,7 @@ disabled_charts: - gnocchi - ironic - keystone-api-proxy +- prometheus-openstack-exporter upgrades: auto_update: true diff --git a/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/kustomization.yaml b/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/kustomization.yaml index d99ee03ea..4ec1b1872 100644 --- a/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/kustomization.yaml +++ b/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/kustomization.yaml @@ -38,4 +38,5 @@ resources: - ceilometer - gnocchi - clients + - prometheus-openstack-exporter ... diff --git a/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/prometheus-openstack-exporter/helmrelease.yaml b/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/prometheus-openstack-exporter/helmrelease.yaml new file mode 100644 index 000000000..93b72d50e --- /dev/null +++ b/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/prometheus-openstack-exporter/helmrelease.yaml @@ -0,0 +1,41 @@ +# +# Copyright (c) 2025 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +--- +apiVersion: "helm.toolkit.fluxcd.io/v2" +kind: HelmRelease +metadata: + name: prometheus-openstack-exporter + labels: + chart_group: prometheus-openstack-exporter +spec: + releaseName: osh-prometheus-openstack-exporter + chart: + spec: + chart: prometheus-openstack-exporter + version: 0.1.9 + sourceRef: + kind: HelmRepository + name: starlingx + interval: 1m + timeout: 30m + test: + enable: false + install: + disableHooks: false + upgrade: + disableHooks: false + dependsOn: + - name: keystone + namespace: openstack + valuesFrom: + - kind: Secret + name: prometheus-openstack-exporter-static-overrides + valuesKey: prometheus-openstack-exporter-static-overrides.yaml + - kind: Secret + name: prometheus-openstack-exporter-system-overrides + valuesKey: prometheus-openstack-exporter-system-overrides.yaml +... diff --git a/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/prometheus-openstack-exporter/kustomization.yaml b/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/prometheus-openstack-exporter/kustomization.yaml new file mode 100644 index 000000000..9ee4f0cf6 --- /dev/null +++ b/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/prometheus-openstack-exporter/kustomization.yaml @@ -0,0 +1,22 @@ +# +# Copyright (c) 2025 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +--- +namespace: openstack +commonLabels: + chart_group: prometheus-openstack-exporter +resources: + - helmrelease.yaml +secretGenerator: + - name: prometheus-openstack-exporter-static-overrides + files: + - prometheus-openstack-exporter-static-overrides.yaml + - name: prometheus-openstack-exporter-system-overrides + files: + - prometheus-openstack-exporter-system-overrides.yaml +generatorOptions: + disableNameSuffixHash: true +... diff --git a/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/prometheus-openstack-exporter/prometheus-openstack-exporter-static-overrides.yaml b/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/prometheus-openstack-exporter/prometheus-openstack-exporter-static-overrides.yaml new file mode 100644 index 000000000..b90218c2c --- /dev/null +++ b/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/prometheus-openstack-exporter/prometheus-openstack-exporter-static-overrides.yaml @@ -0,0 +1,240 @@ +# +# Copyright (c) 2023-2025 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +--- +images: + tags: + prometheus_openstack_exporter: ghcr.io/openstack-exporter/openstack-exporter:1.7.0 + dep_check: quay.io/airshipit/kubernetes-entrypoint:v1.0.0 + image_repo_sync: null + ks_user: docker.io/starlingx/stx-heat:master-debian-stable-latest + pull_policy: IfNotPresent + local_registry: + active: false + exclude: + - dep_check + - image_repo_sync + +labels: + isApplication: false + openstack_exporter: + node_selector_key: openstack-control-plane + node_selector_value: enabled + job: + node_selector_key: openstack-control-plane + node_selector_value: enabled + +pod: + security_context: + exporter: + pod: + runAsUser: 65534 + container: + openstack_metrics_exporter: + readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + ks_user: + pod: + runAsUser: 65534 + container: + prometheus_openstack_exporter_ks_user: + readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + affinity: + anti: + type: + default: requiredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname + mounts: + prometheus_openstack_exporter: + prometheus_openstack_exporter: + init_container: null + replicas: + prometheus_openstack_exporter: 1 + lifecycle: + upgrades: + deployments: + revision_history: 3 + pod_replacement_strategy: RollingUpdate + rolling_update: + max_unavailable: 1 + max_surge: 3 + termination_grace_period: + prometheus_openstack_exporter: + timeout: 30 + resources: + enabled: false + prometheus_openstack_exporter: + requests: + memory: "128Mi" + cpu: "100m" + limits: + memory: "1024Mi" + cpu: "2000m" + jobs: + image_repo_sync: + requests: + memory: "128Mi" + cpu: "100m" + limits: + memory: "1024Mi" + cpu: "2000m" + ks_user: + requests: + memory: "128Mi" + cpu: "100m" + limits: + memory: "1024Mi" + cpu: "2000m" +dependencies: + dynamic: + common: + local_image_registry: + jobs: + - prometheus-openstack-exporter-image-repo-sync + services: + - endpoint: node + service: local_image_registry + static: + image_repo_sync: + services: + - endpoint: internal + service: local_image_registry + ks_user: + services: + - endpoint: internal + service: identity + prometheus_openstack_exporter: + jobs: + - prometheus-openstack-exporter-ks-user + services: + - endpoint: internal + service: identity + +conf: + prometheus_openstack_exporter: + OS_POLLING_INTERVAL: 30 + TIMEOUT_SECONDS: 20 + OS_RETRIES: 1 + +secrets: + identity: + admin: prometheus-openstack-exporter-keystone-admin + user: prometheus-openstack-exporter-keystone-user + oci_image_registry: + prometheus-openstack-exporter: prometheus-openstack-exporter-oci-image-registry-key + tls: + identity: + api: + # This name should be same as in keystone. Keystone + # secret will be used in these charts + # + internal: keystone-tls-api + + +endpoints: + cluster_domain_suffix: cluster.local + local_image_registry: + name: docker-registry + namespace: docker-registry + hosts: + default: localhost + internal: docker-registry + node: localhost + host_fqdn_override: + default: null + port: + registry: + node: 5000 + oci_image_registry: + name: oci-image-registry + namespace: oci-image-registry + auth: + enabled: false + prometheus-openstack-exporter: + username: prometheus-openstack-exporter + password: password + hosts: + default: localhost + host_fqdn_override: + default: null + port: + registry: + default: null + prometheus_openstack_exporter: + namespace: openstack + hosts: + default: openstack-metrics + host_fqdn_override: + default: null + path: + default: null + scheme: + default: 'http' + port: + exporter: + default: 9103 + identity: + name: keystone + auth: + admin: + region_name: RegionOne + username: admin + password: password + project_name: admin + user_domain_name: default + project_domain_name: default + user: + role: admin + region_name: RegionOne + username: prometheus-openstack-exporter + password: password + project_name: service + user_domain_name: default + project_domain_name: default + hosts: + default: keystone + internal: keystone-api + host_fqdn_override: + default: null + path: + default: /v3 + scheme: + default: 'http' + port: + api: + default: 80 + internal: 5000 + +monitoring: + prometheus: + enabled: true + openstack_exporter: + scrape: true + +network: + openstack_metrics_exporter: + port: 9103 + +network_policy: + prometheus-openstack-exporter: + ingress: + - {} + egress: + - {} + +manifests: + certificates: false + configmap_bin: true + deployment: true + job_image_repo_sync: true + job_ks_user: true + network_policy: false + secret_keystone: true + secret_registry: true + service: true +... diff --git a/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/prometheus-openstack-exporter/prometheus-openstack-exporter-system-overrides.yaml b/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/manifests/prometheus-openstack-exporter/prometheus-openstack-exporter-system-overrides.yaml new file mode 100644 index 000000000..e69de29bb