{{- if not .Values.postgresql.enabled }} {{- if not .Values.redis.enabled }} --- # 独立部署 (无依赖) apiVersion: v1 kind: ConfigMap metadata: name: {{ include "hyc.fullname" . }}-config data: HYC_HOST: {{ .Values.config.host | quote }} HYC_PORT: {{ .Values.config.port | quote }} HYC_BASE_DIR: {{ .Values.config.baseDir | quote }} HYC_CACHE_DIR: {{ .Values.config.cacheDir | quote }} HYC_ENABLE_MONITOR: {{ .Values.config.enableMonitor | quote }} HYC_ENABLE_SYNC: {{ .Values.config.enableSync | quote }} HYC_ENABLE_MIRRORS: {{ .Values.config.enableMirrors | quote }} HYC_ENABLE_WS: {{ .Values.config.enableWs | quote }} HYC_ENABLE_SSE: {{ .Values.config.enableSse | quote }} {{- end }} {{- end }} --- apiVersion: v1 kind: Secret metadata: name: {{ include "hyc.fullname" . }}-secrets type: Opaque stringData: {{- if .Values.postgresql.enabled }} DB_HOST: {{ include "hyc.postgresql.host" . }} DB_PORT: "5432" DB_NAME: {{ .Values.postgresql.auth.database }} DB_USER: {{ .Values.postgresql.auth.username }} DB_PASSWORD: {{ .Values.postgresql.auth.password }} {{- else if .Values.config.database.external.enabled }} DB_CONN_STR: {{ .Values.config.database.external.connectionString }} {{- end }} {{- if .Values.redis.enabled }} REDIS_HOST: {{ include "hyc.redis.host" . }} REDIS_PORT: "6379" {{- end }} --- apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "hyc.fullname" . }} labels: {{- include "hyc.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: {{- include "hyc.selectorLabels" . | nindent 6 }} template: metadata: labels: {{- include "hyc.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - containerPort: {{ .Values.config.port }} name: http envFrom: {{- if not .Values.postgresql.enabled }} {{- if not .Values.config.database.external.enabled }} - configMapRef: name: {{ include "hyc.fullname" . }}-config {{- end }} {{- end }} - secretRef: name: {{ include "hyc.fullname" . }}-secrets volumeMounts: - name: data-volume mountPath: /data - name: downloads-volume mountPath: {{ .Values.config.baseDir }} - name: caches-volume mountPath: {{ .Values.config.cacheDir }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- if .Values.livenessProbe.enabled }} livenessProbe: httpGet: path: /api/v1/health port: {{ .Values.config.port }} initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.livenessProbe.periodSeconds }} timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} failureThreshold: {{ .Values.livenessProbe.failureThreshold }} {{- end }} {{- if .Values.readinessProbe.enabled }} readinessProbe: httpGet: path: /api/v1/health port: {{ .Values.config.port }} initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.readinessProbe.periodSeconds }} timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} failureThreshold: {{ .Values.readinessProbe.failureThreshold }} {{- end }} volumes: - name: data-volume {{- if .Values.persistence.data.enabled }} persistentVolumeClaim: claimName: {{ include "hyc.fullname" . }}-data-pvc {{- else }} emptyDir: {} {{- end }} - name: downloads-volume {{- if .Values.persistence.downloads.enabled }} persistentVolumeClaim: claimName: {{ include "hyc.fullname" . }}-downloads-pvc {{- else }} emptyDir: {} {{- end }} - name: caches-volume {{- if .Values.persistence.caches.enabled }} persistentVolumeClaim: claimName: {{ include "hyc.fullname" . }}-caches-pvc {{- 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 }}