-
Notifications
You must be signed in to change notification settings - Fork 61
feat: OSPC-1365: Adding barbican exporter to provide barbican metrics… #1313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: Helm GitHub Actions for Barbican Exporter | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - base-helm-configs/barbican-exporter/** | ||
| - base-kustomize/barbican-exporter/** | ||
| - .github/workflows/helm-barbican-exporter.yaml | ||
| jobs: | ||
| helm: | ||
| strategy: | ||
| matrix: | ||
| overlays: | ||
| - base | ||
| 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: Run Helm Template | ||
| run: | | ||
| ${{ steps.helm.outputs.helm-path }} template barbican-exporter ${{ github.workspace }}/base-helm-configs/barbican-exporter \ | ||
| --create-namespace \ | ||
| --namespace=openstack \ | ||
| --wait \ | ||
| --timeout 120m \ | ||
| -f ${{ github.workspace }}/base-helm-configs/barbican-exporter/values.yaml > /tmp/rendered.yaml | ||
| - name: Return helm Build | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: helm-barbican-exporter-artifact-${{ matrix.overlays }} | ||
| path: /tmp/rendered.yaml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| apiVersion: v2 | ||
| name: barbican-exporter | ||
| description: A Helm chart for OpenStack Barbican Exporter | ||
| type: application | ||
| version: 0.1.0 | ||
| appVersion: "1.0" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| --- | ||
| # Helm overrides for Barbican Prometheus exporter | ||
| image: | ||
| repository: ghcr.io/rackerlabs/genestack-images/barbican-exporter | ||
| tag: "sha-6c19bf7" | ||
| pullPolicy: IfNotPresent | ||
| serviceMonitor: | ||
| enabled: true | ||
| interval: 30s | ||
| scrapeTimeout: 10s | ||
| namespace: openstack | ||
| labels: {} | ||
| nodeSelector: | ||
| openstack-control-plane: enabled | ||
| env: | ||
| - name: BARBICAN_API_URL | ||
| value: "http://barbican-api.openstack.svc.cluster.local:9311" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| --- | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not exist here but rather in a centeralized helm-chart repo specifically created to host this helm chart and its component pieces. For reference, you can model off the alert-proxy helm chart that was created here: https://github.com/rackerlabs/alert-proxy/blob/main/helm/templates/deployment.yaml |
||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: barbican-exporter | ||
| namespace: openstack | ||
| labels: | ||
| app.kubernetes.io/name: barbican-exporter | ||
| app.kubernetes.io/instance: barbican-exporter | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app.kubernetes.io/name: barbican-exporter | ||
| app.kubernetes.io/instance: barbican-exporter | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app.kubernetes.io/name: barbican-exporter | ||
| app.kubernetes.io/instance: barbican-exporter | ||
| spec: | ||
| nodeSelector: | ||
| openstack-control-plane: enabled | ||
| containers: | ||
| - name: barbican-exporter | ||
| image: quay.io/rackspace/barbican-exporter:latest | ||
| imagePullPolicy: IfNotPresent | ||
| env: | ||
| - name: OS_AUTH_URL | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: keystone-keystone-admin | ||
| key: OS_AUTH_URL | ||
| - name: OS_USERNAME | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: keystone-keystone-admin | ||
| key: OS_USERNAME | ||
| - name: OS_PASSWORD | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: keystone-keystone-admin | ||
| key: OS_PASSWORD | ||
| - name: OS_PROJECT_NAME | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: keystone-keystone-admin | ||
| key: OS_PROJECT_NAME | ||
| - name: OS_PROJECT_DOMAIN_NAME | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: keystone-keystone-admin | ||
| key: OS_PROJECT_DOMAIN_NAME | ||
| - name: OS_USER_DOMAIN_NAME | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: keystone-keystone-admin | ||
| key: OS_USER_DOMAIN_NAME | ||
| - name: OS_REGION_NAME | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: keystone-keystone-admin | ||
| key: OS_REGION_NAME | ||
| - name: OS_INTERFACE | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: keystone-keystone-admin | ||
| key: OS_INTERFACE | ||
| - name: BARBICAN_API_URL | ||
| value: "http://barbican-api.openstack.svc.cluster.local:9311" | ||
| ports: | ||
| - name: metrics | ||
| containerPort: 9100 | ||
| readinessProbe: | ||
| httpGet: | ||
| path: /metrics | ||
| port: metrics | ||
| initialDelaySeconds: 5 | ||
| periodSeconds: 10 | ||
| livenessProbe: | ||
| httpGet: | ||
| path: /metrics | ||
| port: metrics | ||
| initialDelaySeconds: 15 | ||
| periodSeconds: 20 | ||
| resources: | ||
| requests: | ||
| cpu: 50m | ||
| memory: 64Mi | ||
| limits: | ||
| cpu: 100m | ||
| memory: 128Mi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: barbican-exporter | ||
| namespace: openstack | ||
| labels: | ||
| app.kubernetes.io/name: barbican-exporter | ||
| app.kubernetes.io/instance: barbican-exporter | ||
| spec: | ||
| selector: | ||
| app.kubernetes.io/name: barbican-exporter | ||
| app.kubernetes.io/instance: barbican-exporter | ||
| ports: | ||
| - name: metrics | ||
| port: 9100 | ||
| targetPort: metrics | ||
| protocol: TCP |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| apiVersion: monitoring.coreos.com/v1 | ||
| kind: ServiceMonitor | ||
| metadata: | ||
| name: barbican-exporter | ||
| namespace: openstack | ||
| spec: | ||
| endpoints: | ||
| - interval: 30s | ||
| scrapeTimeout: 10s | ||
| path: /metrics | ||
| port: metrics | ||
| namespaceSelector: | ||
| matchNames: | ||
| - openstack | ||
| selector: | ||
| matchLabels: | ||
| app.kubernetes.io/name: barbican-exporter | ||
| app.kubernetes.io/instance: barbican-exporter |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| sortOptions: | ||
| order: fifo | ||
| resources: | ||
| - barbican-exporter-deployment.yaml | ||
| - barbican-exporter-service.yaml | ||
| - barbican-exporter-servicemonitor.yaml | ||
| - all.yaml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #!/bin/bash | ||
| set -e # Exit on error | ||
|
|
||
| # Variables | ||
| CHART_DIR="/opt/genestack/base-helm-configs/barbican-exporter" | ||
| NAMESPACE="openstack" | ||
| RELEASE_NAME="barbican-exporter" | ||
|
|
||
| # Check if chart directory exists | ||
| if [ ! -d "${CHART_DIR}" ]; then | ||
| echo "Chart directory ${CHART_DIR} does not exist!" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Ensure namespace exists | ||
| if ! kubectl get namespace ${NAMESPACE} >/dev/null 2>&1; then | ||
| echo "Namespace ${NAMESPACE} does not exist. Creating..." | ||
| kubectl create namespace ${NAMESPACE} | ||
| fi | ||
|
|
||
| # Check if release already exists | ||
| if helm list -n ${NAMESPACE} | grep -q ${RELEASE_NAME}; then | ||
| echo "Release ${RELEASE_NAME} already exists!" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Install Helm chart with dynamic values | ||
| echo "Installing Helm chart..." | ||
| helm install ${RELEASE_NAME} ${CHART_DIR} \ | ||
| --namespace ${NAMESPACE} || { | ||
| echo "Helm installation failed!" | ||
| exit 1 | ||
| } | ||
|
|
||
| # Verify deployment | ||
| echo "Verifying deployment..." | ||
| kubectl get pods -n ${NAMESPACE} | ||
| kubectl get svc -n ${NAMESPACE} | ||
| kubectl get servicemonitor -n ${NAMESPACE} | ||
|
|
||
| echo "Installation complete for $RELEASE_NAME!" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Barbican Exporter | ||
|
|
||
| The Barbican exporter allows monitoring of OpenStack's Key Management Service (Barbican) by exposing metrics to Prometheus. It collects metrics about secrets, containers, and other Barbican-specific resources. | ||
|
|
||
| #### Install the Barbican Exporter Helm Chart | ||
|
|
||
| ```shell | ||
| bin/install-barbican-exporter.sh | ||
| ``` | ||
|
|
||
| !!! success | ||
| If the installation is successful, you should see the barbican-exporter pod running in the openstack namespace. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the genestack repo is not the correct place to create a helm chart. genestack is meant to be a collection of resources. We will need to move anything that is releated to the creation of the helm chart to a seperate repo (possibly called: genestack-barbician-exporter-helm-chart).