Skip to content

Commit

Permalink
Adding openstack-exporter workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
the2hill committed Feb 15, 2024
1 parent 11bf18e commit 6b5ee26
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 48 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/helm-openstack-exporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Helm GitHub Actions for openstack-exporter

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-infra
${{ 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/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
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,4 @@ manifests:
network_policy: false
secret_keystone: true
secret_registry: true
service: true
service: true
14 changes: 14 additions & 0 deletions kustomize/monitoring/openstack-exporter/aio/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources:
- all.yaml
- hpa-openstack-exporter.yaml
94 changes: 47 additions & 47 deletions kustomize/prometheus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1166,53 +1166,53 @@ serverFiles:
# * `prometheus.io/port`: If the metrics are exposed on a different port to the
# service then set this appropriately.
- job_name: 'openstack-exporter'
kubernetes_sd_configs:
- role: endpoints
scrape_interval: 60s
relabel_configs:
- source_labels:
- __meta_kubernetes_service_name
action: keep
regex: "openstack-metrics"
- source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_scrape
action: keep
regex: true
- source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_scheme
action: replace
target_label: __scheme__
regex: (https?)
- source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_path
action: replace
target_label: __metrics_path__
regex: (.+)
- source_labels:
- __address__
- __meta_kubernetes_service_annotation_prometheus_io_port
action: replace
target_label: __address__
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:$2
- action: labelmap
regex: __meta_kubernetes_service_label_(.+)
- source_labels:
- __meta_kubernetes_namespace
action: replace
target_label: kubernetes_namespace
- source_labels:
- __meta_kubernetes_service_name
action: replace
target_label: instance
- source_labels:
- __meta_kubernetes_service_name
action: replace
target_label: kubernetes_name
- source_labels:
- __meta_kubernetes_service_name
target_label: job
replacement: ${1}
kubernetes_sd_configs:
- role: endpoints
scrape_interval: 60s
relabel_configs:
- source_labels:
- __meta_kubernetes_service_name
action: keep
regex: "openstack-metrics"
- source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_scrape
action: keep
regex: true
- source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_scheme
action: replace
target_label: __scheme__
regex: (https?)
- source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_path
action: replace
target_label: __metrics_path__
regex: (.+)
- source_labels:
- __address__
- __meta_kubernetes_service_annotation_prometheus_io_port
action: replace
target_label: __address__
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:$2
- action: labelmap
regex: __meta_kubernetes_service_label_(.+)
- source_labels:
- __meta_kubernetes_namespace
action: replace
target_label: kubernetes_namespace
- source_labels:
- __meta_kubernetes_service_name
action: replace
target_label: instance
- source_labels:
- __meta_kubernetes_service_name
action: replace
target_label: kubernetes_name
- source_labels:
- __meta_kubernetes_service_name
target_label: job
replacement: ${1}


# adds additional scrape configs to prometheus.yml
Expand Down

0 comments on commit 6b5ee26

Please sign in to comment.