fix: resolve critical deployment issues across Helm charts, Dockerfile, and K8s fallback
- Add helm/kubectl binaries and chart directory to backend Dockerfile - Extend Helm templates for MongoDB/MariaDB database support (env vars, probes, ports) - Add Redis and RabbitMQ Helm templates (deployment, service, secret, PVC) - Add generic app-storage PVC and Fluent Bit sidecar with ES authentication - Fix imagePullSecrets in K8s API fallback, prevent secret regeneration on redeploy - Clean up Redis/RabbitMQ/FluentBit resources on app deletion without removing shared secrets - Fix HelmService chartPath resolution for production Docker builds Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -74,6 +74,83 @@ spec:
|
||||
- name: DATABASE_URL
|
||||
value: "mysql://$(DB_USER):$(DB_PASSWORD)@{{ include "cloudhost-app.dbDeploymentName" . }}:3306/{{ include "cloudhost-app.dbName" . }}"
|
||||
{{- end }}
|
||||
{{- if and .Values.database.enabled (eq .Values.database.type "mariadb") }}
|
||||
- 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 }}
|
||||
{{- if and .Values.database.enabled (eq .Values.database.type "mongodb") }}
|
||||
- name: DB_HOST
|
||||
value: {{ include "cloudhost-app.dbDeploymentName" . }}
|
||||
- name: DB_PORT
|
||||
value: "27017"
|
||||
- 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: MONGODB_URI
|
||||
value: "mongodb://$(DB_USER):$(DB_PASSWORD)@{{ include "cloudhost-app.dbDeploymentName" . }}:27017/{{ include "cloudhost-app.dbName" . }}?authSource=admin"
|
||||
- name: DATABASE_URL
|
||||
value: "mongodb://$(DB_USER):$(DB_PASSWORD)@{{ include "cloudhost-app.dbDeploymentName" . }}:27017/{{ include "cloudhost-app.dbName" . }}?authSource=admin"
|
||||
{{- end }}
|
||||
{{- /* Redis connection env vars */}}
|
||||
{{- if .Values.redis.enabled }}
|
||||
- name: REDIS_HOST
|
||||
value: {{ printf "%s-redis" $name }}
|
||||
- name: REDIS_PORT
|
||||
value: "6379"
|
||||
- name: REDIS_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ printf "%s-redis-secret" $name }}
|
||||
key: password
|
||||
- name: REDIS_URL
|
||||
value: "redis://:$(REDIS_PASSWORD)@{{ printf "%s-redis" $name }}:6379"
|
||||
{{- end }}
|
||||
{{- /* RabbitMQ connection env vars */}}
|
||||
{{- if .Values.rabbitmq.enabled }}
|
||||
- name: RABBITMQ_HOST
|
||||
value: {{ printf "%s-rabbitmq" $name }}
|
||||
- name: RABBITMQ_PORT
|
||||
value: "5672"
|
||||
- name: RABBITMQ_MANAGEMENT_PORT
|
||||
value: "15672"
|
||||
- name: RABBITMQ_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ printf "%s-rabbitmq-secret" $name }}
|
||||
key: username
|
||||
- name: RABBITMQ_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ printf "%s-rabbitmq-secret" $name }}
|
||||
key: password
|
||||
- name: AMQP_URL
|
||||
value: "amqp://$(RABBITMQ_USER):$(RABBITMQ_PASSWORD)@{{ printf "%s-rabbitmq" $name }}:5672"
|
||||
{{- end }}
|
||||
{{- /* WordPress-specific env vars (official image expects these) */}}
|
||||
{{- if and .Values.wordpress.enabled .Values.database.enabled }}
|
||||
- name: WORDPRESS_DB_HOST
|
||||
@@ -111,14 +188,58 @@ spec:
|
||||
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 }}
|
||||
- name: app-storage
|
||||
mountPath: {{ include "cloudhost-app.storageMountPath" . | trim }}
|
||||
{{- if .Values.elasticsearch.enabled }}
|
||||
- name: app-logs
|
||||
mountPath: /var/log/app
|
||||
{{- end }}
|
||||
{{- if .Values.elasticsearch.enabled }}
|
||||
- name: fluent-bit
|
||||
image: fluent/fluent-bit:2.2
|
||||
resources:
|
||||
requests:
|
||||
cpu: "10m"
|
||||
memory: "32Mi"
|
||||
limits:
|
||||
cpu: "50m"
|
||||
memory: "64Mi"
|
||||
volumeMounts:
|
||||
- name: app-logs
|
||||
mountPath: /var/log/app
|
||||
readOnly: true
|
||||
- name: fluent-bit-config
|
||||
mountPath: /fluent-bit/etc
|
||||
env:
|
||||
- name: APP_NAME
|
||||
value: {{ $name }}
|
||||
- name: APP_NAMESPACE
|
||||
value: {{ $ns }}
|
||||
- name: ES_HOST
|
||||
value: "elasticsearch.logging.svc.cluster.local"
|
||||
- name: ES_PORT
|
||||
value: "9200"
|
||||
- name: ES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: elasticsearch-credentials
|
||||
key: ELASTIC_PASSWORD
|
||||
optional: true
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: app-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ $name }}-storage
|
||||
{{- if .Values.wordpress.enabled }}
|
||||
- name: wp-content
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ $name }}-wp-content
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.elasticsearch.enabled }}
|
||||
- name: app-logs
|
||||
emptyDir: {}
|
||||
- name: fluent-bit-config
|
||||
configMap:
|
||||
name: {{ $name }}-fluent-bit-config
|
||||
{{- end }}
|
||||
|
||||
Reference in New Issue
Block a user