Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiezieziula authored Dec 12, 2023
2 parents dbe12dd + 11047d7 commit 512b5f7
Show file tree
Hide file tree
Showing 22 changed files with 1,145 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/linters/prometheus-prefect-exporter-ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# See https://github.com/helm/chart-testing#configuration
charts:
- charts/prometheus-prefect-exporter
helm-extra-args: --timeout 600s
namespace: default
release-label: prefect
8 changes: 7 additions & 1 deletion .github/workflows/agent-lint-and-test.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
name: Lint and Test Prefect Agent Chart

"on":
pull_request:
pull_request_target:
paths:
- .github/workflows/agent-lint-and-test.yaml
- .github/linters/agent-ct.yaml
- charts/prefect-agent/**

# Do not grant jobs any permissions by default
permissions: {}

jobs:
lint_test:
name: "lint-test (${{ matrix.kubernetes }})"
runs-on: ubuntu-latest
permissions:
# required to read from the repo
contents: read
strategy:
matrix:
kubernetes:
Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/prometheus-exporter-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Release Prometheus Prefect Exporter Helm Chart

"on":
push:
tags:
# prefect-prometheus-exporter-2023.9.1, but not prefect-prometheus-exporter-2023.09.01
# prefect-prometheus-exporter-2023.11.5, but not prefect-prometheus-exporter-2023.11.05
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
- 'prefect-prometheus-exporter-2[0-9][2-9][3-9].1?[0-9].[1-3]?[0-9]'

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get the version tags
id: get_version
run: |
# Enable pipefail so git command failures do not result in null versions downstream
set -x
export "FULL_RELEASE=$(echo $GITHUB_REF | cut -d / -f 3)"
echo "RELEASE_VERSION=$(echo $FULL_RELEASE | cut -d - -f 4)" >> $GITHUB_OUTPUT
echo "PROMETHEUS_PREFECT_EXPORTER_VERSION=$(\
git ls-remote --tags --refs --sort="v:refname" \
https://github.com/PrefectHQ/prometheus-prefect-exporter | tail -n1 | sed 's/.*\///' \
)" >> $GITHUB_OUTPUT
- name: Copy Artifact Hub metadata
run: |
mkdir -p /tmp/chart
cp artifacthub-repo.yml /tmp/chart
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Set up Helm
uses: azure/[email protected]

- name: Prepare GPG key for signing
run: |
gpg_dir=/tmp/.gpg
mkdir "$gpg_dir"
keyring="$gpg_dir/secring.gpg"
base64 -d <<< "$GPG_KEYRING_BASE64" > "$keyring"
passphrase_file="$gpg_dir/passphrase"
echo "$GPG_PASSPHRASE" > "$passphrase_file"
echo "SIGN_PASSPHRASE_FILE=$passphrase_file" >> "$GITHUB_ENV"
echo "SIGN_KEYRING=$keyring" >> "$GITHUB_ENV"
env:
GPG_KEYRING_BASE64: "${{ secrets.GPG_KEYRING_BASE64 }}"
GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"

- name: Package Prometheus Exporter helm chart
run: |
mkdir -p /tmp/chart
cd charts
# Update the prefect version tag in values.yaml
sed -i "s/tag:.*$/tag: $PROMETHEUS_PREFECT_EXPORTER_VERSION/g" prometheus-prefect-exporter/values.yaml
helm package prometheus-prefect-exporter \
--destination /tmp/chart \
--dependency-update \
--version $RELEASE_VERSION \
--app-version $PROMETHEUS_PREFECT_EXPORTER_VERSION \
--sign --key '[email protected]' \
--keyring $SIGN_KEYRING \
--passphrase-file $SIGN_PASSPHRASE_FILE
env:
RELEASE_VERSION: ${{ steps.get_version.outputs.RELEASE_VERSION }}
PROMETHEUS_PREFECT_EXPORTER_VERSION: ${{ steps.get_version.outputs.PROMETHEUS_PREFECT_EXPORTER_VERSION }}
SIGN_KEYRING: ${{ env.SIGN_KEYRING }}
SIGN_PASSPHRASE_FILE: ${{ env.SIGN_PASSPHRASE_FILE }}

- name: Update chart index
run: |
git stash # Stash changes to the values.yaml so checkout doesn't complain
git checkout gh-pages
helm repo index /tmp/chart --url https://prefecthq.github.io/prefect-helm/charts --merge ./index.yaml
- name: Commit and push
run: |
cp /tmp/chart/artifacthub-repo.yml .
cp /tmp/chart/index.yaml .
cp /tmp/chart/prometheus-prefect-exporter-$RELEASE_VERSION.* ./charts
git add ./artifacthub-repo.yml ./index.yaml ./charts/prometheus-prefect-exporter-$RELEASE_VERSION.*
git commit -m "Release $RELEASE_VERSION"
git push origin gh-pages
env:
RELEASE_VERSION: ${{ steps.get_version.outputs.RELEASE_VERSION }}
47 changes: 47 additions & 0 deletions .github/workflows/prometheus-prefect-exporter-lint-and-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Lint and Test Prometheus Prefect Exporter Chart

"on":
pull_request:
paths:
- .github/workflows/prometheus-prefect-exporter-lint-and-test.yaml
- .github/linters/prometheus-prefect-exporter-ct.yaml
- charts/prometheus-prefect-exporter/**

jobs:
lint_test:
name: "lint-test (${{ matrix.kubernetes }})"
runs-on: ubuntu-latest
strategy:
matrix:
kubernetes:
- "1.25.8"
- "1.26.3"
- "1.27.0"
fail-fast: false

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up Helm
uses: azure/[email protected]

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (lint)
run: ct lint --config .github/linters/prometheus-prefect-exporter-ct.yaml

- name: Create kind cluster
uses: helm/[email protected]
with:
node_image: "kindest/node:v${{ matrix.kubernetes }}"

- name: Install Prefect Server
run: |
helm dependency build ./charts/prefect-server/
helm install prefect-server -n default ./charts/prefect-server/ --set=postgresql.auth.password=TESTING
- name: Run chart-testing (install)
run: |
ct install --config .github/linters/prometheus-prefect-exporter-ct.yaml --helm-extra-set-args "--set=prefectApiUrl=http://prefect-server.default.svc.cluster.local:4200/api"
6 changes: 6 additions & 0 deletions .github/workflows/server-lint-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ name: Lint and Test Prefect Server Chart
- .github/linters/server-ct.yaml
- charts/prefect-server/**

# Do not grant jobs any permissions by default
permissions: {}

jobs:
lint_test:
name: "lint-test (${{ matrix.kubernetes }})"
runs-on: ubuntu-latest
permissions:
# required to read from the repo
contents: read
strategy:
matrix:
kubernetes:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/worker-lint-and-test.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
name: Lint and Test Prefect Worker Chart

"on":
pull_request:
pull_request_target:
paths:
- .github/workflows/worker-lint-and-test.yaml
- .github/linters/worker-ct.yaml
- charts/prefect-worker/**

# Do not grant jobs any permissions by default
permissions: {}

jobs:
lint_test:
name: "lint-test (${{ matrix.kubernetes }})"
runs-on: ubuntu-latest
permissions:
# required to read from the repo
contents: read
strategy:
matrix:
kubernetes:
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ It is possible for multiple agent processes to be started for a single work pool

[Prefect server](https://docs.prefect.io/latest/guides/host/) is a self-hosted open source backend that makes it easy to observe and orchestrate your Prefect flows. It is an alternative to using the hosted [Prefect Cloud](https://docs.prefect.io/latest/cloud/) platform. Prefect Cloud provides additional features including automations and user management.

## [Prometheus Prefect Exporter](charts/prometheus-prefect-exporter/)

The Prometheus Prefect Exporter is a tool to pull relevant Prefect metrics from a hosted Prefect Server instance

## Usage

[Helm](https://helm.sh) must be installed to use the charts.
Expand Down
19 changes: 19 additions & 0 deletions charts/prometheus-prefect-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v2
appVersion: "latest"
description: A Helm chart to deploy Prometheus Prefect Exporter
home: https://github.com/PrefectHQ
keywords:
- prometheus-prefect-exporter
maintainers:
- name: jamiezieziula
email: [email protected]
- name: jimid27
email: [email protected]
- name: parkedwards
email: [email protected]
name: prometheus-prefect-exporter
sources:
- https://github.com/PrefectHQ/prefect-helm
type: application
# This version is never actually shipped. github actions will package add the appropriate version at build-time
version: 0.0.0
87 changes: 87 additions & 0 deletions charts/prometheus-prefect-exporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# prometheus-prefect-exporter

## Overview

This chart deploys a [Prometheus Exporter](https://github.com/PrefectHQ/prometheus-prefect-exporter) for Prefect Server, providing relevant metrics from your deployed Prefect Server instance.
Shoutout to [@ialejandro](https://github.com/ialejandro) for the original work on this chart!

## Installing the Chart

### Prerequisites

1. Add the Prefect Helm repository to your Helm client:

```bash
helm repo add prefect https://prefecthq.github.io/prefect-helm
helm repo update
```

2. Deploy a Prefect Server instance using the [Prefect Server Helm chart](https://github.com/PrefectHQ/prefect-helm/tree/main/charts/prefect-server)

### Install the Prefect Exporter chart

1. Configure the Prefect exporter values as needed
Create a `values.yaml` file to customize the Prometheus Prefect Exporter configuration.

2. Install the chart
```bash
helm install prometheus-prefect-exporter prefect/prometheus-prefect-exporter --namespace=<PREFECT_SERVER_NAMESPACE> -f values.yaml
```

3. Verify the deployment

Check the status of your Prometheus Prefect Exporter deployment:

```bash
kubectl get pods -n prefect
NAME READY STATUS RESTARTS AGE
prometheus-prefect-exporter-76vxqnq 1/1 Running 0 25m
```

You should see the Prometheus Prefect Exporter pod running

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| jamiezieziula | <[email protected]> | |
| jimid27 | <[email protected]> | |
| parkedwards | <[email protected]> | |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Affinity for pod assignment |
| autoscaling | object | `{"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPUUtilizationPercentage":80}` | Autoscaling with CPU or memory utilization percentage |
| env | object | `{}` | Environment variables to configure application |
| fullnameOverride | string | `""` | String to fully override prometheus-prefect-exporter.fullname template |
| image | object | `{"pullPolicy":"IfNotPresent","repository":"prefecthq/prometheus-prefect-exporter","tag":"1.0.0"}` | Image registry |
| imagePullSecrets | list | `[]` | Global Docker registry secret names as an array |
| ingress | object | `{"annotations":{},"className":"","enabled":false,"hosts":[{"host":"chart-example.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}],"tls":[]}` | Ingress configuration to expose app |
| livenessProbe | bool | `false` | Enable livenessProbe |
| nameOverride | string | `""` | String to partially override prometheus-prefect-exporter.fullname template (will maintain the release name) |
| nodeSelector | object | `{}` | Node labels for pod assignment |
| podAnnotations | object | `{}` | Pod annotations |
| podDisruptionBudget | object | `{}` | Limits the number of Pods of a replicated application that are down simultaneously from voluntary disruptions |
| podSecurityContext | object | `{}` | To specify security settings for a Pod |
| prefectApiUrl | string | `"http://prefect-server.prefect.svc.cluster.local:4200"` | Prefect API URL to connect to for metrics |
| prometheusRule.additionalLabels | object | `{}` | |
| prometheusRule.enabled | bool | `false` | |
| prometheusRule.rules | list | `[]` | |
| readinessProbe | bool | `false` | Enable readinessProbe |
| replicaCount | int | `1` | Number of replicas |
| resources | object | `{}` | The resources limits and requested |
| securityContext | object | `{}` | Defines privilege and access control settings for a Pod or Container |
| service | object | `{"port":80,"targetPort":8000,"type":"ClusterIP"}` | Kubernetes servide to expose Pod |
| service.port | int | `80` | Kubernetes Service port |
| service.targetPort | int | `8000` | Pod expose port |
| service.type | string | `"ClusterIP"` | Kubernetes Service type. Allowed values: NodePort, LoadBalancer or ClusterIP |
| serviceAccount | object | `{"annotations":{},"create":true,"name":""}` | Enable creation of ServiceAccount |
| serviceMonitor | object | `{"enabled":false,"interval":"30s","metricRelabelings":[],"relabelings":[],"scrapeTimeout":"10s"}` | Enable ServiceMonitor to get metrics ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitor |
| serviceMonitor.enabled | bool | `false` | Enable or disable |
| tolerations | list | `[]` | Tolerations for pod assignment |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.3](https://github.com/norwoodj/helm-docs/releases/v1.11.3)
51 changes: 51 additions & 0 deletions charts/prometheus-prefect-exporter/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{ template "chart.header" . }}

## Overview

This chart deploys a [Prometheus Exporter](https://github.com/PrefectHQ/prometheus-prefect-exporter) for Prefect Server, providing relevant metrics from your deployed Prefect Server instance.
Shoutout to @ialejandro for the original work on this chart!

## Installing the Chart

### Prerequisites

1. Add the Prefect Helm repository to your Helm client:

```bash
helm repo add prefect https://prefecthq.github.io/prefect-helm
helm repo update
```

2. Deploy a Prefect Server instance using the [Prefect Server Helm chart](https://github.com/PrefectHQ/prefect-helm/tree/main/charts/prefect-server)

### Install the Prefect Exporter chart

1. Configure the Prefect exporter values as needed
Create a `values.yaml` file to customize the Prometheus Prefect Exporter configuration.

2. Install the chart
```bash
helm install prometheus-prefect-exporter prefect/prometheus-prefect-exporter --namespace=<PREFECT_SERVER_NAMESPACE> -f values.yaml
```

3. Verify the deployment

Check the status of your Prometheus Prefect Exporter deployment:

```bash
kubectl get pods -n prefect

NAME READY STATUS RESTARTS AGE
prometheus-prefect-exporter-76vxqnq 1/1 Running 0 25m
```

You should see the Prometheus Prefect Exporter pod running


{{ template "chart.maintainersSection" . }}

{{ template "chart.requirementsSection" . }}

{{ template "chart.valuesSection" . }}

{{ template "helm-docs.versionFooter" . }}
Loading

0 comments on commit 512b5f7

Please sign in to comment.