From 5f97d981511d8bb91457e2cfd48ea55b12711f37 Mon Sep 17 00:00:00 2001 From: phillip-toohill Date: Thu, 15 Feb 2024 12:05:11 -0600 Subject: [PATCH] Updating workflow for openstack-exporter --- .../workflows/helm-openstack-exporter.yaml | 55 +++++++++++++++++++ .../openstack-exporter-helm-overrides.yaml | 3 +- .../openstack-exporter/aio/kustomization.yaml | 14 +++++ .../base/hpa-openstack-exporter.yaml | 19 +++++++ .../base/kustomization.yaml | 4 ++ 5 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/helm-openstack-exporter.yaml create mode 100644 kustomize/monitoring/openstack-exporter/aio/kustomization.yaml create mode 100644 kustomize/monitoring/openstack-exporter/base/hpa-openstack-exporter.yaml create mode 100644 kustomize/monitoring/openstack-exporter/base/kustomization.yaml diff --git a/.github/workflows/helm-openstack-exporter.yaml b/.github/workflows/helm-openstack-exporter.yaml new file mode 100644 index 00000000..a7b542c6 --- /dev/null +++ b/.github/workflows/helm-openstack-exporter.yaml @@ -0,0 +1,55 @@ +name: Helm GitHub Actions for octavia + +on: + pull_request: + paths: + - helm-configs/monitoring/openstack-exporter/** + - kustomize/monitoring/openstack-exporter/** + - .github/workflows/helm-openstack-exporter.yaml +jobs: + helm: + strategy: + matrix: + overlays: + - base + - aio + name: Helm + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: azure/setup-helm@v3 + with: + version: latest + token: "${{ secrets.GITHUB_TOKEN }}" + id: helm + - name: Kubectl Install + working-directory: /usr/local/bin/ + run: | + if [ ! -f /usr/local/bin/kubectl ]; then + curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + chmod +x ./kubectl + fi + - name: Pull OSH submodules + run: | + git submodule update --init submodules/openstack-helm + git submodule update --init submodules/openstack-helm-infra + - name: Make OSH submodule + run: | + cd submodules/openstack-helm-infra + make prometheus-openstack-exporter + - name: Run Helm Template + run: | + cd submodules/openstack-helm + ${{ steps.helm.outputs.helm-path }} template prometheus-openstack-exporter ./prometheus-openstack-exporter \ + --namespace=openstack \ + --wait \ + --timeout 120m \ + -f ${{ github.workspace }}helm-configs/monitoring/openstack-exporter/openstack-exporter-helm-overrides.yaml \ + --post-renderer ${{ github.workspace }}/kustomize/kustomize.sh \ + --post-renderer-args monitoring/prometheus-openstack-exporter/${{ matrix.overlays }} > /tmp/rendered.yaml + - name: Return helm Build + uses: actions/upload-artifact@v2 + with: + name: helm-openstack-exporter-artifact-${{ matrix.overlays }} + path: /tmp/rendered.yaml diff --git a/helm-configs/monitoring/openstack-exporter/openstack-exporter-helm-overrides.yaml b/helm-configs/monitoring/openstack-exporter/openstack-exporter-helm-overrides.yaml index 3ed2e502..97f8ea36 100644 --- a/helm-configs/monitoring/openstack-exporter/openstack-exporter-helm-overrides.yaml +++ b/helm-configs/monitoring/openstack-exporter/openstack-exporter-helm-overrides.yaml @@ -227,4 +227,5 @@ manifests: network_policy: false secret_keystone: true secret_registry: true - service: true \ No newline at end of file + service: true + diff --git a/kustomize/monitoring/openstack-exporter/aio/kustomization.yaml b/kustomize/monitoring/openstack-exporter/aio/kustomization.yaml new file mode 100644 index 00000000..1b804cba --- /dev/null +++ b/kustomize/monitoring/openstack-exporter/aio/kustomization.yaml @@ -0,0 +1,14 @@ +bases: + - ../base + +patches: + - target: + kind: HorizontalPodAutoscaler + name: prometheus-openstack-exporter + patch: |- + - op: replace + path: /spec/minReplicas + value: 1 + - op: replace + path: /spec/maxReplicas + value: 1 diff --git a/kustomize/monitoring/openstack-exporter/base/hpa-openstack-exporter.yaml b/kustomize/monitoring/openstack-exporter/base/hpa-openstack-exporter.yaml new file mode 100644 index 00000000..dcaaf8db --- /dev/null +++ b/kustomize/monitoring/openstack-exporter/base/hpa-openstack-exporter.yaml @@ -0,0 +1,19 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: prometheus-openstack-exporter + namespace: openstack +spec: + maxReplicas: 3 + minReplicas: 1 + metrics: + - resource: + name: cpu + target: + averageUtilization: 50 + type: Utilization + type: Resource + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: prometheus-openstack-exporter diff --git a/kustomize/monitoring/openstack-exporter/base/kustomization.yaml b/kustomize/monitoring/openstack-exporter/base/kustomization.yaml new file mode 100644 index 00000000..eeb6a512 --- /dev/null +++ b/kustomize/monitoring/openstack-exporter/base/kustomization.yaml @@ -0,0 +1,4 @@ +resources: + - all.yaml + - hpa-openstack-exporter.yaml +