From 9234285868dd14959767d37b03bbfc10dd4743e7 Mon Sep 17 00:00:00 2001 From: Alex Manning Date: Tue, 14 Feb 2023 18:02:08 +0000 Subject: [PATCH] Add chart for mariadb, update whatsapp. --- charts/mariadb/.helmignore | 23 ++++++++ charts/mariadb/Chart.yaml | 24 ++++++++ charts/mariadb/templates/_helpers.tpl | 51 ++++++++++++++++ charts/mariadb/templates/pvc.yaml | 16 +++++ charts/mariadb/templates/service.yaml | 15 +++++ charts/mariadb/templates/statefulset.yaml | 72 +++++++++++++++++++++++ charts/mariadb/values.yaml | 65 ++++++++++++++++++++ charts/mautrix-whatsapp/Chart.yaml | 4 +- charts/node-red/templates/deployment.yaml | 2 + 9 files changed, 270 insertions(+), 2 deletions(-) create mode 100644 charts/mariadb/.helmignore create mode 100644 charts/mariadb/Chart.yaml create mode 100644 charts/mariadb/templates/_helpers.tpl create mode 100644 charts/mariadb/templates/pvc.yaml create mode 100644 charts/mariadb/templates/service.yaml create mode 100644 charts/mariadb/templates/statefulset.yaml create mode 100644 charts/mariadb/values.yaml diff --git a/charts/mariadb/.helmignore b/charts/mariadb/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/mariadb/.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/mariadb/Chart.yaml b/charts/mariadb/Chart.yaml new file mode 100644 index 0000000..bb9aade --- /dev/null +++ b/charts/mariadb/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: mariadb +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +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.1.0 + +# 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: "10.6.10" diff --git a/charts/mariadb/templates/_helpers.tpl b/charts/mariadb/templates/_helpers.tpl new file mode 100644 index 0000000..ea11019 --- /dev/null +++ b/charts/mariadb/templates/_helpers.tpl @@ -0,0 +1,51 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "mariadb.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 "mariadb.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 "mariadb.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "mariadb.labels" -}} +helm.sh/chart: {{ include "mariadb.chart" . }} +{{ include "mariadb.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "mariadb.selectorLabels" -}} +app.kubernetes.io/name: {{ include "mariadb.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/charts/mariadb/templates/pvc.yaml b/charts/mariadb/templates/pvc.yaml new file mode 100644 index 0000000..fee36f5 --- /dev/null +++ b/charts/mariadb/templates/pvc.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "mariadb.fullname" . }} + labels: + {{- include "mariadb.labels" . | nindent 4 }} + annotations: + helm.sh/resource-policy: "keep" +spec: + accessModes: + - ReadWriteOnce + storageClassName: {{ .Values.pvc.storageClassName | quote }} + resources: + requests: + storage: {{ .Values.pvc.storage | quote }} diff --git a/charts/mariadb/templates/service.yaml b/charts/mariadb/templates/service.yaml new file mode 100644 index 0000000..463952d --- /dev/null +++ b/charts/mariadb/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "mariadb.fullname" . }} + labels: + {{- include "mariadb.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: mysql + protocol: TCP + name: mysql + selector: + {{- include "mariadb.selectorLabels" . | nindent 4 }} diff --git a/charts/mariadb/templates/statefulset.yaml b/charts/mariadb/templates/statefulset.yaml new file mode 100644 index 0000000..54cd465 --- /dev/null +++ b/charts/mariadb/templates/statefulset.yaml @@ -0,0 +1,72 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "mariadb.fullname" . }} + labels: + {{- include "mariadb.labels" . | nindent 4 }} +spec: + replicas: 1 + serviceName: {{ include "mariadb.fullname" . }} + selector: + matchLabels: + {{- include "mariadb.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "mariadb.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + 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 }} + ports: + - name: mysql + containerPort: 3306 + protocol: TCP + startupProbe: + tcpSocket: + port: mysql + failureThreshold: 30 + periodSeconds: 10 + livenessProbe: + tcpSocket: + port: mysql + readinessProbe: + initialDelaySeconds: 60 + tcpSocket: + port: mysql + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + {{- toYaml .Values.envVars | nindent 12 }} + volumeMounts: + - name: data + mountPath: /config + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: data + persistentVolumeClaim: + claimName: {{ include "mariadb.fullname" . }} diff --git a/charts/mariadb/values.yaml b/charts/mariadb/values.yaml new file mode 100644 index 0000000..55f9c9e --- /dev/null +++ b/charts/mariadb/values.yaml @@ -0,0 +1,65 @@ +# Default values for mariadb. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +image: + repository: docker.io/linuxserver/mariadb + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +podAnnotations: {} + +podSecurityContext: + fsGroup: 911 + +securityContext: {} +#capabilities: +# drop: +# - ALL + # readOnlyRootFilesystem: true + #runAsNonRoot: true + #runAsUser: 911 + +service: + type: ClusterIP + port: 3306 + +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: {} + +pvc: + storage: 10Gi + storageClassName: "" + +envVars: + # Docs: https://docs.linuxserver.io/images/docker-mariadb + - name: MYSQL_ROOT_PASSWORD + value: "" + - name: TZ + value: Europe/London + - name: MYSQL_DATABASE + value: "" + - name: MYSQL_USER + value: "" + - name: MYSQL_PASSWORD + value: "" diff --git a/charts/mautrix-whatsapp/Chart.yaml b/charts/mautrix-whatsapp/Chart.yaml index f781f36..b82e511 100644 --- a/charts/mautrix-whatsapp/Chart.yaml +++ b/charts/mautrix-whatsapp/Chart.yaml @@ -6,10 +6,10 @@ 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.1.0 +version: 1.0.0 # 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: "v0.8.0" +appVersion: "v0.8.1" diff --git a/charts/node-red/templates/deployment.yaml b/charts/node-red/templates/deployment.yaml index 3c33776..282288e 100644 --- a/charts/node-red/templates/deployment.yaml +++ b/charts/node-red/templates/deployment.yaml @@ -6,6 +6,8 @@ metadata: {{- include "node-red.labels" . | nindent 4 }} spec: replicas: 1 + strategy: + type: Recreate selector: matchLabels: {{- include "node-red.selectorLabels" . | nindent 6 }}