From 451d0510c2f4f8f5e5721a7e4ebb8949144a10fd Mon Sep 17 00:00:00 2001 From: bjws Date: Fri, 11 Sep 2020 13:32:55 +0200 Subject: [PATCH 1/4] [media-common] Add openvpn add-on --- charts/media-common/Chart.yaml | 8 ++++++- charts/media-common/templates/_helpers.tpl | 24 +++++++++++++++++++ .../media-common/templates/addon-openvpn.yaml | 8 +++++++ charts/media-common/templates/deployment.yaml | 5 ++-- .../media-common/templates/statefulset.yaml | 5 ++-- charts/media-common/values.yaml | 7 ++++++ 6 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 charts/media-common/templates/addon-openvpn.yaml diff --git a/charts/media-common/Chart.yaml b/charts/media-common/Chart.yaml index 6f724c57..120b989a 100644 --- a/charts/media-common/Chart.yaml +++ b/charts/media-common/Chart.yaml @@ -2,10 +2,16 @@ apiVersion: v2 name: media-common description: Common dependancy chart for media ecosystem containers type: application -version: 1.0.1 +version: 1.1.0 keywords: - media-common home: https://github.com/k8s-at-home/charts/tree/master/charts/media-common maintainers: - name: DirtyCajunRice email: nick@cajun.pro +dependencies: + - name: media-common-openvpn + repository: https://k8s-at-home.com/charts/ + version: 1.0.0 + condition: openvpn.enabled + alias: openvpn diff --git a/charts/media-common/templates/_helpers.tpl b/charts/media-common/templates/_helpers.tpl index 96638404..b45e490b 100644 --- a/charts/media-common/templates/_helpers.tpl +++ b/charts/media-common/templates/_helpers.tpl @@ -50,3 +50,27 @@ Selector labels app.kubernetes.io/name: {{ include "media-common.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} + +{{/* +Additional Containers +*/}} +{{- define "media-common.additionalContainers" -}} +{{- if .Values.additionalContainers }} +{{- toYaml .Values.additionalContainers }} +{{- end }} +{{- if .Values.openvpn.enabled }} +{{ include "media-common.openvpn.container" . }} +{{- end }} +{{- end -}} + +{{/* +Additional Volumes +*/}} +{{- define "media-common.additionalVolumes" -}} +{{- if .Values.additionalVolumes }} +{{- toYaml .Values.additionalVolumes }} +{{- end }} +{{- if .Values.openvpn.enabled }} +{{ include "media-common.openvpn.volume" . }} +{{- end }} +{{- end -}} diff --git a/charts/media-common/templates/addon-openvpn.yaml b/charts/media-common/templates/addon-openvpn.yaml new file mode 100644 index 00000000..43d86634 --- /dev/null +++ b/charts/media-common/templates/addon-openvpn.yaml @@ -0,0 +1,8 @@ +{{- if .Values.openvpn.enabled -}} +--- +{{ include "media-common.openvpn.configmap" . }} +--- +{{ include "media-common.openvpn.secret" . }} +--- +{{ include "media-common.openvpn.networkpolicy" . }} +{{- end -}} \ No newline at end of file diff --git a/charts/media-common/templates/deployment.yaml b/charts/media-common/templates/deployment.yaml index a9139b77..aeb31bfb 100644 --- a/charts/media-common/templates/deployment.yaml +++ b/charts/media-common/templates/deployment.yaml @@ -74,6 +74,7 @@ spec: resources: {{- toYaml . | nindent 12 }} {{- end }} + {{- include "media-common.additionalContainers" . | nindent 8 }} volumes: - name: config {{- if .Values.persistence.config.enabled }} @@ -87,9 +88,7 @@ spec: persistentVolumeClaim: claimName: {{ if .Values.persistence.media.existingClaim }}{{ .Values.persistence.media.existingClaim }}{{- else }}{{ template "media-common.fullname" . }}-media{{- end }} {{- end }} - {{- if .Values.additionalVolumes }} - {{- toYaml .Values.additionalVolumes | nindent 8 }} - {{- end }} + {{- include "media-common.additionalVolumes" . | nindent 8 }} {{- with .Values.nodeSelector }} nodeSelector: {{ toYaml . | indent 8 }} diff --git a/charts/media-common/templates/statefulset.yaml b/charts/media-common/templates/statefulset.yaml index d3d62468..d004b3a0 100644 --- a/charts/media-common/templates/statefulset.yaml +++ b/charts/media-common/templates/statefulset.yaml @@ -75,6 +75,7 @@ spec: resources: {{- toYaml . | nindent 12 }} {{- end }} + {{- include "media-common.additionalContainers" . | nindent 8 }} volumes: - name: config {{- if .Values.persistence.config.enabled }} @@ -88,9 +89,7 @@ spec: persistentVolumeClaim: claimName: {{ if .Values.persistence.media.existingClaim }}{{ .Values.persistence.media.existingClaim }}{{- else }}{{ template "media-common.fullname" . }}-media{{- end }} {{- end }} - {{- if .Values.additionalVolumes }} - {{- toYaml .Values.additionalVolumes | nindent 8 }} - {{- end }} + {{- include "media-common.additionalVolumes" . | nindent 8 }} {{- with .Values.nodeSelector }} nodeSelector: {{ toYaml . | indent 8 }} diff --git a/charts/media-common/values.yaml b/charts/media-common/values.yaml index da2dac13..25ce4fc2 100644 --- a/charts/media-common/values.yaml +++ b/charts/media-common/values.yaml @@ -113,10 +113,17 @@ persistence: ## Do not delete the pvc upon helm uninstall skipuninstall: false +additionalContainers: [] + additionalVolumes: [] additionalVolumeMounts: [] +# Enable the OpenVPN add-on here +# See https://github.com/k8s-at-home/charts/tree/master/charts/media-common-openvpn for more details +openvpn: + enabled: false + podSecurityContext: {} # fsGroup: 2000 From f8babcb5a2257ed76c0b938e447a273c3918aa34 Mon Sep 17 00:00:00 2001 From: bjws Date: Sun, 13 Sep 2020 09:34:47 +0200 Subject: [PATCH 2/4] Process review comments --- charts/media-common/Chart.yaml | 2 +- charts/media-common/README.md | 7 ++++++- charts/media-common/ci/ct-values.yaml | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/charts/media-common/Chart.yaml b/charts/media-common/Chart.yaml index 120b989a..8772500b 100644 --- a/charts/media-common/Chart.yaml +++ b/charts/media-common/Chart.yaml @@ -12,6 +12,6 @@ maintainers: dependencies: - name: media-common-openvpn repository: https://k8s-at-home.com/charts/ - version: 1.0.0 + version: ^1.0.0 condition: openvpn.enabled alias: openvpn diff --git a/charts/media-common/README.md b/charts/media-common/README.md index 043d9a94..11f3218c 100644 --- a/charts/media-common/README.md +++ b/charts/media-common/README.md @@ -22,4 +22,9 @@ These values will normally be nested as it is a dependency, for example: ```yaml radarr: -``` \ No newline at end of file +``` + +## Add-ons + +### OpenVPN +It is possible to enable an OpenVPN add-on by setting `openvpn.enabled: true`. For more information refer to [k8s-at-home/media-common-openvpn](https://github.com/k8s-at-home/charts/tree/master/charts/media-common-openvpn) diff --git a/charts/media-common/ci/ct-values.yaml b/charts/media-common/ci/ct-values.yaml index 2e2ef0b2..477de624 100644 --- a/charts/media-common/ci/ct-values.yaml +++ b/charts/media-common/ci/ct-values.yaml @@ -1,6 +1,22 @@ +--- image: organization: linuxserver repository: radarr tag: latest service: port: 7878 + +openvpn: + enabled: true + + image: + repository: dperson/openvpn-client + tag: latest + pullPolicy: IfNotPresent + + scripts: + up: + down: + + networkPolicy: + enabled: false From a5b55b33e4fb8ff4c7a6292b80b194cf83b10577 Mon Sep 17 00:00:00 2001 From: bjws Date: Sun, 13 Sep 2020 12:57:06 +0200 Subject: [PATCH 3/4] Fix ct install --- charts/media-common/ci/ct-values.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/charts/media-common/ci/ct-values.yaml b/charts/media-common/ci/ct-values.yaml index 477de624..d4e748eb 100644 --- a/charts/media-common/ci/ct-values.yaml +++ b/charts/media-common/ci/ct-values.yaml @@ -20,3 +20,11 @@ openvpn: networkPolicy: enabled: false + + livenessProbe: + initialDelaySeconds: 10 + periodSeconds: 10 + exec: + command: + - echo + - success From a037936b3e68cec48cdc8eb5d5cebd7264658308 Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Sun, 13 Sep 2020 07:09:14 -0500 Subject: [PATCH 4/4] [statping] New Chart (#36) Co-authored-by: Devin Buhl --- .gitignore | 2 + charts/statping/.helmignore | 23 +++ charts/statping/Chart.yaml | 22 +++ charts/statping/OWNERS | 4 + charts/statping/README.md | 37 ++++ charts/statping/templates/NOTES.txt | 21 +++ charts/statping/templates/_helpers.tpl | 62 +++++++ charts/statping/templates/deployment.yaml | 166 +++++++++++++++++ charts/statping/templates/externalsecret.yaml | 14 ++ charts/statping/templates/hpa.yaml | 28 +++ charts/statping/templates/ingress.yaml | 41 +++++ charts/statping/templates/postgres.yaml | 13 ++ charts/statping/templates/pvc.yaml | 15 ++ charts/statping/templates/secret.yaml | 13 ++ charts/statping/templates/service.yaml | 15 ++ charts/statping/templates/serviceaccount.yaml | 12 ++ .../templates/tests/test-connection.yaml | 15 ++ charts/statping/values.yaml | 167 ++++++++++++++++++ 18 files changed, 670 insertions(+) create mode 100644 charts/statping/.helmignore create mode 100644 charts/statping/Chart.yaml create mode 100644 charts/statping/OWNERS create mode 100644 charts/statping/README.md create mode 100644 charts/statping/templates/NOTES.txt create mode 100644 charts/statping/templates/_helpers.tpl create mode 100644 charts/statping/templates/deployment.yaml create mode 100644 charts/statping/templates/externalsecret.yaml create mode 100644 charts/statping/templates/hpa.yaml create mode 100644 charts/statping/templates/ingress.yaml create mode 100644 charts/statping/templates/postgres.yaml create mode 100644 charts/statping/templates/pvc.yaml create mode 100644 charts/statping/templates/secret.yaml create mode 100644 charts/statping/templates/service.yaml create mode 100644 charts/statping/templates/serviceaccount.yaml create mode 100644 charts/statping/templates/tests/test-connection.yaml create mode 100644 charts/statping/values.yaml diff --git a/.gitignore b/.gitignore index e58e5a29..b316b296 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .env .idea +charts/*/Chart.lock +charts/*/charts \ No newline at end of file diff --git a/charts/statping/.helmignore b/charts/statping/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/charts/statping/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/statping/Chart.yaml b/charts/statping/Chart.yaml new file mode 100644 index 00000000..80181c5d --- /dev/null +++ b/charts/statping/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: statping +description: Status page for monitoring your websites and applications +type: application +version: 1.0.0 +appVersion: v0.90.65 +keywords: + - statping + - status + - status-page +home: https://github.com/k8s-at-home/charts/tree/master/charts/statping +sources: + - https://github.com/statping/statping +maintainers: + - name: DirtyCajunRice + email: nick@cajun.pro +icon: https://github.com/statping/statping/blob/dev/frontend/src/assets/logo.png?raw=true +dependencies: + - name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 9.4.0 + condition: postgres.posgresql.enabled diff --git a/charts/statping/OWNERS b/charts/statping/OWNERS new file mode 100644 index 00000000..2eb39f10 --- /dev/null +++ b/charts/statping/OWNERS @@ -0,0 +1,4 @@ +approvers: +- DirtyCajunRice +reviewers: +- DirtyCajunRice diff --git a/charts/statping/README.md b/charts/statping/README.md new file mode 100644 index 00000000..97574974 --- /dev/null +++ b/charts/statping/README.md @@ -0,0 +1,37 @@ +# statping | Status page for monitoring your websites and applications + +## TL;DR +```console +$ helm repo add k8s-at-home https://k8s-at-home.com/charts/ +$ helm install k8s-at-home/statping +``` + +## Installing the Chart +To install the chart with the release name `statping`: +```console +helm install statping k8s-at-home/statping +``` + +## Uninstalling the Chart +To uninstall the `statping` deployment: +```console +helm uninstall statping +``` +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration +Read through the [values.yaml](https://github.com/k8s-at-home/charts/blob/master/charts/statping/values.yaml) +file. It has several commented out suggested values. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, +```console +helm install statping \ + --set statping.env.TZ="America/New York" \ + k8s-at-home/statping +``` +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the +chart. For example, +```console +helm install statping k8s-at-home/statping --values values.yaml +``` + diff --git a/charts/statping/templates/NOTES.txt b/charts/statping/templates/NOTES.txt new file mode 100644 index 00000000..9eaac7b7 --- /dev/null +++ b/charts/statping/templates/NOTES.txt @@ -0,0 +1,21 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "statping.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 "statping.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "statping.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 "statping.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 }} diff --git a/charts/statping/templates/_helpers.tpl b/charts/statping/templates/_helpers.tpl new file mode 100644 index 00000000..ed6ac8c5 --- /dev/null +++ b/charts/statping/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "statping.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 "statping.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 "statping.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "statping.labels" -}} +helm.sh/chart: {{ include "statping.chart" . }} +{{ include "statping.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "statping.selectorLabels" -}} +app.kubernetes.io/name: {{ include "statping.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "statping.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "statping.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/statping/templates/deployment.yaml b/charts/statping/templates/deployment.yaml new file mode 100644 index 00000000..ecf4620f --- /dev/null +++ b/charts/statping/templates/deployment.yaml @@ -0,0 +1,166 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "statping.fullname" . }} + labels: + {{- include "statping.labels" . | nindent 4 }} +spec: +{{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} +{{- end }} + selector: + matchLabels: + {{- include "statping.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "statping.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "statping.serviceAccountName" . }} + {{- with .Values.podSecurityContext }} + securityContext: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + {{- with .Values.securityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- if .Values.statping.name }} + - name: NAME + value: {{ .Values.statping.name | quote }} + {{- end }} + {{- if .Values.statping.description }} + - name: DESCRIPTION + value: {{ .Values.statping.description | quote }} + {{- end }} + {{- if .Values.statping.domain }} + - name: DOMAIN + value: {{ .Values.statping.domain | quote }} + {{- end }} + - name: ADMIN_USER + valueFrom: + secretKeyRef: + {{- if .Values.statping.admin.existingSecret.enabled }} + name: {{ .Values.statping.admin.existingSecret.name | quote }} + key: {{ .Values.statping.admin.existingSecret.userKey | default "admin-user" }} + {{- else }} + name: {{ include "statping.fullname" . }} + key: admin-user + {{- end }} + - name: ADMIN_PASSWORD + valueFrom: + secretKeyRef: + {{- if .Values.statping.admin.existingSecret.enabled }} + name: {{ .Values.statping.admin.existingSecret.name | quote }} + key: {{ .Values.statping.admin.existingSecret.passwordKey | default "admin-password" }} + {{- else }} + name: {{ include "statping.fullname" . }} + key: admin-password + {{- end }} + - name: ADMIN_EMAIL + valueFrom: + secretKeyRef: + {{- if .Values.statping.admin.existingSecret.enabled }} + name: {{ .Values.statping.admin.existingSecret.name | quote }} + key: {{ .Values.statping.admin.existingSecret.emailKey | default "admin-email" }} + {{- else }} + name: {{ include "statping.fullname" . }} + key: admin-email + {{- end }} + {{- if and (eq .Values.postgres.type "kubedb") .Values.postgres.kubedb.enabled }} + - name: DB_CONN + value: postgres + - name: DB_HOST + value: postgres-{{ template "statping.fullname" . }} + - name: DB_DATABASE + value: postgres + - name: DB_USER + valueFrom: + secretKeyRef: + name: postgres-{{ template "statping.fullname" . }}-auth + key: POSTGRES_USER + - name: DB_PASS + valueFrom: + secretKeyRef: + name: postgres-{{ template "statping.fullname" . }}-auth + key: POSTGRES_PASSWORD + {{- end }} + {{- if and (eq .Values.postgres.type "postgresql") .Values.postgres.posgresql.enabled }} + - name: DB_CONN + value: postgres + - name: DB_HOST + value: {{ template "postgresql.fullname" . }}-postgresql + - name: DB_DATABASE + value: {{ template "postgresql.database" . }} + - name: DB_USER + value: {{ template "postgresql.username" . }} + - name: DB_PASS + valueFrom: + secretKeyRef: + name: {{ template "postgresql.secretName" . }}-postgresql + key: postgresql-password + {{- end }} + {{- with .Values.env }} + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + - name: http + containerPort: 8080 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + volumeMounts: + - mountPath: /app + name: config + {{- if .Values.persistence.subPath }} + subPath: {{ .Values.persistence.subPath }} + {{- end }} + {{- if .Values.additionalVolumeMounts }} + {{- toYaml .Values.additionalVolumes | nindent 12 }} + {{- end }} + {{- with .Values.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + volumes: + - name: config + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "statping.fullname" . }}{{- end }} + {{- else }} + emptyDir: {} + {{- end }} + {{- if .Values.additionalVolumes }} + {{- toYaml .Values.additionalVolumes | 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 }} diff --git a/charts/statping/templates/externalsecret.yaml b/charts/statping/templates/externalsecret.yaml new file mode 100644 index 00000000..f86d7669 --- /dev/null +++ b/charts/statping/templates/externalsecret.yaml @@ -0,0 +1,14 @@ +{{- if and .Values.externalSecret.enabled (eq .Values.externalSecret.type "kubernetes-external-secrets") }} +apiVersion: kubernetes-client.io/v1 +kind: ExternalSecret +metadata: + name: {{ include "statping.fullname" . }} +spec: + {{- with .Values.externalSecret.kubernetesExternalSecrets.spec }} + {{- toYaml . | nindent 2 }} + {{- end }} + data: + {{- with .Values.externalSecret.kubernetesExternalSecrets.data }} + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/statping/templates/hpa.yaml b/charts/statping/templates/hpa.yaml new file mode 100644 index 00000000..d1c69189 --- /dev/null +++ b/charts/statping/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "statping.fullname" . }} + labels: + {{- include "statping.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "statping.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/statping/templates/ingress.yaml b/charts/statping/templates/ingress.yaml new file mode 100644 index 00000000..e2bc17ed --- /dev/null +++ b/charts/statping/templates/ingress.yaml @@ -0,0 +1,41 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "statping.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "statping.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + backend: + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} diff --git a/charts/statping/templates/postgres.yaml b/charts/statping/templates/postgres.yaml new file mode 100644 index 00000000..65f7f188 --- /dev/null +++ b/charts/statping/templates/postgres.yaml @@ -0,0 +1,13 @@ +{{- if and .Values.postgres.enabled (eq .Values.postgres.type "kubedb") }} +apiVersion: kubedb.com/v1alpha1 +kind: Postgres +metadata: + name: postgres-{{ template "statping.fullname" . }} +spec: + version: {{ .Values.postgres.kubedb.version }} + storageType: {{ .Values.postgres.kubedb.storageType }} + {{- with .Values.postgres.kubedb.storage }} + storage: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/statping/templates/pvc.yaml b/charts/statping/templates/pvc.yaml new file mode 100644 index 00000000..f999ded8 --- /dev/null +++ b/charts/statping/templates/pvc.yaml @@ -0,0 +1,15 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "statping.fullname" . }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} + {{- if .Values.persistence.storageClass }} + storageClassName: {{ .Values.persistence.storageClass | quote }} + {{- end }} +{{- end -}} \ No newline at end of file diff --git a/charts/statping/templates/secret.yaml b/charts/statping/templates/secret.yaml new file mode 100644 index 00000000..3e7685b3 --- /dev/null +++ b/charts/statping/templates/secret.yaml @@ -0,0 +1,13 @@ +{{- if not .Values.statping.admin.existingSecret.enabled }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "statping.fullname" . }} + labels: + {{- include "statping.labels" . | nindent 4 }} +type: Opaque +data: + admin-user: {{ default "admin" .Values.statping.admin.user | b64enc | quote }} + admin-password: {{ randAlphaNum 16 | b64enc | quote }} + admin-email: {{ default "info@admin.com" .Values.statping.admin.email | b64enc | quote}} +{{- end }} \ No newline at end of file diff --git a/charts/statping/templates/service.yaml b/charts/statping/templates/service.yaml new file mode 100644 index 00000000..06b4a08a --- /dev/null +++ b/charts/statping/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "statping.fullname" . }} + labels: + {{- include "statping.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "statping.selectorLabels" . | nindent 4 }} diff --git a/charts/statping/templates/serviceaccount.yaml b/charts/statping/templates/serviceaccount.yaml new file mode 100644 index 00000000..0824d3ad --- /dev/null +++ b/charts/statping/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "statping.serviceAccountName" . }} + labels: + {{- include "statping.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/statping/templates/tests/test-connection.yaml b/charts/statping/templates/tests/test-connection.yaml new file mode 100644 index 00000000..8891a2bf --- /dev/null +++ b/charts/statping/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "statping.fullname" . }}-test-connection" + labels: + {{- include "statping.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "statping.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/charts/statping/values.yaml b/charts/statping/values.yaml new file mode 100644 index 00000000..13674056 --- /dev/null +++ b/charts/statping/values.yaml @@ -0,0 +1,167 @@ +# Default values for statping. + +image: + repository: statping/statping + pullPolicy: IfNotPresent + tag: "" + +global: + postgresql: + postgresqlDatabase: "postgres" + postgresqlUsername: "postgres" + +statping: + name: "" + description: "" + domain: "" + admin: + user: "" + password: "" + email: "" + existingSecret: + enabled: false + name: "" + userKey: "" + passwordKey: "" + emailKey: "" + +# Probes configuration +probes: + liveness: + initialDelaySeconds: 60 + failureThreshold: 5 + timeoutSeconds: 10 + readiness: + initialDelaySeconds: 60 + failureThreshold: 5 + timeoutSeconds: 10 + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +env: [] + +service: + type: ClusterIP + port: 8080 + ## Specify the nodePort value for the LoadBalancer and NodePort service types. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + ## + # nodePort: + ## Provide any additional annotations which may be required. This can be used to + ## set the LoadBalancer service type to internal only. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer + ## + annotations: {} + labels: {} + additionalSpec: {} + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + labels: {} + hosts: + - host: chart-example.local + paths: + - / + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +persistence: + enabled: true + ## statping configuration data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + # subPath: some-subpath + accessMode: ReadWriteOnce + size: 1Gi + ## Do not delete the pvc upon helm uninstall + skipuninstall: false + +postgres: + type: postgresql + kubedb: + enabled: false + version: 11.1 + storageType: Durable + storage: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + posgresql: + enabled: true + # See https://github.com/bitnami/charts/tree/master/bitnami/postgresql for configuration + +externalSecret: + enabled: false + type: kubernetes-external-secrets + kubernetesExternalSecrets: + spec: {} + data: [] + +additionalVolumes: [] + +additionalVolumeMounts: [] + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 3 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +podSecurityContext: {} +# fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true +# runAsNonRoot: true +# runAsUser: 1000 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +podAnnotations: {}