Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade common chart. Allow split api/worker config. #137

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions charts/immich/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v2
description: A chart to power Immich (immich.app) running on kubernetes
name: immich
version: 0.8.2
version: 0.9.0
appVersion: v1.118.0
home: https://immich.app/
icon: https://raw.githubusercontent.com/immich-app/immich/main/design/immich-logo.svg
Expand All @@ -17,7 +17,7 @@ maintainers:
dependencies:
- name: common
repository: https://bjw-s.github.io/helm-charts
version: 1.4.0
version: 3.5.1
- name: postgresql
condition: postgresql.enabled
repository: https://charts.bitnami.com/bitnami
Expand Down
3 changes: 3 additions & 0 deletions charts/immich/templates/_utils/debug.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{- define "debug.var_dump" -}}
{{- . | toPrettyJson | printf "\nThe JSON output of the dumped var is: \n%s" | fail }}
{{- end -}}
5 changes: 4 additions & 1 deletion charts/immich/templates/checks.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{{- $name := .Values.immich.persistence.library.existingClaim | required ".Values.immich.persistence.library.existingClaim is required." -}}
{{- $name := .Values.immich.persistence.library.existingClaim | required ".Values.immich.persistence.library.existingClaim is required." -}}
{{- if and (eq .Values.workers.enabled true) (eq .Values.workers.enabled .Values.server.enabled) }}
{{- fail (printf "Only one of workers.enabled or server.enabled must be true.") }}
{{- end }}
22 changes: 17 additions & 5 deletions charts/immich/templates/machine-learning.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@
global:
nameOverride: machine-learning

controllers:
machine-learning:
containers:
main:
enabled: true
image:
repository: ghcr.io/immich-app/immich-machine-learning
pullPolicy: IfNotPresent
tag: {{ .Values.immich.image.tag }}

service:
main:
machine-learning:
enabled: true
primary: true
controller: machine-learning
type: ClusterIP
ports:
http:
Expand All @@ -29,12 +40,13 @@ probes:
readiness: *probes
startup:
enabled: false
# end of define
{{- end }}

{{- /* Have to reference with index here because the dash breaks a normal dereference */}}
{{ if (index .Values "machine-learning").enabled }}
{{- $ctx := deepCopy . -}}
{{- $_ := get .Values "machine-learning" | mergeOverwrite $ctx.Values -}}
{{- $_ = include "immich.machine-learning.hardcodedValues" . | fromYaml | merge $ctx.Values -}}
{{- $ctx := deepCopy (omit . "Values") }}
{{- $_ := set $ctx "Values" dict }}
{{- $_ := merge $ctx.Values (deepCopy .Values.common) (include "immich.machine-learning.hardcodedValues" . | fromYaml) (deepCopy (get .Values "machine-learning")) -}}
{{- include "bjw-s.common.loader.all" $ctx }}
{{ end }}
{{- end }}
56 changes: 38 additions & 18 deletions charts/immich/templates/server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,34 @@
global:
nameOverride: server

env:
{{ if .Values.immich.metrics.enabled }}
IMMICH_METRICS: true
{{ end }}
{{- if .Values.immich.configuration }}
IMMICH_CONFIG_FILE: /config/immich-config.yaml
{{- end }}

{{- if .Values.immich.configuration }}
podAnnotations:
checksum/config: {{ .Values.immich.configuration | toYaml | sha256sum }}
defaultPodOptions:
annotations:
checksum/config: {{ .Values.immich.configuration | toYaml | sha256sum }}
{{- end }}

controllers:
immich-server:
containers:
main:
enabled: true
image:
repository: ghcr.io/immich-app/immich-server
pullPolicy: IfNotPresent
tag: {{ .Values.immich.image.tag }}
env:
{{ if .Values.immich.metrics.enabled }}
IMMICH_METRICS: true
{{ end }}
{{- if .Values.immich.configuration }}
IMMICH_CONFIG_FILE: /config/immich-config.yaml
{{- end }}

service:
main:
immich-server:
enabled: true
primary: true
controller: immich-server
type: ClusterIP
ports:
http:
Expand All @@ -37,8 +48,9 @@ service:


serviceMonitor:
main:
immich-server:
enabled: {{ .Values.immich.metrics.enabled }}
serviceName: immich-server
endpoints:
- port: metrics-api
scheme: http
Expand Down Expand Up @@ -79,13 +91,21 @@ persistence:
{{- end }}
library:
enabled: true
mountPath: /usr/src/app/upload
type: persistentVolumeClaim
accessMode: ReadWriteMany
existingClaim: {{ .Values.immich.persistence.library.existingClaim }}
retain: true
globalMounts:
- path: /usr/src/app/upload
readOnly: false
# end of define
{{- end }}

