diff --git a/charts/gotify/Chart.yaml b/charts/gotify/Chart.yaml index 3a55c7b..00efe42 100644 --- a/charts/gotify/Chart.yaml +++ b/charts/gotify/Chart.yaml @@ -1,4 +1,6 @@ apiVersion: v2 +# TODO: reprendre ip-helm pour plus propre + name: gotify description: A Gotify Helm chart for Kubernetes @@ -15,10 +17,15 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.0.9 +version: 0.0.10 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. appVersion: "2.1.0" + +dependencies: +- name: common + repository: "https://scm.docker.cabillot.eu/perso/helm-library-common/raw/branch/master/" + version: 4.2.0 diff --git a/charts/gotify/templates/NOTES.txt b/charts/gotify/templates/NOTES.txt index 60d9f15..90f7b65 100644 --- a/charts/gotify/templates/NOTES.txt +++ b/charts/gotify/templates/NOTES.txt @@ -1,22 +1 @@ -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 }}{{ .path }} - {{- 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 "gotify.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 "gotify.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "gotify.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 "gotify.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT -{{- end }} +{{- include "common.notes.defaultNotes" . -}} diff --git a/charts/gotify/templates/_helpers.tpl b/charts/gotify/templates/_helpers.tpl deleted file mode 100644 index 20ca41f..0000000 --- a/charts/gotify/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "gotify.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 "gotify.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 "gotify.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "gotify.labels" -}} -helm.sh/chart: {{ include "gotify.chart" . }} -{{ include "gotify.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "gotify.selectorLabels" -}} -app.kubernetes.io/name: {{ include "gotify.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "gotify.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "gotify.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/charts/gotify/templates/common.yaml b/charts/gotify/templates/common.yaml new file mode 100644 index 0000000..64e027a --- /dev/null +++ b/charts/gotify/templates/common.yaml @@ -0,0 +1,5 @@ +{{/* Make sure all variables are set properly */}} +{{- include "common.values.setup" . }} + +{{/* Render the templates */}} +{{ include "common.all" . }} diff --git a/charts/gotify/templates/configmap.yaml b/charts/gotify/templates/configmap.yaml deleted file mode 100644 index 8cf45af..0000000 --- a/charts/gotify/templates/configmap.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "gotify.fullname" . }} - labels: - {{- include "gotify.labels" . | nindent 4 }} -{{- with .Values.env }} -data: - {{- toYaml . | nindent 2 }} -{{- end }} diff --git a/charts/gotify/templates/deployment.yaml b/charts/gotify/templates/deployment.yaml deleted file mode 100644 index b218138..0000000 --- a/charts/gotify/templates/deployment.yaml +++ /dev/null @@ -1,65 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "gotify.fullname" . }} - labels: - {{- include "gotify.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - # TODO: il manque strategy.type = RollingUpdate - selector: - matchLabels: - {{- include "gotify.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "gotify.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - automountServiceAccountToken: {{ .Values.automountServiceAccountToken }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - envFrom: - - configMapRef: - name: {{ include "gotify.fullname" . }} - - secretRef: - name: {{ include "gotify.fullname" . }} - ports: - - name: http - containerPort: 80 - protocol: TCP - livenessProbe: - httpGet: - path: / - port: http - readinessProbe: - httpGet: - path: / - port: http - {{- 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/gotify/templates/ingress.yaml b/charts/gotify/templates/ingress.yaml deleted file mode 100644 index 01ebdff..0000000 --- a/charts/gotify/templates/ingress.yaml +++ /dev/null @@ -1,40 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "gotify.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "gotify.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: {{ .path }} - pathType: Prefix - backend: - service: - name: {{ $fullName }} - port: - number: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} diff --git a/charts/gotify/templates/secrets.yaml b/charts/gotify/templates/secrets.yaml deleted file mode 100644 index 1ac6e1a..0000000 --- a/charts/gotify/templates/secrets.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: {{ include "gotify.fullname" . }} - labels: - {{- include "gotify.labels" . | nindent 4 }} -type: Opaque -data: - user: {{ .Values.user | b64enc | quote }} - pass: {{ .Values.pass | b64enc | quote }} diff --git a/charts/gotify/templates/service.yaml b/charts/gotify/templates/service.yaml deleted file mode 100644 index d0edd4d..0000000 --- a/charts/gotify/templates/service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "gotify.fullname" . }} - labels: - {{- include "gotify.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "gotify.selectorLabels" . | nindent 4 }} diff --git a/charts/gotify/values.yaml b/charts/gotify/values.yaml index 569b7bd..8faff5f 100644 --- a/charts/gotify/values.yaml +++ b/charts/gotify/values.yaml @@ -1,100 +1,18 @@ -# Default values for gotify. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 +# +# IMPORTANT NOTE +# +# This chart inherits from our common library chart. You can check the default values/options here: +# https://scm.docker.cabillot.eu/perso/helm-library-common +# image: repository: docker.io/gotify/server - pullPolicy: Always # Overrides the image tag whose default is the chart appVersion. tag: "" + pullPolicy: Always -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" -automountServiceAccountToken: false - -user: "admin" -pass: "admin" - -serviceAccount: - # Specifies whether a service account should be created - create: false - # 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: "gotify" - -podAnnotations: {} - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: "ClusterIP" - port: 80 - -ingress: - enabled: false - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: - - path: / - backend: - serviceName: chart-example.local - servicePort: 80 - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -ingressroute: - enabled: false - host: 'chart-example.local' - adminauth: '' - tls: [] - annotations: {} - -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 - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 1 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} - -tolerations: [] - -affinity: {} - -# TODO: pv/pvc for sqlite env: + TZ: America/New_York GOTIFY_DATABASE_CONNECTION: data/gotify.db GOTIFY_DATABASE_DIALECT: sqlite3 GOTIFY_PASSSTRENGTH: "10" @@ -115,3 +33,23 @@ env: GOTIFY_SERVER_STREAM_PINGPERIODSECONDS: "45" GOTIFY_UPLOADEDIMAGESDIR: data/images TZ: America/New_York + +envFrom: +- secretRef: + name: {{ include "common.names.fullname" . }} + +secret: + user: "admin" + pass: "admin" + +service: + main: + ports: + http: + port: 80 + +ingress: + main: + enabled: false + +# TODO: pv/pvc for sqlite