diff --git a/helm/charts/hydra/Chart.lock b/helm/charts/hydra/Chart.lock index eb6906b5e..3a5134a0b 100644 --- a/helm/charts/hydra/Chart.lock +++ b/helm/charts/hydra/Chart.lock @@ -1,6 +1,9 @@ dependencies: +- name: ory-commons + repository: file://../ory-commons + version: 0.1.0 - name: hydra-maester repository: file://../hydra-maester version: 0.43.1 -digest: sha256:d28f966a3e6b68126e932e9a6357aa1aea15496b5b6006f2d1d4f2f62e219a64 -generated: "2024-05-23T11:52:47.4059612Z" +digest: sha256:3ec061d9abc96913b4991d2f57557d144829945e669329e4d8723d896c9a523f +generated: "2024-06-11T14:58:01.616059+02:00" diff --git a/helm/charts/hydra/Chart.yaml b/helm/charts/hydra/Chart.yaml index 5e773ab8f..5b1e874d6 100644 --- a/helm/charts/hydra/Chart.yaml +++ b/helm/charts/hydra/Chart.yaml @@ -22,9 +22,12 @@ maintainers: # (optional) url: https://www.ory.sh/ type: application dependencies: + - name: ory-commons + version: 0.1.0 + repository: file://../ory-commons + alias: ory - name: hydra-maester version: 0.43.1 condition: maester.enabled alias: hydra-maester repository: file://../hydra-maester - # repository: https://k8s.ory.sh/helm/charts diff --git a/helm/charts/hydra/README.md b/helm/charts/hydra/README.md index 6af1e5094..aa00e6d7c 100644 --- a/helm/charts/hydra/README.md +++ b/helm/charts/hydra/README.md @@ -22,6 +22,7 @@ A Helm chart for deploying ORY Hydra in Kubernetes | Repository | Name | Version | |------------|------|---------| | file://../hydra-maester | hydra-maester(hydra-maester) | 0.43.1 | +| file://../ory-commons | ory(ory-commons) | 0.1.0 | ## Values diff --git a/helm/charts/hydra/charts/hydra-maester-0.43.1.tgz b/helm/charts/hydra/charts/hydra-maester-0.43.1.tgz index 2731e5c34..43ba043a4 100644 Binary files a/helm/charts/hydra/charts/hydra-maester-0.43.1.tgz and b/helm/charts/hydra/charts/hydra-maester-0.43.1.tgz differ diff --git a/helm/charts/hydra/charts/ory-commons-0.1.0.tgz b/helm/charts/hydra/charts/ory-commons-0.1.0.tgz new file mode 100644 index 000000000..300c6e53d Binary files /dev/null and b/helm/charts/hydra/charts/ory-commons-0.1.0.tgz differ diff --git a/helm/charts/hydra/templates/deployment.yaml b/helm/charts/hydra/templates/deployment.yaml index 4c4fe9bcf..787ab4763 100644 --- a/helm/charts/hydra/templates/deployment.yaml +++ b/helm/charts/hydra/templates/deployment.yaml @@ -136,11 +136,13 @@ spec: value: {{ $issuer | quote }} {{- end }} {{- if not (empty ( include "hydra.dsn" . )) }} + {{- if not (include "ory.extraEnvContainsEnvName" (list .Values.deployment.extraEnv "DSN")) }} - name: DSN valueFrom: secretKeyRef: name: {{ include "hydra.secretname" . }} key: dsn + {{- end }} {{- end }} - name: SECRETS_SYSTEM valueFrom: @@ -193,11 +195,13 @@ spec: {{- end }} env: {{- if not (empty ( include "hydra.dsn" . )) }} + {{- if not (include "ory.extraEnvContainsEnvName" (list $migrationExtraEnv "DSN")) }} - name: DSN valueFrom: secretKeyRef: name: {{ include "hydra.secretname" . }} key: dsn + {{- end }} {{- end }} {{- with $migrationExtraEnv }} {{- toYaml . | nindent 12 }} diff --git a/helm/charts/hydra/templates/janitor-cron-job.yaml b/helm/charts/hydra/templates/janitor-cron-job.yaml index ee4c9eb94..6ec57ad18 100644 --- a/helm/charts/hydra/templates/janitor-cron-job.yaml +++ b/helm/charts/hydra/templates/janitor-cron-job.yaml @@ -84,11 +84,13 @@ spec: {{- end }} env: {{- if not (empty ( include "hydra.dsn" . )) }} + {{- if not (include "ory.extraEnvContainsEnvName" (list $janitorExtraEnv "DSN")) }} - name: DSN valueFrom: secretKeyRef: name: {{ include "hydra.secretname" . }} key: dsn + {{- end }} {{- end }} {{- with $janitorExtraEnv }} {{- toYaml . | nindent 16 }} diff --git a/helm/charts/hydra/templates/job-migration.yaml b/helm/charts/hydra/templates/job-migration.yaml index 3190b8d7b..56cf3e812 100644 --- a/helm/charts/hydra/templates/job-migration.yaml +++ b/helm/charts/hydra/templates/job-migration.yaml @@ -63,11 +63,13 @@ spec: {{- end }} env: {{- if not (empty ( include "hydra.dsn" . )) }} + {{- if not (include "ory.extraEnvContainsEnvName" (list $migrationExtraEnv "DSN")) }} - name: DSN valueFrom: secretKeyRef: name: {{ include "hydra.secretname" . }} key: dsn + {{- end }} {{- end }} {{- with $migrationExtraEnv }} {{- toYaml . | nindent 10 }} diff --git a/helm/charts/keto/Chart.lock b/helm/charts/keto/Chart.lock new file mode 100644 index 000000000..d8092d3c8 --- /dev/null +++ b/helm/charts/keto/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: ory-commons + repository: file://../ory-commons + version: 0.1.0 +digest: sha256:eec8978215334aad38275f0171681f1200220dccef4762ddeb197679fd287abb +generated: "2024-06-11T14:47:42.552973+02:00" diff --git a/helm/charts/keto/Chart.yaml b/helm/charts/keto/Chart.yaml index 52dd09582..850730425 100644 --- a/helm/charts/keto/Chart.yaml +++ b/helm/charts/keto/Chart.yaml @@ -26,3 +26,8 @@ version: 0.43.1 # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. appVersion: "v0.12.0" +dependencies: + - name: ory-commons + version: 0.1.0 + repository: file://../ory-commons + alias: ory diff --git a/helm/charts/keto/README.md b/helm/charts/keto/README.md index 53ecb5604..60f656ca6 100644 --- a/helm/charts/keto/README.md +++ b/helm/charts/keto/README.md @@ -17,6 +17,12 @@ Access Control Policies as a Server * * +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| file://../ory-commons | ory(ory-commons) | 0.1.0 | + ## Values | Key | Type | Default | Description | diff --git a/helm/charts/keto/charts/ory-commons-0.1.0.tgz b/helm/charts/keto/charts/ory-commons-0.1.0.tgz new file mode 100644 index 000000000..345a34b3a Binary files /dev/null and b/helm/charts/keto/charts/ory-commons-0.1.0.tgz differ diff --git a/helm/charts/keto/templates/deployment.yaml b/helm/charts/keto/templates/deployment.yaml index 2eb928bfd..6a1d4149a 100644 --- a/helm/charts/keto/templates/deployment.yaml +++ b/helm/charts/keto/templates/deployment.yaml @@ -94,11 +94,13 @@ spec: {{- end }} env: {{- if not (empty ( include "keto.dsn" . )) }} + {{- if not (include "ory.extraEnvContainsEnvName" (list $migrationExtraEnv "DSN")) }} - name: DSN valueFrom: secretKeyRef: name: {{ include "keto.secretname" . }} key: dsn + {{- end }} {{- end }} {{- with $migrationExtraEnv }} {{- toYaml . | nindent 12 }} @@ -185,11 +187,13 @@ spec: {{- toYaml $resources | nindent 12 }} env: {{- if not (empty ( include "keto.dsn" . )) }} + {{- if not (include "ory.extraEnvContainsEnvName" (list .Values.deployment.extraEnv "DSN")) }} - name: DSN valueFrom: secretKeyRef: name: {{ include "keto.secretname" . }} key: dsn + {{- end }} {{- end }} {{- with .Values.deployment.extraEnv }} {{- toYaml . | nindent 12 }} diff --git a/helm/charts/keto/templates/job-migration.yaml b/helm/charts/keto/templates/job-migration.yaml index 01ae56159..18b7f5759 100644 --- a/helm/charts/keto/templates/job-migration.yaml +++ b/helm/charts/keto/templates/job-migration.yaml @@ -76,11 +76,13 @@ spec: {{- end }} env: {{- if not (empty ( include "keto.dsn" . )) }} + {{- if not (include "ory.extraEnvContainsEnvName" (list $migrationExtraEnv "DSN")) }} - name: DSN valueFrom: secretKeyRef: name: {{ include "keto.secretname" . }} key: dsn + {{- end }} {{- end }} {{- with $migrationExtraEnv }} {{- toYaml . | nindent 10 }} diff --git a/helm/charts/kratos/Chart.lock b/helm/charts/kratos/Chart.lock new file mode 100644 index 000000000..a46383dcb --- /dev/null +++ b/helm/charts/kratos/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: ory-commons + repository: file://../ory-commons + version: 0.1.0 +digest: sha256:eec8978215334aad38275f0171681f1200220dccef4762ddeb197679fd287abb +generated: "2024-06-11T14:37:29.230884+02:00" diff --git a/helm/charts/kratos/Chart.yaml b/helm/charts/kratos/Chart.yaml index 810216f12..0df15c071 100644 --- a/helm/charts/kratos/Chart.yaml +++ b/helm/charts/kratos/Chart.yaml @@ -5,3 +5,8 @@ name: kratos icon: https://raw.githubusercontent.com/ory/docs/master/docs/static/img/logo-kratos.svg version: 0.43.1 type: application +dependencies: + - name: ory-commons + version: 0.1.0 + repository: file://../ory-commons + alias: ory diff --git a/helm/charts/kratos/README.md b/helm/charts/kratos/README.md index 8f8b1d507..dd7ef22de 100644 --- a/helm/charts/kratos/README.md +++ b/helm/charts/kratos/README.md @@ -4,6 +4,12 @@ A ORY Kratos Helm chart for Kubernetes +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| file://../ory-commons | ory(ory-commons) | 0.1.0 | + ## Values | Key | Type | Default | Description | diff --git a/helm/charts/kratos/charts/ory-commons-0.1.0.tgz b/helm/charts/kratos/charts/ory-commons-0.1.0.tgz new file mode 100644 index 000000000..6f0211b87 Binary files /dev/null and b/helm/charts/kratos/charts/ory-commons-0.1.0.tgz differ diff --git a/helm/charts/kratos/templates/_helpers.tpl b/helm/charts/kratos/templates/_helpers.tpl index fa78daf73..939dbc061 100644 --- a/helm/charts/kratos/templates/_helpers.tpl +++ b/helm/charts/kratos/templates/_helpers.tpl @@ -213,3 +213,16 @@ Common labels for the cleanup cron job "app.kubernetes.io/component": cleanup "helm.sh/chart": {{ include "kratos.chart" . | quote }} {{- end -}} + +{{/* +Check if list contains object +*/}} +{{- define "kratos.extraEnvContainsEnvName" -}} + {{- $extraEnvs := index . 0 -}} + {{- $envName := index . 1 -}} + {{- range $k, $v := $extraEnvs -}} + {{- if eq $v.name $envName -}} + found + {{- end -}} + {{- end -}} +{{- end -}} diff --git a/helm/charts/kratos/templates/deployment-kratos.yaml b/helm/charts/kratos/templates/deployment-kratos.yaml index 5a3035174..dd68c9113 100644 --- a/helm/charts/kratos/templates/deployment-kratos.yaml +++ b/helm/charts/kratos/templates/deployment-kratos.yaml @@ -84,11 +84,13 @@ spec: {{- end }} env: {{- if not (empty ( include "kratos.dsn" . )) }} + {{- if not (include "ory.extraEnvContainsEnvName" (list $migrationExtraEnv "DSN")) }} - name: DSN valueFrom: secretKeyRef: name: {{ include "kratos.secretname" . }} key: dsn + {{- end }} {{- end }} {{- if $migrationExtraEnv }} {{- toYaml $migrationExtraEnv | nindent 12 }} @@ -104,7 +106,7 @@ spec: {{- end }} volumes: {{- if .Values.deployment.extraVolumes }} -{{ toYaml .Values.deployment.extraVolumes | indent 8 }} + {{- toYaml .Values.deployment.extraVolumes | nindent 8 }} {{- end }} - name: {{ include "kratos.name" . }}-config-volume configMap: @@ -154,11 +156,13 @@ spec: {{- end }} env: {{- if not (empty ( include "kratos.dsn" . )) }} + {{- if not (include "ory.extraEnvContainsEnvName" (list .Values.deployment.extraEnv "DSN")) }} - name: DSN valueFrom: secretKeyRef: name: {{ include "kratos.secretname" . }} key: dsn + {{- end }} {{- end }} - name: SECRETS_DEFAULT valueFrom: diff --git a/helm/charts/kratos/templates/job-migration.yaml b/helm/charts/kratos/templates/job-migration.yaml index f6d4f8ae4..dad5eb0b7 100644 --- a/helm/charts/kratos/templates/job-migration.yaml +++ b/helm/charts/kratos/templates/job-migration.yaml @@ -61,11 +61,13 @@ spec: {{- end }} env: {{- if not (empty ( include "kratos.dsn" . )) }} + {{- if not (include "ory.extraEnvContainsEnvName" (list $migrationExtraEnv "DSN")) }} - name: DSN valueFrom: secretKeyRef: name: {{ include "kratos.secretname" . }} key: dsn + {{- end }} {{- end }} {{- if $migrationExtraEnv }} {{- toYaml $migrationExtraEnv | nindent 10 }} diff --git a/helm/charts/kratos/templates/statefulset-mail.yaml b/helm/charts/kratos/templates/statefulset-mail.yaml index 10ca85c92..b5b19a07c 100644 --- a/helm/charts/kratos/templates/statefulset-mail.yaml +++ b/helm/charts/kratos/templates/statefulset-mail.yaml @@ -90,11 +90,13 @@ spec: - name: LOG_LEVEL value: {{ .Values.statefulSet.log.level }} {{- if not (empty ( include "kratos.dsn" . )) }} + {{- if not (include "ory.extraEnvContainsEnvName" (list $extraEnv "DSN")) }} - name: DSN valueFrom: secretKeyRef: name: {{ include "kratos.secretname" . }} key: dsn + {{- end }} {{- end }} - name: SECRETS_DEFAULT valueFrom: diff --git a/helm/charts/ory-commons/.helmignore b/helm/charts/ory-commons/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/helm/charts/ory-commons/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/charts/ory-commons/Chart.yaml b/helm/charts/ory-commons/Chart.yaml new file mode 100644 index 000000000..e1cdd2168 --- /dev/null +++ b/helm/charts/ory-commons/Chart.yaml @@ -0,0 +1,25 @@ +apiVersion: v2 +name: ory-commons +description: | + Collection of helper function for the Ory Helm environment + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: library + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "0.0.0" diff --git a/helm/charts/ory-commons/templates/_helpers.tpl b/helm/charts/ory-commons/templates/_helpers.tpl new file mode 100644 index 000000000..531b34c42 --- /dev/null +++ b/helm/charts/ory-commons/templates/_helpers.tpl @@ -0,0 +1,12 @@ +{{/* +Check if list contains object +*/}} +{{- define "ory.extraEnvContainsEnvName" -}} + {{- $extraEnvs := index . 0 -}} + {{- $envName := index . 1 -}} + {{- range $k, $v := $extraEnvs -}} + {{- if eq $v.name $envName -}} + found + {{- end -}} + {{- end -}} +{{- end -}}