{{ if .Values.server.enabled }}
{{- $ctx := deepCopy . -}}
{{- $_ := get .Values "server" | mergeOverwrite $ctx.Values -}}
{{- $_ = include "immich.server.hardcodedValues" . | fromYaml | merge $ctx.Values -}}
{{- if .Values.server.enabled }}
{{- $ctx := deepCopy (omit . "Values") }}
{{- $_ := set $ctx "Values" dict }}
{{- /* This part is needed so that bjw-s can reflectively resolve values like .Values.postgresql.global.postgresql.auth.username in the envVars */ -}}
{{- $_ := set $ctx.Values "postgresql" (deepCopy .Values.postgresql) }}
{{- $_ := merge $ctx.Values (deepCopy .Values.common) (include "immich.server.hardcodedValues" . | fromYaml) (deepCopy .Values.server) -}}
{{- include "bjw-s.common.loader.all" $ctx }}
{{ end }}
{{- end }}
148 changes: 148 additions & 0 deletions charts/immich/templates/workers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@

{{- define "immich.workers.hardcodedValues" -}}
global:
nameOverride: workers

env:
{{ if .Values.immich.metrics.enabled }}
IMMICH_METRICS: true
{{ end }}
{{- if .Values.immich.configuration }}
IMMICH_CONFIG_FILE: /config/immich-config.yaml
{{- end }}

{{- $worker_env := deepCopy .Values.immich.env }}
{{ if .Values.immich.metrics.enabled }}
{{- $_ := merge $worker_env (dict "IMMICH_METRICS" "true") }}
{{- end }}
{{ if .Values.immich.configuration }}
{{- $_ := merge $worker_env (dict "IMMICH_CONFIG_FILE" "/config/immich-config.yaml") }}
{{- end }}
{{- $apiEnv := merge (deepCopy $worker_env) (dict "IMMICH_WORKERS_INCLUDE" "api")}}
{{- $microservicesEnv := merge (deepCopy $worker_env) (dict "IMMICH_WORKERS_EXCLUDE" "api")}}

{{- if .Values.immich.configuration }}
defaultPodOptions:
annotations:
checksum/config: {{ .Values.immich.configuration | toYaml | sha256sum }}
{{- end }}

controllers:
api:
enabled: true
containers:
main:
enabled: true
image:
repository: ghcr.io/immich-app/immich-server
pullPolicy: IfNotPresent
tag: {{ .Values.immich.image.tag }}
env: {{ $apiEnv | toYaml | nindent 10 }}
microservices:
enabled: true
containers:
main:
enabled: true
image:
repository: ghcr.io/immich-app/immich-server
pullPolicy: IfNotPresent
tag: {{ .Values.immich.image.tag }}
env: {{ $microservicesEnv | toYaml | nindent 10 }}
service:
api:
enabled: true
primary: true
controller: api
nameOverride: api
type: ClusterIP
ports:
http:
enabled: true
primary: true
port: 2283
protocol: HTTP
metrics-api:
enabled: {{ .Values.immich.metrics.enabled }}
port: 8081
protocol: HTTP
{{- if .Values.immich.metrics.enabled }}
microservices:
enabled: true
primary: true
controller: microservices
nameOverride: microservices
type: ClusterIP
ports:
metrics-ms:
enabled: {{ .Values.immich.metrics.enabled }}
port: 8082
protocol: HTTP
{{ end }}

serviceMonitor:
api:
enabled: {{ .Values.immich.metrics.enabled }}
serviceName: immich-workers-api
endpoints:
- port: metrics-api
scheme: http
microservices:
enabled: {{ .Values.immich.metrics.enabled }}
serviceName: immich-workers-microservices
endpoints:
- port: metrics-ms
scheme: http

probes:
liveness: &probes
enabled: true
custom: true
spec:
httpGet:
path: /api/server/ping
port: http
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
readiness: *probes
startup:
enabled: true
custom: true
spec:
httpGet:
path: /api/server/ping
port: http
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 30

persistence:
{{- if .Values.immich.configuration }}
config:
enabled: true
type: configMap
name: {{ .Release.Name }}-immich-config
{{- end }}
library:
enabled: true
type: persistentVolumeClaim
accessMode: ReadWriteMany
existingClaim: {{ .Values.immich.persistence.library.existingClaim }}
retain: true
globalMounts:
- path: /usr/src/app/upload
readOnly: false
# end of define
{{- end }}

{{- if .Values.workers.enabled }}
{{- $ctx := deepCopy (omit . "Values") }}
{{- $_ := set $ctx "Values" dict }}
{{- /* This part is needed so that bjw-s can reflectively resolve values like .Values.postgresql.global.postgresql.auth.username in the envVars */ -}}
{{- $_ := set $ctx.Values "postgresql" (deepCopy .Values.postgresql) }}
{{- $_ := merge $ctx.Values (deepCopy .Values.common) (include "immich.workers.hardcodedValues" . | fromYaml) (deepCopy .Values.workers) -}}

{{- include "bjw-s.common.loader.all" $ctx }}
{{- end }}
Loading