feat(helm): add cloudhost-app Helm chart for all runtimes
- deployment.yaml with imagePullSecrets, health probes, WordPress volumes - db-deployment.yaml for PostgreSQL/MySQL with readiness/liveness probes - ingress.yaml with cert-manager TLS - registry-pull-secret.yaml for insecure registries - PVCs and secrets with helm.sh/resource-policy: keep - _helpers.tpl with shared template functions - values.yaml with comprehensive defaults
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
{{- $name := include "cloudhost-app.name" . -}}
|
||||
{{- $ns := include "cloudhost-app.namespace" . -}}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ $name }}
|
||||
namespace: {{ $ns }}
|
||||
labels:
|
||||
{{- include "cloudhost-app.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
kubernetes.io/change-cause: {{ .Values.changeCause | default (printf "Deploy %s" .Values.app.image) | quote }}
|
||||
spec:
|
||||
revisionHistoryLimit: 10
|
||||
replicas: {{ .Values.app.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "cloudhost-app.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "cloudhost-app.labels" . | nindent 8 }}
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: registry-pull-secret
|
||||
containers:
|
||||
- name: {{ $name }}
|
||||
image: {{ .Values.app.image | quote }}
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: {{ .Values.app.port }}
|
||||
{{- if and .Values.envVars (gt (len .Values.envVars) 0) }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ $name }}-env
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if and .Values.database.enabled (eq .Values.database.type "postgresql") }}
|
||||
- name: DB_HOST
|
||||
value: {{ include "cloudhost-app.dbDeploymentName" . }}
|
||||
- name: DB_PORT
|
||||
value: "5432"
|
||||
- name: DB_NAME
|
||||
value: {{ include "cloudhost-app.dbName" . }}
|
||||
- name: DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ $name }}-db-secret
|
||||
key: username
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ $name }}-db-secret
|
||||
key: password
|
||||
- name: DATABASE_URL
|
||||
value: "postgresql://$(DB_USER):$(DB_PASSWORD)@{{ include "cloudhost-app.dbDeploymentName" . }}:5432/{{ include "cloudhost-app.dbName" . }}"
|
||||
{{- end }}
|
||||
{{- if and .Values.database.enabled (eq .Values.database.type "mysql") }}
|
||||
- name: DB_HOST
|
||||
value: {{ include "cloudhost-app.dbDeploymentName" . }}
|
||||
- name: DB_PORT
|
||||
value: "3306"
|
||||
- name: DB_NAME
|
||||
value: {{ include "cloudhost-app.dbName" . }}
|
||||
- name: DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ $name }}-db-secret
|
||||
key: username
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ $name }}-db-secret
|
||||
key: password
|
||||
- name: DATABASE_URL
|
||||
value: "mysql://$(DB_USER):$(DB_PASSWORD)@{{ include "cloudhost-app.dbDeploymentName" . }}:3306/{{ include "cloudhost-app.dbName" . }}"
|
||||
{{- end }}
|
||||
{{- /* WordPress-specific env vars (official image expects these) */}}
|
||||
{{- if and .Values.wordpress.enabled .Values.database.enabled }}
|
||||
- name: WORDPRESS_DB_HOST
|
||||
value: "{{ include "cloudhost-app.dbDeploymentName" . }}:{{ include "cloudhost-app.dbPort" . }}"
|
||||
- name: WORDPRESS_DB_NAME
|
||||
value: {{ include "cloudhost-app.dbName" . }}
|
||||
- name: WORDPRESS_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ $name }}-db-secret
|
||||
key: username
|
||||
- name: WORDPRESS_DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ $name }}-db-secret
|
||||
key: password
|
||||
- name: WORDPRESS_TABLE_PREFIX
|
||||
value: "wp_"
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
cpu: {{ .Values.resources.cpuRequest | quote }}
|
||||
memory: {{ .Values.resources.memoryRequest | quote }}
|
||||
limits:
|
||||
cpu: {{ .Values.resources.cpuLimit | quote }}
|
||||
memory: {{ .Values.resources.memoryLimit | quote }}
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: {{ .Values.app.port }}
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: {{ .Values.app.port }}
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 10
|
||||
failureThreshold: 5
|
||||
{{- if .Values.wordpress.enabled }}
|
||||
volumeMounts:
|
||||
- name: wp-content
|
||||
mountPath: /var/www/html/wp-content
|
||||
{{- end }}
|
||||
{{- if .Values.wordpress.enabled }}
|
||||
volumes:
|
||||
- name: wp-content
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ $name }}-wp-content
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user