Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/release-chart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release Charts

on:
push:
branches:
- main
paths:
- 'charts/**'

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

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"

- name: Install Helm
uses: azure/setup-helm@v4

- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
with:
charts_dir: .
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
13 changes: 13 additions & 0 deletions charts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v2
name: alertmanager-icinga-bridge
description: Alertmanager to Icinga2 bridge
home: https://github.com/NETWAYS/alertmanager-icinga-bridge
keywords:
- prometheus
- alertmanager
- webhook
- icinga2
sources:
- https://github.com/NETWAYS/alertmanager-icinga-bridge
version: 1.0.0
appVersion: "1.0.3"
71 changes: 71 additions & 0 deletions charts/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "alertmanager-icinga-bridge.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "alertmanager-icinga-bridge.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "alertmanager-icinga-bridge.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}


{{/*
Create image pull secret.
*/}}
{{- define "alertmanager-icinga-bridge.imagePullSecret" -}}
{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" ( required "Please specify the Docker registry" .Values.image.registry) (printf "%s:%s" (required "Please specify the Docker user name" .Values.image.username) ( required "Please specify the Docker password" .Values.image.password) | b64enc) | b64enc }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "alertmanager-icinga-bridge.labels" -}}
helm.sh/chart: {{ include "alertmanager-icinga-bridge.chart" . }}
{{ include "alertmanager-icinga-bridge.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "alertmanager-icinga-bridge.selectorLabels" -}}
app.kubernetes.io/name: {{ include "alertmanager-icinga-bridge.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "alertmanager-icinga-bridge.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "alertmanager-icinga-bridge.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
97 changes: 97 additions & 0 deletions charts/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "alertmanager-icinga-bridge.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "alertmanager-icinga-bridge.name" . }}
helm.sh/chart: {{ include "alertmanager-icinga-bridge.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "alertmanager-icinga-bridge.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "alertmanager-icinga-bridge.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
annotations:
checksum/tokens-secret: {{ include (print .Template.BasePath "/secret.yaml") . | sha256sum }}
spec:
serviceAccountName: {{ include "alertmanager-icinga-bridge.serviceAccountName" . }}
{{- if .Values.securityContext.enabled }}
securityContext:
fsGroup: {{ .Values.securityContext.fsGroup }}
runAsUser: {{ .Values.securityContext.runAsUser }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: {{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}
env:
- name: ALERTMANAGER_ICINGA_BRIDGE_ID
value: {{ required ".Values.config.id is required" .Values.config.id | quote }}
- name: ALERTMANAGER_ICINGA_BRIDGE_ICINGA_HOSTNAME
value: {{ required ".Values.config.icinga_hostname is required" .Values.config.icinga_hostname | quote }}
- name: ALERTMANAGER_ICINGA_BRIDGE_ICINGA_URL
value: {{ required ".Values.config.icinga_url is required" .Values.config.icinga_url | quote }}
- name: ALERTMANAGER_ICINGA_BRIDGE_ICINGA_USERNAME
value: {{ required ".Values.config.icinga_username is required" .Values.config.icinga_username | quote }}
- name: ALERTMANAGER_ICINGA_BRIDGE_ICINGA_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.config.icinga_password_secret | default (printf "%s" (include "alertmanager-icinga-bridge.fullname" .)) | quote }}
key: "icinga_password"
- name: ALERTMANAGER_ICINGA_BRIDGE_LISTEN_ADDR
value: {{ printf "0.0.0.0:%v" .Values.config.alertmanager_port | quote }}
- name: ALERTMANAGER_ICINGA_BRIDGE_BEARER_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.config.alertmanager_bearer_token_secret | default (printf "%s" (include "alertmanager-icinga-bridge.fullname" .)) | quote }}
key: "alertmanager_bearer_token"
{{- if .Values.extraEnvVars }}
{{ toYaml .Values.extraEnvVars | indent 10 }}
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.config.alertmanager_port }}
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: http
readinessProbe:
httpGet:
path: /healthz
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.extraVolumeMounts }}
volumeMounts:
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.extraVolumes }}
volumes:
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
imagePullSecrets:
{{- if .Values.image.existingPullSecret }}
- name: {{ .Values.image.existingPullSecret }}
{{- else if .Values.image.password }}
- name: {{ template "alertmanager-icinga-bridge.fullname" . }}-pullsecret
{{- end }}
14 changes: 14 additions & 0 deletions charts/templates/pull-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if and (not .Values.image.existingPullSecret) .Values.image.password }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "alertmanager-icinga-bridge.fullname" . }}-pullsecret
labels:
app.kubernetes.io/name: {{ include "alertmanager-icinga-bridge.name" . }}
helm.sh/chart: {{ include "alertmanager-icinga-bridge.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: {{ template "alertmanager-icinga-bridge.imagePullSecret" . }}
{{- end -}}
18 changes: 18 additions & 0 deletions charts/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if or (not .Values.config.icinga_password_secret) (not .Values.config.alertmanager_bearer_token_secret) }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "alertmanager-icinga-bridge.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "alertmanager-icinga-bridge.name" . }}
helm.sh/chart: {{ include "alertmanager-icinga-bridge.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
{{- if not .Values.config.icinga_password_secret }}
icinga_password: {{ required ".Values.config.icinga_password is required" .Values.config.icinga_password | b64enc | quote }}
{{- end }}
{{- if not .Values.config.alertmanager_bearer_token_secret }}
alertmanager_bearer_token: {{ required ".Values.config.alertmanager_bearer_token is required" .Values.config.alertmanager_bearer_token | b64enc | quote }}
{{- end }}
{{- end -}}
19 changes: 19 additions & 0 deletions charts/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "alertmanager-icinga-bridge.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "alertmanager-icinga-bridge.name" . }}
helm.sh/chart: {{ include "alertmanager-icinga-bridge.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
type: ClusterIP
ports:
- name: http
port: 80
protocol: TCP
targetPort: http
selector:
app.kubernetes.io/name: {{ include "alertmanager-icinga-bridge.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
10 changes: 10 additions & 0 deletions charts/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "alertmanager-icinga-bridge.serviceAccountName" . }}
labels:
{{- include "alertmanager-icinga-bridge.labels" . | nindent 4 }}
annotations:
{{- toYaml .Values.serviceAccount.annotations | nindent 4 }}
{{- end }}
82 changes: 82 additions & 0 deletions charts/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Default values for alertmanager-icinga-bridge.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
registry: ghcr.io/netways
repository: alertmanager-icinga-bridge
tag: 1.0.3
pullPolicy: IfNotPresent
# username:
# password:
# existingPullSecret: my-image-pull-secret

nameOverride: ""
fullnameOverride: ""

# Required configuration
config:
id: alertmanagerID
icinga_hostname: Alertmanager
icinga_url: https://icinga.internal:5665
icinga_username: icinga-example-api-user
icinga_password: icinga-example-api-password
alertmanager_port: 8888
# alertmanager_bearer_token: aaaaaa
# alertmanager_bearer_token_secret:

# Optional extra configuration
# extraEnvVars:
# - name: ALERTMANAGER_ICINGA_BRIDGE_LOGLEVEL
# value: "debug"
# - name: ALERTMANAGER_ICINGA_BRIDGE_ICINGA_CA
# value: |
# -----BEGIN CERTIFICATE-----
# ....
# -----END CERTIFICATE-----
# - name: ALERTMANAGER_ICINGA_BRIDGE_ICINGA_INSECURE_TLS
# value: "false"
# - name: ALERTMANAGER_ICINGA_BRIDGE_GC_INTERVAL
# value: "15m"
# - name: ALERTMANAGER_ICINGA_BRIDGE_HEARTBEAT_INTERVAL
# value: "1m"
# - name: ALERTMANAGER_ICINGA_BRIDGE_KEEP_FOR
# value: "168h"
# - name: ALERTMANAGER_ICINGA_BRIDGE_SERVICE_TEMPLATE
# value: "generic-service"
#
# Extra volumes for the alertmanager-icinga-bridge deployment. Optional.
extraVolumes: []

# Extra volumeMounts for the alertmanager-icinga-bridge deployment. Optional.
extraVolumeMounts: []

serviceAccount:
# Specifies whether a service account should be created
create: true
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
# Annotations to add to the service account
annotations: {}

securityContext:
enabled: false
runAsUser: 999
fsGroup: 999

resources:
requests:
cpu: 100m
memory: 64Mi
limits:
cpu: 200m
memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}