Skip to content

Commit

Permalink
Add prometheus-pushgateway chart (#55)
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Berendt <[email protected]>
  • Loading branch information
berendt authored Jul 27, 2024
1 parent cdb2e5e commit a904292
Show file tree
Hide file tree
Showing 18 changed files with 1,162 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .charts.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
charts:
- name: prometheus-pushgateway
# https://artifacthub.io/packages/helm/prometheus-community/prometheus-pushgateway
version: 2.14.0
repository:
url: https://prometheus-community.github.io/helm-charts
- name: keycloak
# https://artifacthub.io/packages/helm/bitnami/keycloak
version: 21.8.0
Expand Down
24 changes: 24 additions & 0 deletions charts/prometheus-pushgateway/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj

# OWNERS file for Kubernetes
OWNERS
24 changes: 24 additions & 0 deletions charts/prometheus-pushgateway/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
annotations:
artifacthub.io/license: Apache-2.0
artifacthub.io/links: |
- name: Chart Source
url: https://github.com/prometheus-community/helm-charts
apiVersion: v2
appVersion: v1.9.0
description: A Helm chart for prometheus pushgateway
home: https://github.com/prometheus/pushgateway
keywords:
- pushgateway
- prometheus
maintainers:
- email: [email protected]
name: gianrubio
- email: [email protected]
name: cstaud
- email: [email protected]
name: zeritti
name: prometheus-pushgateway
sources:
- https://github.com/prometheus/pushgateway
type: application
version: 2.14.0
88 changes: 88 additions & 0 deletions charts/prometheus-pushgateway/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Prometheus Pushgateway

This chart bootstraps a Prometheus [Pushgateway](http://github.com/prometheus/pushgateway) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

An optional prometheus `ServiceMonitor` can be enabled, should you wish to use this gateway with [Prometheus Operator](https://github.com/coreos/prometheus-operator).

## Get Repository Info
<!-- textlint-disable terminology -->
```console
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
```

_See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation._
<!-- textlint-enable -->
## Install Chart

```console
helm install [RELEASE_NAME] prometheus-community/prometheus-pushgateway
```

_See [configuration](#configuration) below._

_See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._

## Uninstall Chart

```console
helm uninstall [RELEASE_NAME]
```

This removes all the Kubernetes components associated with the chart and deletes the release.

_See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._

## Upgrading Chart

```console
helm upgrade [RELEASE_NAME] prometheus-community/prometheus-pushgateway --install
```

_See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._

### To 2.0.0

Chart API version has been upgraded to v2 so Helm 3 is needed from now on.

Docker image tag is used from Chart.yaml appVersion field by default now.

Version 2.0.0 also adapted [Helm label and annotation best practices](https://helm.sh/docs/chart_best_practices/labels/). Specifically, labels mapping is listed below:

```console
OLD => NEW
----------------------------------------
heritage => app.kubernetes.io/managed-by
chart => helm.sh/chart
[container version] => app.kubernetes.io/version
app => app.kubernetes.io/name
release => app.kubernetes.io/instance
```

Therefore, depending on the way you've configured the chart, the previous StatefulSet or Deployment need to be deleted before upgrade.

If `runAsStatefulSet: false` (this is the default):

```console
kubectl delete deploy -l app=prometheus-pushgateway
```

If `runAsStatefulSet: true`:

```console
kubectl delete sts -l app=prometheus-pushgateway
```

After that do the actual upgrade:

```console
helm upgrade -i prometheus-pushgateway prometheus-community/prometheus-pushgateway
```

## Configuration

See [Customizing the Chart Before Installing](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing). To see all configurable options with detailed comments, visit the chart's [values.yaml](./values.yaml), or run these configuration commands:

```console
helm show values prometheus-community/prometheus-pushgateway
```
19 changes: 19 additions & 0 deletions charts/prometheus-pushgateway/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ template "prometheus-pushgateway.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "prometheus-pushgateway.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ template "prometheus-pushgateway.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "prometheus-pushgateway.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ template "prometheus-pushgateway.namespace" . }} {{ template "prometheus-pushgateway.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ template "prometheus-pushgateway.namespace" . }} -l "app.kubernetes.io/name={{ template "prometheus-pushgateway.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
kubectl port-forward $POD_NAME 9091
echo "Visit http://127.0.0.1:9091 to use your application"
{{- end }}
Loading

0 comments on commit a904292

Please sign in to comment.