0
Fork 0
mirror of https://github.com/penpot/penpot-helm.git synced 2024-12-22 13:43:01 -05:00
penpot-helm/charts/penpot/templates/backend-deployment.yml

396 lines
18 KiB
YAML
Raw Normal View History

2024-06-11 06:46:03 -05:00
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "penpot.fullname" . }}-backend
namespace: {{ .Release.Namespace }}
labels:
{{- include "penpot.labels" . | nindent 4 }}
{{- with .Values.backend.deploymentAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
2024-06-11 06:46:03 -05:00
spec:
selector:
matchLabels:
{{- include "penpot.backendSelectorLabels" . | nindent 6 }}
replicas: {{ .Values.backend.replicaCount }}
template:
metadata:
labels:
app: penpot-backend
{{- include "penpot.backendSelectorLabels" . | nindent 8 }}
2024-07-10 08:24:35 -05:00
{{- with .Values.backend.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.backend.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
2024-06-11 06:46:03 -05:00
spec:
serviceAccountName: {{ include "penpot.serviceAccountName" . }}
{{- with .Values.global.imagePullSecrets }}
2024-06-11 06:46:03 -05:00
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.backend.podSecurityContext }}
2024-06-11 06:46:03 -05:00
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
2024-06-11 06:46:03 -05:00
containers:
- name: {{ .Chart.Name }}-backend
image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag }}"
imagePullPolicy: {{ .Values.backend.image.pullPolicy }}
{{- with .Values.backend.containerSecurityContext }}
2024-06-11 06:46:03 -05:00
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
2024-06-11 06:46:03 -05:00
env:
# General settings
2024-06-11 06:46:03 -05:00
- name: PENPOT_PUBLIC_URI
value: {{ .Values.config.publicUri | quote }}
- name: PENPOT_FLAGS
value: "$PENPOT_FLAGS {{ .Values.config.flags }}"
- name: PENPOT_SECRET_KEY
value: {{ .Values.config.apiSecretKey | quote }}
{{- if .Values.config.registrationDomainWhitelist }}
2024-06-11 06:46:03 -05:00
- name: PENPOT_REGISTRATION_DOMAIN_WHITELIST
value: {{ .Values.config.registrationDomainWhitelist | quote }}
{{- end }}
2024-06-11 06:46:03 -05:00
- name: PENPOT_TELEMETRY_ENABLED
value: {{ .Values.config.telemetryEnabled | quote }}
# PosgreSQL connection settings
2024-06-11 06:46:03 -05:00
- name: PENPOT_DATABASE_URI
{{- if .Values.config.postgresql.host }}
2024-06-11 06:46:03 -05:00
value: "postgresql://{{ .Values.config.postgresql.host }}:{{ .Values.config.postgresql.port }}/{{ .Values.config.postgresql.database }}"
{{- else }}
2024-06-11 06:46:03 -05:00
value: {{ print "postgresql://" (include "penpot.fullname" .) "-postgresql:" .Values.config.postgresql.port "/" .Values.config.postgresql.database }}
{{- end }}
2024-06-11 06:46:03 -05:00
- name: PENPOT_DATABASE_USERNAME
{{- if not .Values.config.postgresql.secretKeys.usernameKey }}
2024-06-11 06:46:03 -05:00
value: {{ .Values.config.postgresql.username | quote }}
{{- else }}
2024-06-11 06:46:03 -05:00
valueFrom:
secretKeyRef:
name: {{ .Values.config.postgresql.existingSecret }}
key: {{ .Values.config.postgresql.secretKeys.usernameKey }}
{{- end }}
2024-06-11 06:46:03 -05:00
- name: PENPOT_DATABASE_PASSWORD
{{- if not .Values.config.postgresql.secretKeys.passwordKey }}
2024-06-11 06:46:03 -05:00
value: {{ .Values.config.postgresql.password | quote }}
{{- else }}
2024-06-11 06:46:03 -05:00
valueFrom:
secretKeyRef:
name: {{ .Values.config.postgresql.existingSecret }}
key: {{ .Values.config.postgresql.secretKeys.passwordKey }}
{{- end }}
# Redis connection settings
2024-06-11 06:46:03 -05:00
- name: PENPOT_REDIS_URI
{{- if .Values.config.redis.host }}
2024-06-11 06:46:03 -05:00
value: "redis://{{ .Values.config.redis.host }}:{{ .Values.config.redis.port }}/{{ .Values.config.redis.database }}"
{{- else }}
2024-06-11 06:46:03 -05:00
value: {{ print "redis://" (include "penpot.fullname" .) "-redis-master:" .Values.config.redis.port "/" .Values.config.redis.database }}
{{- end }}
# Assets storage settings
2024-06-11 06:46:03 -05:00
- name: PENPOT_ASSETS_STORAGE_BACKEND
value: {{ .Values.config.assets.storageBackend | quote }}
{{- if eq .Values.config.assets.storageBackend "assets-fs" }}
2024-06-11 06:46:03 -05:00
- name: PENPOT_STORAGE_ASSETS_FS_DIRECTORY
value: {{ .Values.config.assets.filesystem.directory | quote }}
{{- else if eq .Values.config.assets.storageBackend "assets-s3" }}
2024-06-11 06:46:03 -05:00
- name: PENPOT_STORAGE_ASSETS_S3_REGION
value: {{ .Values.config.assets.s3.region | quote }}
- name: PENPOT_STORAGE_ASSETS_S3_BUCKET
value: {{ .Values.config.assets.s3.bucket | quote }}
- name: AWS_ACCESS_KEY_ID
{{- if not .Values.config.assets.s3.secretKeys.accessKeyIDKey }}
2024-06-11 06:46:03 -05:00
value: {{ .Values.config.assets.s3.accessKeyID | quote }}
{{- else }}
2024-06-11 06:46:03 -05:00
valueFrom:
secretKeyRef:
name: {{ .Values.config.assets.s3.existingSecret }}
key: {{ .Values.config.assets.s3.secretKeys.accessKeyIDKey }}
{{- end }}
2024-06-11 06:46:03 -05:00
- name: AWS_SECRET_ACCESS_KEY
{{- if not .Values.config.assets.s3.secretKeys.secretAccessKey }}
2024-06-11 06:46:03 -05:00
value: {{ .Values.config.assets.s3.secretAccessKey | quote }}
{{- else }}
2024-06-11 06:46:03 -05:00
valueFrom:
secretKeyRef:
name: {{ .Values.config.assets.s3.existingSecret }}
key: {{ .Values.config.assets.s3.secretKeys.secretAccessKey }}
{{- end }}
2024-06-11 06:46:03 -05:00
- name: PENPOT_STORAGE_ASSETS_S3_ENDPOINT
{{- if not .Values.config.assets.s3.secretKeys.endpointURIKey }}
2024-06-11 06:46:03 -05:00
value: {{ .Values.config.assets.s3.endpointURI | quote }}
{{- else }}
2024-06-11 06:46:03 -05:00
valueFrom:
secretKeyRef:
name: {{ .Values.config.assets.s3.existingSecret }}
key: {{ .Values.config.assets.s3.secretKeys.endpointURIKey }}
{{- end }}
2024-06-11 06:46:03 -05:00
{{- end }}
# SMTP settings
2024-06-11 06:46:03 -05:00
{{- if .Values.config.smtp.enabled }}
{{- if .Values.config.smtp.defaultFrom }}
- name: PENPOT_SMTP_DEFAULT_FROM
value: {{ .Values.config.smtp.defaultFrom | quote }}
{{- end }}
{{- if .Values.config.smtp.defaultReplyTo }}
- name: PENPOT_SMTP_DEFAULT_REPLY_TO
value: {{ .Values.config.smtp.defaultReplyTo | quote }}
{{- end }}
{{- if .Values.config.smtp.host }}
- name: PENPOT_SMTP_HOST
value: {{ .Values.config.smtp.host | quote }}
{{- end }}
{{- if .Values.config.smtp.port }}
- name: PENPOT_SMTP_PORT
value: {{ .Values.config.smtp.port | quote }}
{{- end }}
{{- if not .Values.config.smtp.secretKeys.usernameKey }}
- name: PENPOT_SMTP_USERNAME
value: {{ .Values.config.smtp.username | quote }}
{{- else }}
- name: PENPOT_SMTP_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Values.config.smtp.existingSecret }}
key: {{ .Values.config.smtp.secretKeys.usernameKey }}
{{- end }}
{{- if not .Values.config.smtp.secretKeys.passwordKey }}
- name: PENPOT_SMTP_PASSWORD
value: {{ .Values.config.smtp.password | quote }}
{{- else }}
- name: PENPOT_SMTP_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.config.smtp.existingSecret }}
key: {{ .Values.config.smtp.secretKeys.passwordKey }}
{{- end }}
{{- if .Values.config.smtp.tls }}
- name: PENPOT_SMTP_TLS
value: {{ .Values.config.smtp.tls | quote }}
{{- end }}
{{- if .Values.config.smtp.ssl }}
- name: PENPOT_SMTP_SSL
value: {{ .Values.config.smtp.ssl | quote }}
{{- end }}
{{- end }}
# Google Auth provider settings
2024-06-11 06:46:03 -05:00
{{- if .Values.config.providers.google.enabled }}
{{- if not .Values.config.providers.secretKeys.googleClientIDKey }}
- name: PENPOT_GOOGLE_CLIENT_ID
value: {{ .Values.config.providers.google.clientID | quote }}
{{- else }}
- name: PENPOT_GOOGLE_CLIENT_ID
valueFrom:
secretKeyRef:
name: {{ .Values.config.providers.existingSecret }}
key: {{ .Values.config.providers.secretKeys.googleClientIDKey }}
{{- end }}
{{- if not .Values.config.providers.secretKeys.googleClientSecretKey}}
- name: PENPOT_GOOGLE_CLIENT_SECRET
value: {{ .Values.config.providers.google.clientSecret | quote }}
{{- else }}
- name: PENPOT_GOOGLE_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.config.providers.existingSecret }}
key: {{ .Values.config.providers.secretKeys.googleClientSecretKey }}
{{- end }}
{{- end }}
# Github Auth provider settings
2024-06-11 06:46:03 -05:00
{{- if .Values.config.providers.github.enabled }}
{{- if not .Values.config.providers.secretKeys.githubClientIDKey }}
- name: PENPOT_GITHUB_CLIENT_ID
value: {{ .Values.config.providers.github.clientID | quote }}
{{- else }}
- name: PENPOT_GITHUB_CLIENT_ID
valueFrom:
secretKeyRef:
name: {{ .Values.config.providers.existingSecret }}
key: {{ .Values.config.providers.secretKeys.githubClientIDKey }}
{{- end }}
{{- if not .Values.config.providers.secretKeys.githubClientSecretKey }}
- name: PENPOT_GITHUB_CLIENT_SECRET
value: {{ .Values.config.providers.github.clientSecret | quote }}
{{- else }}
- name: PENPOT_GITHUB_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.config.providers.existingSecret }}
key: {{ .Values.config.providers.secretKeys.githubClientSecretKey }}
{{- end }}
{{- end }}
# Gitlab Auth provider settings
2024-06-11 06:46:03 -05:00
{{- if .Values.config.providers.gitlab.enabled }}
{{- if .Values.config.providers.gitlab.baseURI }}
- name: PENPOT_GITLAB_BASE_URI
value: {{ .Values.config.providers.gitlab.baseURI | quote }}
{{- end }}
{{- if not .Values.config.providers.secretKeys.gitlabClientIDKey }}
- name: PENPOT_GITLAB_CLIENT_ID
value: {{ .Values.config.providers.gitlab.clientID | quote }}
{{- else }}
- name: PENPOT_GITLAB_CLIENT_ID
valueFrom:
secretKeyRef:
name: {{ .Values.config.providers.existingSecret }}
key: {{ .Values.config.providers.secretKeys.gitlabClientIDKey }}
{{- end }}
{{- if not .Values.config.providers.secretKeys.gitlabClientSecretKey }}
- name: PENPOT_GITLAB_CLIENT_SECRET
value: {{ .Values.config.providers.gitlab.clientSecret | quote }}
{{- else }}
- name: PENPOT_GITLAB_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.config.providers.existingSecret }}
key: {{ .Values.config.providers.secretKeys.gitlabClientSecretKey }}
{{- end }}
{{- end }}
# OIDC provider settings
2024-06-11 06:46:03 -05:00
{{- if .Values.config.providers.oidc.enabled }}
{{- if .Values.config.providers.oidc.baseURI }}
- name: PENPOT_OIDC_BASE_URI
value: {{ .Values.config.providers.oidc.baseURI | quote }}
{{- end }}
{{- if not .Values.config.providers.secretKeys.oidcClientIDKey }}
- name: PENPOT_OIDC_CLIENT_ID
value: {{ .Values.config.providers.oidc.clientID | quote}}
{{- else }}
- name: PENPOT_OIDC_CLIENT_ID
valueFrom:
secretKeyRef:
name: {{ .Values.config.providers.existingSecret }}
key: {{ .Values.config.providers.secretKeys.oidcClientIDKey }}
{{- end }}
{{- if not .Values.config.providers.secretKeys.oidcClientSecretKey}}
- name: PENPOT_OIDC_CLIENT_SECRET
value: {{ .Values.config.providers.oidc.clientSecret | quote }}
{{- else }}
- name: PENPOT_OIDC_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.config.providers.existingSecret }}
key: {{ .Values.config.providers.secretKeys.oidcClientSecretKey }}
{{- end }}
{{- if .Values.config.providers.oidc.authURI }}
- name: PENPOT_OIDC_AUTH_URI
value: {{ .Values.config.providers.oidc.authURI | quote }}
{{- end }}
{{- if .Values.config.providers.oidc.tokenURI }}
- name: PENPOT_OIDC_TOKEN_URI
value: {{ .Values.config.providers.oidc.tokenURI | quote }}
{{- end }}
{{- if .Values.config.providers.oidc.userURI }}
- name: PENPOT_OIDC_USER_URI
value: {{ .Values.config.providers.oidc.userURI | quote }}
{{- end }}
{{- if .Values.config.providers.oidc.roles }}
- name: PENPOT_OIDC_ROLES
value: {{ .Values.config.providers.oidc.roles | quote }}
{{- end }}
{{- if .Values.config.providers.oidc.rolesAttribute }}
- name: PENPOT_OIDC_ROLES_ATTR
value: {{ .Values.config.providers.oidc.rolesAttribute | quote }}
{{- end }}
{{- if .Values.config.providers.oidc.scopes }}
- name: PENPOT_OIDC_SCOPES
value: {{ .Values.config.providers.oidc.scopes | quote }}
{{- end }}
{{- if .Values.config.providers.oidc.nameAttribute }}
- name: PENPOT_OIDC_NAME_ATTR
value: {{ .Values.config.providers.oidc.nameAttribute | quote }}
{{- end }}
{{- if .Values.config.providers.oidc.emailAttribute }}
- name: PENPOT_OIDC_EMAIL_ATTR
value: {{ .Values.config.providers.oidc.emailAttribute | quote }}
{{- end }}
{{- if .Values.config.providers.oidc.userInfoSource }}
- name: PENPOT_OIDC_USER_INFO_SOURCE
value: {{ .Values.config.providers.oidc.userInfoSource | quote }}
{{- end }}
{{- end }}
# LDAP provider settings
2024-06-11 06:46:03 -05:00
{{- if .Values.config.providers.ldap.enabled }}
{{- if .Values.config.providers.ldap.host }}
- name: PENPOT_LDAP_HOST
value: {{ .Values.config.providers.ldap.host | quote }}
{{- end }}
{{- if .Values.config.providers.ldap.port }}
- name: PENPOT_LDAP_PORT
value: {{ .Values.config.providers.ldap.port | quote }}
{{- end }}
{{- if .Values.config.providers.ldap.ssl }}
- name: PENPOT_LDAP_SSL
value: {{ .Values.config.providers.ldap.ssl | quote }}
{{- end }}
{{- if .Values.config.providers.ldap.startTLS }}
- name: PENPOT_LDAP_STARTTLS
value: {{ .Values.config.providers.ldap.startTLS | quote }}
{{- end }}
{{- if .Values.config.providers.ldap.baseDN }}
- name: PENPOT_LDAP_BASE_DN
value: {{ .Values.config.providers.ldap.baseDN | quote }}
{{- end }}
{{- if .Values.config.providers.ldap.bindDN }}
- name: PENPOT_LDAP_BIND_DN
value: {{ .Values.config.providers.ldap.bindDN | quote }}
{{- end }}
{{- if .Values.config.providers.ldap.bindPassword }}
- name: PENPOT_LDAP_BIND_PASSWORD
value: {{ .Values.config.providers.ldap.bindPassword | quote }}
{{- end }}
{{- if .Values.config.providers.ldap.userQuery }}
- name: PENPOT_LDAP_USER_QUERY
value: {{ .Values.config.providers.ldap.userQuery | quote }}
{{- end }}
{{- if .Values.config.providers.ldap.attributesUsername }}
- name: PENPOT_LDAP_ATTRS_USERNAME
value: {{ .Values.config.providers.ldap.attributesUsername | quote }}
{{- end }}
{{- if .Values.config.providers.ldap.attributesEmail }}
- name: PENPOT_LDAP_ATTRS_EMAIL
value: {{ .Values.config.providers.ldap.attributesEmail | quote }}
{{- end }}
{{- if .Values.config.providers.ldap.attributesFullname }}
- name: PENPOT_LDAP_ATTRS_FULLNAME
value: {{ .Values.config.providers.ldap.attributesFullname | quote }}
{{- end }}
{{- if .Values.config.providers.ldap.attributesPhoto }}
- name: PENPOT_LDAP_ATTRS_PHOTO
value: {{ .Values.config.providers.ldap.attributesPhoto | quote }}
{{- end }}
{{- end }}
volumeMounts:
- mountPath: /opt/data/assets
name: app-data
readOnly: false
ports:
- name: http
2024-07-09 11:08:53 -05:00
containerPort: {{ .Values.backend.service.port }}
2024-06-11 06:46:03 -05:00
protocol: TCP
resources:
{{- toYaml .Values.backend.resources | nindent 12 }}
{{- with .Values.backend.nodeSelector }}
2024-06-11 06:46:03 -05:00
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.backend.affinity }}
2024-06-11 06:46:03 -05:00
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.backend.tolerations }}
2024-06-11 06:46:03 -05:00
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
2024-06-11 06:46:03 -05:00
volumes:
- name: app-data
{{- if .Values.persistence.assets.enabled }}
2024-06-11 06:46:03 -05:00
persistentVolumeClaim:
claimName: {{ .Values.persistence.assets.existingClaim | default ( printf "%s-%s" ( include "penpot.fullname" . ) "data-assets" ) }}
{{- else }}
2024-06-11 06:46:03 -05:00
emptyDir: {}
{{- end }}