Skip to content

Commit

Permalink
add flux notifier chart
Browse files Browse the repository at this point in the history
  • Loading branch information
slamdev committed May 23, 2020
1 parent 07b6312 commit 9c6dba1
Show file tree
Hide file tree
Showing 10 changed files with 340 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This repository contains [Helm](https://helm.sh) charts for various projects

* [Archiva](https://github.com/slamdev/helm-charts/tree/master/charts/archiva)
* [External Secrets Operator](https://github.com/slamdev/helm-charts/tree/master/charts/external-secrets-operator)
* [Flux Notifier](https://github.com/slamdev/helm-charts/tree/master/charts/flux-notifier)
* [Gitlab Omnibus](https://github.com/slamdev/helm-charts/tree/master/charts/gitlab-omnibus)
* [GKE Preemptible Notifier](https://github.com/slamdev/helm-charts/tree/master/charts/gke-preemptible-notifier)
* [Gradle Cache](https://github.com/slamdev/helm-charts/tree/master/charts/gradle-cache)
Expand Down
12 changes: 12 additions & 0 deletions charts/flux-notifier/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v2
name: flux-notifier
description: |-
Helm chart to deploy [flux-notifier](https://github.com/slamdev/flux-notifier/).
type: application
version: 0.0.1
appVersion: "v0.0.1"
home: https://github.com/slamdev/helm-charts/tree/master/charts/flux-notifier
icon: https://docs.fluxcd.io/en/1.19.0/_files/[email protected]
maintainers:
- name: slamdev
email: [email protected]
39 changes: 39 additions & 0 deletions charts/flux-notifier/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
flux-notifier
=============
Helm chart to deploy [flux-notifier](https://github.com/slamdev/flux-notifier/).

Current chart version is `0.0.1`

Source code can be found [here](https://github.com/slamdev/helm-charts/tree/master/charts/flux-notifier)



## Chart Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | affinity for scheduler pod assignment |
| env | list | `[]` | additional environment variables for the deployment |
| fullnameOverride | string | `""` | full name of the chart. |
| image.pullPolicy | string | `"IfNotPresent"` | image pull policy |
| image.repository | string | `"slamdev/flux-notifier"` | image repository |
| image.tag | string | `""` | image tag (chart's appVersion value will be used if not set) |
| imagePullSecrets | list | `[]` | image pull secret for private images |
| livenessProbe.httpGet.path | string | `"/health"` | path for liveness probe |
| livenessProbe.httpGet.port | string | `"http"` | port for liveness probe |
| nameOverride | string | `""` | override name of the chart |
| nodeSelector | object | `{}` | node for scheduler pod assignment |
| podSecurityContext | object | `{}` | specifies security settings for a pod |
| readinessProbe.httpGet.path | string | `"/health"` | path for readiness probe |
| readinessProbe.httpGet.port | string | `"http"` | port for readiness probe |
| replicaCount | int | `1` | number of replicas for flux-notifier deployment. |
| resources | object | `{}` | custom resource configuration |
| securityContext | object | `{}` | specifies security settings for a container |
| service.ports | list | `[{"name":"http","port":80,"protocol":"TCP","targetPort":"http"}]` | service ports |
| service.type | string | `"ClusterIP"` | service type |
| serviceAccount.annotations | object | `{}` | annotations to add to the service account |
| serviceAccount.create | bool | `false` | specifies whether a service account should be created |
| serviceAccount.name | string | `nil` | the name of the service account to use; if not set and create is true, a name is generated using the fullname template |
| tolerations | list | `[]` | tolerations for scheduler pod assignment |
| volumeMounts | list | `[]` | additional volume mounts |
| volumes | list | `[]` | additional volumes |
15 changes: 15 additions & 0 deletions charts/flux-notifier/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "flux-notifier.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.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 --namespace {{ .Release.Namespace }} svc -w {{ include "flux-notifier.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "flux-notifier.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "flux-notifier.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
{{- end }}
70 changes: 70 additions & 0 deletions charts/flux-notifier/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "flux-notifier.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 "flux-notifier.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 "flux-notifier.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "flux-notifier.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "flux-notifier.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Create the tag for the docker image to use
*/}}
{{- define "flux-notifier.tag" -}}
{{- .Values.image.tag | default .Chart.AppVersion -}}
{{- end -}}
64 changes: 64 additions & 0 deletions charts/flux-notifier/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "flux-notifier.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "flux-notifier.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "flux-notifier.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "flux-notifier.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "flux-notifier.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ include "flux-notifier.tag" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.env }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
volumes:
{{- toYaml . | 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 }}
15 changes: 15 additions & 0 deletions charts/flux-notifier/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "flux-notifier.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "flux-notifier.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
{{- with .Values.service.ports }}
ports:
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
{{- include "flux-notifier.selectorLabels" . | nindent 4 }}
13 changes: 13 additions & 0 deletions charts/flux-notifier/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "flux-notifier.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "flux-notifier.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end -}}
16 changes: 16 additions & 0 deletions charts/flux-notifier/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "flux-notifier.fullname" . }}-test-connection"
namespace: {{ .Release.Namespace }}
labels:
{{- include "flux-notifier.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test-success
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "flux-notifier.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
95 changes: 95 additions & 0 deletions charts/flux-notifier/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# replicaCount -- number of replicas for flux-notifier deployment.
replicaCount: 1

image:
# image.repository -- image repository
repository: slamdev/flux-notifier
# image.tag -- image tag (chart's appVersion value will be used if not set)
tag: ""
# image.pullPolicy -- image pull policy
pullPolicy: IfNotPresent

# imagePullSecrets -- image pull secret for private images
imagePullSecrets: []
# nameOverride -- override name of the chart
nameOverride: ""
# fullnameOverride -- full name of the chart.
fullnameOverride: ""

serviceAccount:
# serviceAccount.create -- specifies whether a service account should be created
create: false
# serviceAccount.annotations -- annotations to add to the service account
annotations: {}
# serviceAccount.name -- the name of the service account to use; if not set and create is true, a name is generated using the fullname template
name:

# podSecurityContext -- specifies security settings for a pod
podSecurityContext: {}
# fsGroup: 2000

# securityContext -- specifies security settings for a container
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

service:
# service.type -- service type
type: ClusterIP
# service.ports -- service ports
ports:
- name: http
port: 80
targetPort: http
protocol: TCP

# resources -- custom resource configuration
resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

# nodeSelector -- node for scheduler pod assignment
nodeSelector: {}

# tolerations -- tolerations for scheduler pod assignment
tolerations: []

# affinity -- affinity for scheduler pod assignment
affinity: {}

# volumeMounts -- additional volume mounts
volumeMounts: []
# - name: cache
# mountPath: /data/flux-notifier/cache

# volumes -- additional volumes
volumes: []
# - name: cache
# emptyDir: {}

livenessProbe:
httpGet:
# livenessProbe.httpGet.path -- path for liveness probe
path: /health
# livenessProbe.httpGet.port -- port for liveness probe
port: http

readinessProbe:
httpGet:
# readinessProbe.httpGet.path -- path for readiness probe
path: /health
# readinessProbe.httpGet.port -- port for readiness probe
port: http

# env -- additional environment variables for the deployment
env: []
# - name: SAMPLE
# value: text

0 comments on commit 9c6dba1

Please sign in to comment.