diff --git a/apps-helm/drupal/.helmignore b/apps-helm/drupal/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/apps-helm/drupal/.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/apps-helm/drupal/Chart.yaml b/apps-helm/drupal/Chart.yaml new file mode 100644 index 0000000..9924eff --- /dev/null +++ b/apps-helm/drupal/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: drupal +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: "1.16.0" diff --git a/apps-helm/drupal/templates/_helpers.tpl b/apps-helm/drupal/templates/_helpers.tpl new file mode 100644 index 0000000..e134a2b --- /dev/null +++ b/apps-helm/drupal/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "drupal.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 "drupal.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 "drupal.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "drupal.labels" -}} +helm.sh/chart: {{ include "drupal.chart" . }} +{{ include "drupal.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "drupal.selectorLabels" -}} +app.kubernetes.io/name: {{ include "drupal.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "drupal.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "drupal.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/apps-helm/drupal/templates/deployment.yaml b/apps-helm/drupal/templates/deployment.yaml new file mode 100644 index 0000000..640b8cb --- /dev/null +++ b/apps-helm/drupal/templates/deployment.yaml @@ -0,0 +1,91 @@ +{{- $fullName := include "drupal.fullname" . -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "drupal.fullname" . }} + labels: + {{- include "drupal.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "drupal.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "drupal.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "drupal.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + initContainers: + - name: init-sites-volume + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + command: ['/bin/bash', '-c'] + args: ['cp -r /var/www/html/sites/ /data/; chown www-data:www-data /data/ -R'] + volumeMounts: + - mountPath: /data + name: data + 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: http + containerPort: 80 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - mountPath: /var/www/html/modules + name: data + subPath: modules + - mountPath: /var/www/html/profiles + name: data + subPath: profiles + - mountPath: /var/www/html/sites + name: data + subPath: sites + - mountPath: /var/www/html/themes + name: data + subPath: themes + volumes: + - name: data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default ( print $fullName "-data") }} + {{- else }} + emptyDir: {} + {{- 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/apps-helm/drupal/templates/hpa.yaml b/apps-helm/drupal/templates/hpa.yaml new file mode 100644 index 0000000..0ef0b99 --- /dev/null +++ b/apps-helm/drupal/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "drupal.fullname" . }} + labels: + {{- include "drupal.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "drupal.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/apps-helm/drupal/templates/ingress.yaml b/apps-helm/drupal/templates/ingress.yaml new file mode 100644 index 0000000..0afab72 --- /dev/null +++ b/apps-helm/drupal/templates/ingress.yaml @@ -0,0 +1,63 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "drupal.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else 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 "drupal.labels" . | indent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: +{{- if .Values.ingress.ingressClassName }} + ingressClassName: {{ .Values.ingress.ingressClassName }} +{{- end }} +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + backend: + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + pathType: ImplementationSpecific + {{- end }} + {{- end -}} + {{- else -}} + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + backend: + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end -}} +{{- end }} \ No newline at end of file diff --git a/apps-helm/drupal/templates/pvc.yaml b/apps-helm/drupal/templates/pvc.yaml new file mode 100644 index 0000000..2808993 --- /dev/null +++ b/apps-helm/drupal/templates/pvc.yaml @@ -0,0 +1,22 @@ +{{- if .Values.persistence.enabled -}} +{{- $fullName := include "drupal.fullname" . -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + labels: + {{- include "drupal.labels" . | nindent 4 }} + name: {{ $fullName }}-data +spec: + accessModes: + - ReadWriteOnce +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} + resources: + requests: + storage: {{ .Values.persistence.size }} +{{ end }} diff --git a/apps-helm/drupal/templates/service.yaml b/apps-helm/drupal/templates/service.yaml new file mode 100644 index 0000000..237a46e --- /dev/null +++ b/apps-helm/drupal/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "drupal.fullname" . }} + labels: + {{- include "drupal.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "drupal.selectorLabels" . | nindent 4 }} diff --git a/apps-helm/drupal/templates/serviceaccount.yaml b/apps-helm/drupal/templates/serviceaccount.yaml new file mode 100644 index 0000000..f7329e2 --- /dev/null +++ b/apps-helm/drupal/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "drupal.serviceAccountName" . }} + labels: + {{- include "drupal.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/apps-helm/drupal/templates/tests/test-connection.yaml b/apps-helm/drupal/templates/tests/test-connection.yaml new file mode 100644 index 0000000..40be4fc --- /dev/null +++ b/apps-helm/drupal/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "drupal.fullname" . }}-test-connection" + labels: + {{- include "drupal.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "drupal.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/apps-helm/drupal/values.yaml b/apps-helm/drupal/values.yaml new file mode 100644 index 0000000..45c1504 --- /dev/null +++ b/apps-helm/drupal/values.yaml @@ -0,0 +1,86 @@ +# Default values for drupal. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: nginx + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +persistence: + enabled: false + size: 1Gi + +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: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +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: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/apps-helm/uptime-kuma/.helmignore b/apps-helm/uptime-kuma/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/apps-helm/uptime-kuma/.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/apps-helm/uptime-kuma/Chart.yaml b/apps-helm/uptime-kuma/Chart.yaml new file mode 100644 index 0000000..7a936c6 --- /dev/null +++ b/apps-helm/uptime-kuma/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: uptime-kuma +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: "1.16.0" diff --git a/apps-helm/uptime-kuma/templates/NOTES.txt b/apps-helm/uptime-kuma/templates/NOTES.txt new file mode 100644 index 0000000..823a375 --- /dev/null +++ b/apps-helm/uptime-kuma/templates/NOTES.txt @@ -0,0 +1,22 @@ +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 "uptime-kuma.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 "uptime-kuma.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "uptime-kuma.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 "uptime-kuma.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 }} diff --git a/apps-helm/uptime-kuma/templates/_helpers.tpl b/apps-helm/uptime-kuma/templates/_helpers.tpl new file mode 100644 index 0000000..1c0fa87 --- /dev/null +++ b/apps-helm/uptime-kuma/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "uptime-kuma.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 "uptime-kuma.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 "uptime-kuma.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "uptime-kuma.labels" -}} +helm.sh/chart: {{ include "uptime-kuma.chart" . }} +{{ include "uptime-kuma.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "uptime-kuma.selectorLabels" -}} +app.kubernetes.io/name: {{ include "uptime-kuma.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "uptime-kuma.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "uptime-kuma.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/apps-helm/uptime-kuma/templates/deployment.yaml b/apps-helm/uptime-kuma/templates/deployment.yaml new file mode 100644 index 0000000..d7b5d8f --- /dev/null +++ b/apps-helm/uptime-kuma/templates/deployment.yaml @@ -0,0 +1,73 @@ +{{- $fullName := include "uptime-kuma.fullname" . -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "uptime-kuma.fullname" . }} + labels: + {{- include "uptime-kuma.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "uptime-kuma.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "uptime-kuma.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "uptime-kuma.serviceAccountName" . }} + 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: http + containerPort: 3001 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - mountPath: /app/data + name: data + volumes: + - name: data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default ( print $fullName "-data") }} + {{- else }} + emptyDir: {} + {{- 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/apps-helm/uptime-kuma/templates/hpa.yaml b/apps-helm/uptime-kuma/templates/hpa.yaml new file mode 100644 index 0000000..85ec823 --- /dev/null +++ b/apps-helm/uptime-kuma/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "uptime-kuma.fullname" . }} + labels: + {{- include "uptime-kuma.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "uptime-kuma.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/apps-helm/uptime-kuma/templates/ingress.yaml b/apps-helm/uptime-kuma/templates/ingress.yaml new file mode 100644 index 0000000..4fd4a66 --- /dev/null +++ b/apps-helm/uptime-kuma/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "uptime-kuma.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else 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 "uptime-kuma.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- 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 }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/apps-helm/uptime-kuma/templates/pvc.yaml b/apps-helm/uptime-kuma/templates/pvc.yaml new file mode 100755 index 0000000..7d9b153 --- /dev/null +++ b/apps-helm/uptime-kuma/templates/pvc.yaml @@ -0,0 +1,22 @@ +{{- if .Values.persistence.enabled -}} +{{- $fullName := include "uptime-kuma.fullname" . -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + labels: + {{- include "uptime-kuma.labels" . | nindent 4 }} + name: {{ $fullName }}-data +spec: + accessModes: + - ReadWriteOnce +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} + resources: + requests: + storage: {{ .Values.persistence.size }} +{{ end }} diff --git a/apps-helm/uptime-kuma/templates/service.yaml b/apps-helm/uptime-kuma/templates/service.yaml new file mode 100644 index 0000000..44238ac --- /dev/null +++ b/apps-helm/uptime-kuma/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "uptime-kuma.fullname" . }} + labels: + {{- include "uptime-kuma.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "uptime-kuma.selectorLabels" . | nindent 4 }} diff --git a/apps-helm/uptime-kuma/templates/serviceaccount.yaml b/apps-helm/uptime-kuma/templates/serviceaccount.yaml new file mode 100644 index 0000000..77a13d3 --- /dev/null +++ b/apps-helm/uptime-kuma/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "uptime-kuma.serviceAccountName" . }} + labels: + {{- include "uptime-kuma.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/apps-helm/uptime-kuma/templates/tests/test-connection.yaml b/apps-helm/uptime-kuma/templates/tests/test-connection.yaml new file mode 100644 index 0000000..af42e7b --- /dev/null +++ b/apps-helm/uptime-kuma/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "uptime-kuma.fullname" . }}-test-connection" + labels: + {{- include "uptime-kuma.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "uptime-kuma.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/apps-helm/uptime-kuma/values.yaml b/apps-helm/uptime-kuma/values.yaml new file mode 100644 index 0000000..86220de --- /dev/null +++ b/apps-helm/uptime-kuma/values.yaml @@ -0,0 +1,86 @@ +# Default values for uptime-kuma. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: louislam/uptime-kuma + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "1-alpine" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +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: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +persistence: + enabled: false + size: 1Gi + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +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: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/apps-kustomized/bucket/cephobjectstore.yaml b/apps-kustomized/bucket/cephobjectstore.yaml new file mode 100644 index 0000000..4e0cd84 --- /dev/null +++ b/apps-kustomized/bucket/cephobjectstore.yaml @@ -0,0 +1,19 @@ +apiVersion: ceph.rook.io/v1 +kind: CephObjectStore +metadata: + name: bucketstore +spec: + metadataPool: + failureDomain: host + replicated: + size: 1 + dataPool: + failureDomain: host + replicated: + size: 1 + preservePoolsOnDelete: true + gateway: + sslCertificateRef: + port: 80 + # securePort: 443 + instances: 1 diff --git a/apps-kustomized/bucket/ingress.yaml b/apps-kustomized/bucket/ingress.yaml new file mode 100644 index 0000000..4243997 --- /dev/null +++ b/apps-kustomized/bucket/ingress.yaml @@ -0,0 +1,40 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + cert-manager.io/cluster-issuer: letsencrypt + external-dns.alpha.kubernetes.io/target: armnleg.martyn.berlin + kubernetes.io/ingress.class: nginx + nginx.ingress.kubernetes.io/proxy-body-size: 2000m + labels: + app.kubernetes.io/name: writefreely + name: files-s3 +spec: + rules: + - host: files.martyn.berlin + http: + paths: + - backend: + service: + name: rook-ceph-rgw-bucketstore-external + port: + number: 80 + path: / + pathType: Prefix + - host: files-a89a4194-3742-498e-8c6c-37128fdb9291.martyn.berlin + http: + paths: + - backend: + service: + name: rook-ceph-rgw-bucketstore-external + port: + number: 80 + path: / + pathType: Prefix + tls: + - hosts: + - files.martyn.berlin + secretName: files-tls + - hosts: + - files-a89a4194-3742-498e-8c6c-37128fdb9291.martyn.berlin + secretName: long-name-files-tls diff --git a/apps-kustomized/bucket/objectbucketclaim.yaml b/apps-kustomized/bucket/objectbucketclaim.yaml new file mode 100644 index 0000000..9b6ae07 --- /dev/null +++ b/apps-kustomized/bucket/objectbucketclaim.yaml @@ -0,0 +1,54 @@ +apiVersion: objectbucket.io/v1alpha1 +kind: ObjectBucketClaim +metadata: + name: ceph-bucket +spec: + generateBucketName: files + storageClassName: rook-ceph-bucket +--- +apiVersion: objectbucket.io/v1alpha1 +kind: ObjectBucketClaim +metadata: + name: ceph-bucket-blog +spec: + bucketName: blog + storageClassName: rook-ceph-bucket +--- +apiVersion: objectbucket.io/v1alpha1 +kind: ObjectBucketClaim +metadata: + name: ceph-bucket-blogimages +spec: + bucketName: blogimages + storageClassName: rook-ceph-bucket +--- +apiVersion: objectbucket.io/v1alpha1 +kind: ObjectBucketClaim +metadata: + name: ceph-bucket-photos +spec: + bucketName: photos + storageClassName: rook-ceph-bucket +--- +apiVersion: objectbucket.io/v1alpha1 +kind: ObjectBucketClaim +metadata: + name: ceph-bucket-proxyput +spec: + bucketName: proxyput + storageClassName: rook-ceph-bucket +--- +apiVersion: objectbucket.io/v1alpha1 +kind: ObjectBucketClaim +metadata: + name: ceph-bucket-testy +spec: + bucketName: testy +--- +apiVersion: objectbucket.io/v1alpha1 +kind: ObjectBucketClaim +metadata: + name: ceph-bucket-video +spec: + bucketName: video + storageClassName: rook-ceph-bucket \ No newline at end of file diff --git a/apps-kustomized/bucket/service.yaml b/apps-kustomized/bucket/service.yaml new file mode 100644 index 0000000..be7d0a5 --- /dev/null +++ b/apps-kustomized/bucket/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: rook-ceph-rgw-bucketstore-external + labels: + app: rook-ceph-rgw + rook_cluster: rook-ceph + rook_object_store: bucketstore +spec: + ports: + - name: rgw + port: 80 + protocol: TCP + targetPort: 8080 + selector: + app: rook-ceph-rgw + rook_cluster: rook-ceph + rook_object_store: bucketstore + sessionAffinity: None + type: LoadBalancer diff --git a/apps-kustomized/bucket/storageclass.yaml b/apps-kustomized/bucket/storageclass.yaml new file mode 100644 index 0000000..4d053ae --- /dev/null +++ b/apps-kustomized/bucket/storageclass.yaml @@ -0,0 +1,10 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: rook-ceph-bucket +# Change "rook-ceph" provisioner prefix to match the operator namespace if needed +provisioner: rook-ceph.ceph.rook.io/bucket +reclaimPolicy: Retain +parameters: + objectStoreName: bucketstore + objectStoreNamespace: rook-ceph \ No newline at end of file diff --git a/everything-app/bikerwitch.yaml b/everything-app/bikerwitch.yaml new file mode 100644 index 0000000..e78625c --- /dev/null +++ b/everything-app/bikerwitch.yaml @@ -0,0 +1,45 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: bikerwitch + namespace: argocd +spec: + destination: + namespace: bikerwitch + server: https://kubernetes.default.svc + project: default + source: + helm: + parameters: + - name: service.type + value: LoadBalancer + - name: persistence.enabled + value: "true" + - name: persistence.storageClass + value: "rook-ceph-block-ssd" + - name: image.repository + value: drupal + - name: image.tag + value: 9.4-php8.0-apache + values: |- + ingress: + enabled: true + annotations: + cert-manager.io/cluster-issuer: letsencrypt + kubernetes.io/ingress.class: nginx + external-dns.alpha.kubernetes.io/target: armnleg.martyn.berlin + hosts: + - host: bikerwitch.martyn.berlin + paths: + - / + - host: www.bikerwitch.org.uk + paths: + - / + tls: + - secretName: bikerwitch-tls + hosts: + - bikerwitch.martyn.berlin + - www.bikerwitch.org.uk + path: apps-helm/drupal + repoURL: https://git.martyn.berlin/martyn/infra4talos.git + targetRevision: HEAD diff --git a/everything-app/bucket.yaml b/everything-app/bucket.yaml new file mode 100644 index 0000000..a3826ba --- /dev/null +++ b/everything-app/bucket.yaml @@ -0,0 +1,17 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: bucket + namespace: argocd +spec: + destination: + namespace: rook-ceph + server: https://kubernetes.default.svc + project: apps + source: + path: apps-kustomized/bucket + repoURL: https://git.martyn.berlin/martyn/infra4talos + targetRevision: HEAD + syncPolicy: + automated: + selfHeal: true diff --git a/everything-app/samba-rook-ssd.yaml b/everything-app/samba-rook-ssd.yaml new file mode 100644 index 0000000..3a1b402 --- /dev/null +++ b/everything-app/samba-rook-ssd.yaml @@ -0,0 +1,28 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: samba-rook-ssd + namespace: argocd +spec: + destination: + namespace: sambas + server: https://kubernetes.default.svc + project: infra + source: + helm: + parameters: + - name: image.tag + value: v1.0.2 + - name: service.type + value: LoadBalancer + - name: persistence.pvc.storageClass + value: rook-ceph-block-ssd + - name: persistance.pvc.size + value: 3.6Ti + values: "samba:\n users: \n - username: martyn\n password: \"564628\"" + path: apps-helm/samba4 + repoURL: https://git.martyn.berlin/martyn/infra4talos.git + targetRevision: HEAD + syncPolicy: + automated: + selfHeal: true diff --git a/everything-app/uptime-kuma.yaml b/everything-app/uptime-kuma.yaml new file mode 100644 index 0000000..701bd47 --- /dev/null +++ b/everything-app/uptime-kuma.yaml @@ -0,0 +1,22 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: uptime-kuma + namespace: argocd +spec: + destination: + namespace: uptime + server: https://kubernetes.default.svc + project: apps + source: + helm: + parameters: + - name: service.type + value: LoadBalancer + - name: persistence.enabled + value: "true" + - name: persistence.storageClass + value: rook-ceph-block-ssd + path: apps-helm/uptime-kuma + repoURL: https://git.martyn.berlin/martyn/infra4talos.git + targetRevision: HEAD