diff --git a/.github/kubeval.sh b/.github/kubeval.sh index 49807c59..0c24056f 100755 --- a/.github/kubeval.sh +++ b/.github/kubeval.sh @@ -1,7 +1,7 @@ #!/bin/bash set -euo pipefail -CHART_DIRS="$(git diff --find-renames --name-only "$(git rev-parse --abbrev-ref HEAD)" remotes/origin/main -- helm | grep '[cC]hart.yaml' | sed -e 's#/[Cc]hart.yaml##g')" +CHART_DIRS="$(git diff --find-renames --name-only "$(git rev-parse --abbrev-ref HEAD)" remotes/origin/main -- helm | grep '[cC]hart.yaml' | grep -v 'helm/airbyte-v1' | sed -e 's#/[Cc]hart.yaml##g')" KUBEVAL_VERSION="0.14.0" SCHEMA_LOCATION="https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 282c54a2..90e41a64 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,8 +2,8 @@ name: Lint and Test Charts on: pull_request: - paths: - - 'helm/**' + paths-ignore: + - 'helm/airbyte-v1/**' jobs: lint-chart: @@ -56,4 +56,4 @@ jobs: uses: helm/chart-testing-action@main with: command: install - config: .github/ct.yaml \ No newline at end of file + config: .github/ct.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index db38651d..6bffd3a7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,8 +4,9 @@ on: branches: - main - eks_upgrade - paths: - - 'helm/**' + - airbyte_v1 + # paths-ignore: + # - 'helm/airbyte-v1/**' release: types: [published, created] @@ -20,3 +21,5 @@ jobs: with: token: ${{ secrets.BO_CHARTS_HELM_TOKEN }} charts_dir: helm + # Due to airbyte-v1 version incompatility with the current config of gh actions it always fails on linting so we switched it off + linting: off diff --git a/helm/airbyte-v1/.helmignore b/helm/airbyte-v1/.helmignore new file mode 100644 index 00000000..2b1b66e6 --- /dev/null +++ b/helm/airbyte-v1/.helmignore @@ -0,0 +1,26 @@ +# 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/ + +ci.sh +.cache/ diff --git a/helm/airbyte-v1/Chart.lock b/helm/airbyte-v1/Chart.lock new file mode 100644 index 00000000..c0718a1b --- /dev/null +++ b/helm/airbyte-v1/Chart.lock @@ -0,0 +1,51 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +- name: airbyte-bootloader + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- name: temporal + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- name: temporal-ui + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- name: webapp + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- name: server + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- name: worker + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- name: workload-api-server + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- name: workload-launcher + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- name: pod-sweeper + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- name: metrics + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- name: cron + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- name: connector-builder-server + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- name: connector-rollout-worker + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- name: keycloak + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- name: keycloak-setup + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +digest: sha256:f0a8ad517d58f33d56b16654e9b868a981e7dbac7af214473a8f486dc5a2e563 +generated: "2024-12-09T21:59:21.985259637Z" diff --git a/helm/airbyte-v1/Chart.yaml b/helm/airbyte-v1/Chart.yaml new file mode 100644 index 00000000..7006bc52 --- /dev/null +++ b/helm/airbyte-v1/Chart.yaml @@ -0,0 +1,72 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +- condition: airbyte-bootloader.enabled + name: airbyte-bootloader + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- condition: temporal.enabled + name: temporal + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- condition: temporal-ui.enabled + name: temporal-ui + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- condition: webapp.enabled + name: webapp + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- condition: server.enabled + name: server + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- condition: worker.enabled + name: worker + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- condition: workload-api-server.enabled + name: workload-api-server + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- condition: workload-launcher.enabled + name: workload-launcher + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- condition: pod-sweeper.enabled + name: pod-sweeper + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- condition: metrics.enabled + name: metrics + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- condition: cron.enabled + name: cron + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- condition: connector-builder-server.enabled + name: connector-builder-server + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- condition: connector-rollout-worker.enabled + name: connector-rollout-worker + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- condition: keycloak.enabled + name: keycloak + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +- condition: keycloak-setup.enabled + name: keycloak-setup + repository: https://airbytehq.github.io/helm-charts/ + version: 1.3.0 +description: Helm chart to deploy airbyte +name: airbyte-v1 +type: application +version: "v1.3.11" diff --git a/helm/airbyte-v1/charts/airbyte-bootloader/.gitignore b/helm/airbyte-v1/charts/airbyte-bootloader/.gitignore new file mode 100644 index 00000000..88e91e8a --- /dev/null +++ b/helm/airbyte-v1/charts/airbyte-bootloader/.gitignore @@ -0,0 +1,2 @@ +# Charts are downloaded at install time with `helm dep build`. +charts diff --git a/helm/airbyte-v1/charts/airbyte-bootloader/Chart.lock b/helm/airbyte-v1/charts/airbyte-bootloader/Chart.lock new file mode 100644 index 00000000..fb39f2dc --- /dev/null +++ b/helm/airbyte-v1/charts/airbyte-bootloader/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2022-10-17T18:35:11.238826963Z" diff --git a/helm/airbyte-v1/charts/airbyte-bootloader/Chart.yaml b/helm/airbyte-v1/charts/airbyte-bootloader/Chart.yaml new file mode 100644 index 00000000..1c903e66 --- /dev/null +++ b/helm/airbyte-v1/charts/airbyte-bootloader/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: Helm chart to deploy airbyte-bootloader +name: airbyte-bootloader +type: application +version: 1.3.0 diff --git a/helm/airbyte-v1/charts/airbyte-bootloader/README.md b/helm/airbyte-v1/charts/airbyte-bootloader/README.md new file mode 100644 index 00000000..ceaa5352 --- /dev/null +++ b/helm/airbyte-v1/charts/airbyte-bootloader/README.md @@ -0,0 +1,47 @@ +# airbyte-bootloader + +![Version: 0.67.17](https://img.shields.io/badge/Version-0.67.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: dev](https://img.shields.io/badge/AppVersion-dev-informational?style=flat-square) + +Helm chart to deploy airbyte-bootloader + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 1.x.x | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| containerSecurityContext | object | `{}` | | +| enabled | bool | `true` | | +| env_vars | object | `{}` | | +| extraContainers | list | `[]` | | +| extraEnv | list | `[]` | | +| extraInitContainers | list | `[]` | | +| extraLabels | object | `{}` | | +| extraSelectorLabels | object | `{}` | | +| extraVolumeMounts | list | `[]` | | +| extraVolumes | list | `[]` | | +| global.database.secretName | string | `""` | | +| global.database.secretValue | string | `""` | | +| global.deploymentMode | string | `"oss"` | | +| global.env_vars | object | `{}` | | +| global.extraContainers | list | `[]` | | +| global.extraLabels | object | `{}` | | +| global.extraSelectorLabels | object | `{}` | | +| global.secretName | string | `""` | | +| global.secrets | object | `{}` | | +| global.serviceAccountName | string | `"placeholderServiceAccount"` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"airbyte/bootloader"` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| resources.limits | object | `{}` | | +| resources.requests | object | `{}` | | +| secrets | object | `{}` | | +| tolerations | list | `[]` | | + diff --git a/helm/airbyte-v1/charts/airbyte-bootloader/templates/_helpers.tpl b/helm/airbyte-v1/charts/airbyte-bootloader/templates/_helpers.tpl new file mode 100644 index 00000000..2b326d75 --- /dev/null +++ b/helm/airbyte-v1/charts/airbyte-bootloader/templates/_helpers.tpl @@ -0,0 +1,51 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "airbyte.labels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "airbyte.selectorLabels" -}} +app.kubernetes.io/name: {{ include "airbyte.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/helm/airbyte-v1/charts/airbyte-bootloader/templates/_images.tpl b/helm/airbyte-v1/charts/airbyte-bootloader/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/charts/airbyte-bootloader/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/airbyte-bootloader/templates/bootloader-secrets.yaml b/helm/airbyte-v1/charts/airbyte-bootloader/templates/bootloader-secrets.yaml new file mode 100644 index 00000000..202def0e --- /dev/null +++ b/helm/airbyte-v1/charts/airbyte-bootloader/templates/bootloader-secrets.yaml @@ -0,0 +1,18 @@ +# Create secrets only for the local deployment +{{- if .Values.secrets }} +apiVersion: v1 +kind: Secret +metadata: + name: bootloader-secrets + labels: + {{- include "airbyte.labels" . | nindent 4 }} + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-1" + +type: Opaque +data: + {{- range $k, $v := mergeOverwrite .Values.secrets .Values.global.secrets }} + {{ $k }}: {{ if $v }}{{ $v | b64enc }} {{else}}""{{end}} + {{- end }} + {{- end }} diff --git a/helm/airbyte-v1/charts/airbyte-bootloader/templates/pod.yaml b/helm/airbyte-v1/charts/airbyte-bootloader/templates/pod.yaml new file mode 100644 index 00000000..8a72fa90 --- /dev/null +++ b/helm/airbyte-v1/charts/airbyte-bootloader/templates/pod.yaml @@ -0,0 +1,130 @@ +--- +apiVersion: v1 +kind: Pod +metadata: + name: {{ include "common.names.fullname" . }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} + {{- if .Values.extraLabels }} + {{ toYaml (mergeOverwrite .Values.extraLabels .Values.global.extraLabels) | nindent 4 }} + {{- end }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 4 }} + {{- end }} + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "0" + {{- if .Values.podAnnotations }} + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 4 }} + {{- end }} +spec: + serviceAccountName: {{ .Values.global.serviceAccountName }} + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 2 }} + {{- end }} + {{- end }} + restartPolicy: Never + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.extraInitContainers }} + initContainers: + {{- toYaml .Values.extraInitContainers | nindent 4 }} + {{- end }} + containers: + - name: airbyte-bootloader-container + image: {{ include "imageUrl" (list .Values.image $) }} + imagePullPolicy: "{{ .Values.image.pullPolicy }}" + env: + {{- if eq .Values.global.deploymentMode "oss" }} + - name: AIRBYTE_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Values.global.configMapName | default (printf "%s-airbyte-env" .Release.Name) }} + key: AIRBYTE_VERSION + - name: RUN_DATABASE_MIGRATION_ON_STARTUP + valueFrom: + configMapKeyRef: + name: {{ .Values.global.configMapName | default (printf "%s-airbyte-env" .Release.Name) }} + key: RUN_DATABASE_MIGRATION_ON_STARTUP + + # Airbyte auth secret keys and values + {{- if and (eq .Values.global.edition "community") .Values.global.auth.enabled }} + - name: AB_AUTH_SECRET_CREATION_ENABLED + value: "true" + - name: AB_KUBERNETES_SECRET_NAME + value: {{ .Values.global.auth.secretName | default "airbyte-auth-secrets" | quote }} + - name: AB_INSTANCE_ADMIN_PASSWORD_SECRET_KEY + value: {{ .Values.global.auth.instanceAdmin.passwordSecretKey | default "instance-admin-password" | quote }} + - name: AB_INSTANCE_ADMIN_CLIENT_ID_SECRET_KEY + value: {{ .Values.global.auth.instanceAdmin.clientIdSecretKey | default "instance-admin-client-id" | quote }} + - name: AB_INSTANCE_ADMIN_CLIENT_SECRET_SECRET_KEY + value: {{ .Values.global.auth.instanceAdmin.clientSecretSecretKey | default "instance-admin-client-secret" | quote }} + - name: AB_JWT_SIGNATURE_SECRET_KEY + value: {{ .Values.global.auth.jwtSignatureSecretKey | default "jwt-signature-secret" | quote }} + - name: AB_INSTANCE_ADMIN_PASSWORD + value: {{ .Values.global.auth.instanceAdmin.password | quote }} + - name: AB_INSTANCE_ADMIN_CLIENT_ID + value: {{ .Values.global.auth.instanceAdmin.clientId | quote }} + - name: AB_INSTANCE_ADMIN_CLIENT_SECRET + value: {{ .Values.global.auth.instanceAdmin.clientSecret | quote }} + - name: AB_JWT_SIGNATURE_SECRET + value: {{ .Values.global.auth.jwtSignatureSecret | quote }} + {{- end }} + + {{- include "airbyte.database.envs" . | nindent 8 }} + + {{- end }} + # Values from secret + {{- if .Values.secrets }} + {{- range $k, $v := .Values.secrets }} + - name: {{ $k }} + valueFrom: + secretKeyRef: + name: bootloader-secrets + key: {{ $k }} + {{- end }} + {{- end }} + + # Values from env + {{- if or .Values.env_vars .Values.global.env_vars }} + {{- range $k, $v := mergeOverwrite .Values.env_vars .Values.global.env_vars }} + - name: {{ $k }} + value: {{ $v | quote }} + {{- end }} + {{- end }} + + # Values from extraEnv for more compability(if you want to use external secret source or other stuff) + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 8 }} + {{- end }} + + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 8 }} + {{- end }} + {{- if .Values.extraVolumeMounts }} + volumeMounts: + {{- toYaml .Values.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.containerSecurityContext }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 8 }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 4 }} + {{- end }} + {{- if .Values.global.extraContainers }} + {{ toYaml .Values.global.extraContainers | nindent 4 }} + {{- end }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 6 }} + {{- if .Values.extraVolumes }} + volumes: + {{- toYaml .Values.extraVolumes | nindent 4 }} + {{- end }} diff --git a/helm/airbyte-v1/charts/airbyte-bootloader/values.yaml b/helm/airbyte-v1/charts/airbyte-bootloader/values.yaml new file mode 100644 index 00000000..ee3bc615 --- /dev/null +++ b/helm/airbyte-v1/charts/airbyte-bootloader/values.yaml @@ -0,0 +1,189 @@ +## global.serviceAccountName Name of service account to be associated with service +## deploymentMode Determines deployment mode of airbyte +## secretName Overrides the secret name with credentials to S3 Bucket and logging +## database.secretName Name of database secret +## database.secretValue Value of database password key stored in secret +global: + serviceAccountName: placeholderServiceAccount + deploymentMode: oss + secretName: "" + database: + secretName: "" + secretValue: "" + secrets: {} + env_vars: {} + extraContainers: [] + ## extraSelectorLabels [object] - use to specify own additional selector labels for deployment + extraSelectorLabels: {} + ## extraLabels [object] - use to specify own additional labels for deployment + extraLabels: {} + +# Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "" + + +enabled: true +## image.repository The repository to use for the airbyte bootloader image. +## image.pullPolicy the pull policy to use for the airbyte bootloader image +## image.tag The airbyte bootloader image tag. Defaults to the chart's AppVersion +image: + repository: airbyte/bootloader + pullPolicy: IfNotPresent + +## podAnnotations [object] Add extra annotations to the bootloader pod +## +podAnnotations: {} + +## podLabels [object] Add extra labels to the bootloader pod +## +podLabels: {} + +## containerSecurityContext Security context for the container +## Examples: +## containerSecurityContext: +## runAsNonRoot: true +## runAsUser: 1000 +## readOnlyRootFilesystem: true +containerSecurityContext: {} + +## nodeSelector [object] Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## tolerations [array] Tolerations for worker pod assignment. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## Bootloader resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## We usually recommend not to specify default resources and to leave this as a conscious +## choice for the user. This also increases chances charts run on environments with little +## resources, such as Minikube. If you do want to specify resources, uncomment the following +## lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## bootloader.resources.limits [object] The resources limits for the airbyte bootloader image +## bootloader.resources.requests [object] The requested resources for the airbyte bootloader image +resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + +## affinity [object] Affinity and anti-affinity for bootloader pod assignment. +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## extraEnv [array] Supply extra env variables to main container using full notation +## Example: (With default env vars and values taken from generated config map) +## extraEnv: +## - name: AIRBYTE_VERSION +## valueFrom: +## configMapKeyRef: +## name: airbyte-env +## key: AIRBYTE_VERSION +## - name: DATABASE_HOST +## valueFrom: +## configMapKeyRef: +## name: airbyte-env +## key: DATABASE_HOST +## - name: DATABASE_PORT +## valueFrom: +## configMapKeyRef: +## name: airbyte-env +## key: DATABASE_PORT +## - name: DATABASE_PASSWORD +## valueFrom: +## secretKeyRef: +## name: airbyte-secrets +## key: DATABASE_PASSWORD +## - name: DATABASE_URL +## valueFrom: +## configMapKeyRef: +## name: airbyte-env +## key: DATABASE_URL +## - name: DATABASE_USER +## valueFrom: +## secretKeyRef: +## name: airbyte-secrets +## key: DATABASE_USER +## +extraEnv: [] + +## secrets [object] Supply additional secrets to container +## Example: +## secrets: +## DATABASE_PASSWORD: strong-password +## DATABASE_USER: my-db-user +secrets: {} + +## extraContainer [array] Additional container for server pod(s) +## Example: +# extraContainers: +# - name: otel_collector +# image: somerepo/someimage:sometag +# args: [ +# "--important-args" +# ] +# ports: +# - containerPort: 443 +# volumeMounts: +# - name: volumeMountCool +# mountPath: /some/path +# readOnly: true +extraContainers: [] + +## extraInitContainers [array] Additional init containers for server pod(s) +## Example: +# extraInitContainers: +# - name: sleepy +# image: alpine +# command: ['sleep', '60'] + +extraInitContainers: [] + +## extraVolumeMounts [array] Additional volumeMounts for server container(s). +## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumeMounts: +## - name: tmpdir +## mountPath: /tmp +## +extraVolumeMounts: [] + +## extraVolumes [array] Additional volumes for server pod(s). +## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumes: +## - name: tmpdir +## emptyDir: {} +## +extraVolumes: [] + +## env_vars [object] Supply extra env variables to main container using simplified notation +## Example: +# env_vars: +# AIRBYTE_VERSION: 0.40.4 + +# # Airbyte Internal Database, see https://docs.airbyte.io/operator-guides/configuring-airbyte-db +# DATABASE_HOST: airbyte-db-svc +# DATABASE_PORT: 5432 +# # translate manually DATABASE_URL: jdbc:postgresql://${DATABASE_HOST}:${DATABASE_PORT/${DATABASE_DB} +# DATABASE_URL: jdbc:postgresql://airbyte-db-svc:5432/airbyte +# DATABASE_PASSWORD: 12345 +# DATABASE_USER: airbyte +env_vars: {} + +## extraSelectorLabels [object] - use to specify own additional selector labels for deployment +extraSelectorLabels: {} +## extraLabels [object] - use to specify own additional labels for deployment +extraLabels: {} diff --git a/helm/airbyte-v1/charts/common/.helmignore b/helm/airbyte-v1/charts/common/.helmignore new file mode 100644 index 00000000..50af0317 --- /dev/null +++ b/helm/airbyte-v1/charts/common/.helmignore @@ -0,0 +1,22 @@ +# 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 +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/airbyte-v1/charts/common/Chart.yaml b/helm/airbyte-v1/charts/common/Chart.yaml new file mode 100644 index 00000000..39edbb3c --- /dev/null +++ b/helm/airbyte-v1/charts/common/Chart.yaml @@ -0,0 +1,23 @@ +annotations: + category: Infrastructure +apiVersion: v2 +appVersion: 1.17.1 +description: A Library Helm Chart for grouping common logic between bitnami charts. + This chart is not deployable by itself. +home: https://github.com/bitnami/charts/tree/master/bitnami/common +icon: https://bitnami.com/downloads/logos/bitnami-mark.png +keywords: +- common +- helper +- template +- function +- bitnami +maintainers: +- name: Bitnami + url: https://github.com/bitnami/charts +name: common +sources: +- https://github.com/bitnami/charts +- https://www.bitnami.com/ +type: library +version: 1.17.1 diff --git a/helm/airbyte-v1/charts/common/README.md b/helm/airbyte-v1/charts/common/README.md new file mode 100644 index 00000000..a2ecd604 --- /dev/null +++ b/helm/airbyte-v1/charts/common/README.md @@ -0,0 +1,350 @@ +# Bitnami Common Library Chart + +A [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between bitnami charts. + +## TL;DR + +```yaml +dependencies: + - name: common + version: 1.x.x + repository: https://charts.bitnami.com/bitnami +``` + +```bash +$ helm dependency update +``` + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.names.fullname" . }} +data: + myvalue: "Hello World" +``` + +## Introduction + +This chart provides a common template helpers which can be used to develop new charts using [Helm](https://helm.sh) package manager. + +Bitnami charts can be used with [Kubeapps](https://kubeapps.dev/) for deployment and management of Helm Charts in clusters. + +## Prerequisites + +- Kubernetes 1.19+ +- Helm 3.2.0+ + +## Parameters + +The following table lists the helpers available in the library which are scoped in different sections. + +### Affinities + +| Helper identifier | Description | Expected Input | +|-------------------------------|------------------------------------------------------|------------------------------------------------| +| `common.affinities.nodes.soft` | Return a soft nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` | +| `common.affinities.nodes.hard` | Return a hard nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` | +| `common.affinities.pods.soft` | Return a soft podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` | +| `common.affinities.pods.hard` | Return a hard podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` | + +### Capabilities + +| Helper identifier | Description | Expected Input | +|------------------------------------------------|------------------------------------------------------------------------------------------------|-------------------| +| `common.capabilities.kubeVersion` | Return the target Kubernetes version (using client default if .Values.kubeVersion is not set). | `.` Chart context | +| `common.capabilities.cronjob.apiVersion` | Return the appropriate apiVersion for cronjob. | `.` Chart context | +| `common.capabilities.deployment.apiVersion` | Return the appropriate apiVersion for deployment. | `.` Chart context | +| `common.capabilities.statefulset.apiVersion` | Return the appropriate apiVersion for statefulset. | `.` Chart context | +| `common.capabilities.ingress.apiVersion` | Return the appropriate apiVersion for ingress. | `.` Chart context | +| `common.capabilities.rbac.apiVersion` | Return the appropriate apiVersion for RBAC resources. | `.` Chart context | +| `common.capabilities.crd.apiVersion` | Return the appropriate apiVersion for CRDs. | `.` Chart context | +| `common.capabilities.policy.apiVersion` | Return the appropriate apiVersion for podsecuritypolicy. | `.` Chart context | +| `common.capabilities.networkPolicy.apiVersion` | Return the appropriate apiVersion for networkpolicy. | `.` Chart context | +| `common.capabilities.apiService.apiVersion` | Return the appropriate apiVersion for APIService. | `.` Chart context | +| `common.capabilities.hpa.apiVersion` | Return the appropriate apiVersion for Horizontal Pod Autoscaler | `.` Chart context | +| `common.capabilities.supportsHelmVersion` | Returns true if the used Helm version is 3.3+ | `.` Chart context | + +### Errors + +| Helper identifier | Description | Expected Input | +|-----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| +| `common.errors.upgrade.passwords.empty` | It will ensure required passwords are given when we are upgrading a chart. If `validationErrors` is not empty it will throw an error and will stop the upgrade action. | `dict "validationErrors" (list $validationError00 $validationError01) "context" $` | + +### Images + +| Helper identifier | Description | Expected Input | +|-----------------------------|------------------------------------------------------|---------------------------------------------------------------------------------------------------------| +| `common.images.image` | Return the proper and full image name | `dict "imageRoot" .Values.path.to.the.image "global" $`, see [ImageRoot](#imageroot) for the structure. | +| `common.images.pullSecrets` | Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global` | +| `common.images.renderPullSecrets` | Return the proper Docker Image Registry Secret Names (evaluates values as templates) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $` | + +### Ingress + +| Helper identifier | Description | Expected Input | +|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.ingress.backend` | Generate a proper Ingress backend entry depending on the API version | `dict "serviceName" "foo" "servicePort" "bar"`, see the [Ingress deprecation notice](https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/) for the syntax differences | +| `common.ingress.supportsPathType` | Prints "true" if the pathType field is supported | `.` Chart context | +| `common.ingress.supportsIngressClassname` | Prints "true" if the ingressClassname field is supported | `.` Chart context | +| `common.ingress.certManagerRequest` | Prints "true" if required cert-manager annotations for TLS signed certificates are set in the Ingress annotations | `dict "annotations" .Values.path.to.the.ingress.annotations` | + +### Labels + +| Helper identifier | Description | Expected Input | +|-----------------------------|-----------------------------------------------------------------------------|-------------------| +| `common.labels.standard` | Return Kubernetes standard labels | `.` Chart context | +| `common.labels.matchLabels` | Labels to use on `deploy.spec.selector.matchLabels` and `svc.spec.selector` | `.` Chart context | + +### Names + +| Helper identifier | Description | Expected Input | +|-----------------------------------|-----------------------------------------------------------------------|-------------------| +| `common.names.name` | Expand the name of the chart or use `.Values.nameOverride` | `.` Chart context | +| `common.names.fullname` | Create a default fully qualified app name. | `.` Chart context | +| `common.names.namespace` | Allow the release namespace to be overridden | `.` Chart context | +| `common.names.fullname.namespace` | Create a fully qualified app name adding the installation's namespace | `.` Chart context | +| `common.names.chart` | Chart name plus version | `.` Chart context | + +### Secrets + +| Helper identifier | Description | Expected Input | +|---------------------------|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.secrets.name` | Generate the name of the secret. | `dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $` see [ExistingSecret](#existingsecret) for the structure. | +| `common.secrets.key` | Generate secret key. | `dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName"` see [ExistingSecret](#existingsecret) for the structure. | +| `common.passwords.manage` | Generate secret password or retrieve one if already created. | `dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $`, length, strong and chartNAme fields are optional. | +| `common.secrets.exists` | Returns whether a previous generated secret already exists. | `dict "secret" "secret-name" "context" $` | + +### Storage + +| Helper identifier | Description | Expected Input | +|-------------------------------|---------------------------------------|---------------------------------------------------------------------------------------------------------------------| +| `common.storage.class` | Return the proper Storage Class | `dict "persistence" .Values.path.to.the.persistence "global" $`, see [Persistence](#persistence) for the structure. | + +### TplValues + +| Helper identifier | Description | Expected Input | +|---------------------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.tplvalues.render` | Renders a value that contains template | `dict "value" .Values.path.to.the.Value "context" $`, value is the value should rendered as template, context frequently is the chart context `$` or `.` | + +### Utils + +| Helper identifier | Description | Expected Input | +|--------------------------------|------------------------------------------------------------------------------------------|------------------------------------------------------------------------| +| `common.utils.fieldToEnvVar` | Build environment variable name given a field. | `dict "field" "my-password"` | +| `common.utils.secret.getvalue` | Print instructions to get a secret value. | `dict "secret" "secret-name" "field" "secret-value-field" "context" $` | +| `common.utils.getValueFromKey` | Gets a value from `.Values` object given its key path | `dict "key" "path.to.key" "context" $` | +| `common.utils.getKeyFromList` | Returns first `.Values` key with a defined value or first of the list if all non-defined | `dict "keys" (list "path.to.key1" "path.to.key2") "context" $` | + +### Validations + +| Helper identifier | Description | Expected Input | +|--------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.validations.values.single.empty` | Validate a value must not be empty. | `dict "valueKey" "path.to.value" "secret" "secret.name" "field" "my-password" "subchart" "subchart" "context" $` secret, field and subchart are optional. In case they are given, the helper will generate a how to get instruction. See [ValidateValue](#validatevalue) | +| `common.validations.values.multiple.empty` | Validate a multiple values must not be empty. It returns a shared error for all the values. | `dict "required" (list $validateValueConf00 $validateValueConf01) "context" $`. See [ValidateValue](#validatevalue) | +| `common.validations.values.mariadb.passwords` | This helper will ensure required password for MariaDB are not empty. It returns a shared error for all the values. | `dict "secret" "mariadb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mariadb chart and the helper. | +| `common.validations.values.mysql.passwords` | This helper will ensure required password for MySQL are not empty. It returns a shared error for all the values. | `dict "secret" "mysql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mysql chart and the helper. | +| `common.validations.values.postgresql.passwords` | This helper will ensure required password for PostgreSQL are not empty. It returns a shared error for all the values. | `dict "secret" "postgresql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use postgresql chart and the helper. | +| `common.validations.values.redis.passwords` | This helper will ensure required password for Redis® are not empty. It returns a shared error for all the values. | `dict "secret" "redis-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use redis chart and the helper. | +| `common.validations.values.cassandra.passwords` | This helper will ensure required password for Cassandra are not empty. It returns a shared error for all the values. | `dict "secret" "cassandra-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use cassandra chart and the helper. | +| `common.validations.values.mongodb.passwords` | This helper will ensure required password for MongoDB® are not empty. It returns a shared error for all the values. | `dict "secret" "mongodb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mongodb chart and the helper. | + +### Warnings + +| Helper identifier | Description | Expected Input | +|------------------------------|----------------------------------|------------------------------------------------------------| +| `common.warnings.rollingTag` | Warning about using rolling tag. | `ImageRoot` see [ImageRoot](#imageroot) for the structure. | + +## Special input schemas + +### ImageRoot + +```yaml +registry: + type: string + description: Docker registry where the image is located + example: docker.io + +repository: + type: string + description: Repository and image name + example: bitnami/nginx + +tag: + type: string + description: image tag + example: 1.16.1-debian-10-r63 + +pullPolicy: + type: string + description: Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + +pullSecrets: + type: array + items: + type: string + description: Optionally specify an array of imagePullSecrets (evaluated as templates). + +debug: + type: boolean + description: Set to true if you would like to see extra information on logs + example: false + +## An instance would be: +# registry: docker.io +# repository: bitnami/nginx +# tag: 1.16.1-debian-10-r63 +# pullPolicy: IfNotPresent +# debug: false +``` + +### Persistence + +```yaml +enabled: + type: boolean + description: Whether enable persistence. + example: true + +storageClass: + type: string + description: Ghost data Persistent Volume Storage Class, If set to "-", storageClassName: "" which disables dynamic provisioning. + example: "-" + +accessMode: + type: string + description: Access mode for the Persistent Volume Storage. + example: ReadWriteOnce + +size: + type: string + description: Size the Persistent Volume Storage. + example: 8Gi + +path: + type: string + description: Path to be persisted. + example: /bitnami + +## An instance would be: +# enabled: true +# storageClass: "-" +# accessMode: ReadWriteOnce +# size: 8Gi +# path: /bitnami +``` + +### ExistingSecret + +```yaml +name: + type: string + description: Name of the existing secret. + example: mySecret +keyMapping: + description: Mapping between the expected key name and the name of the key in the existing secret. + type: object + +## An instance would be: +# name: mySecret +# keyMapping: +# password: myPasswordKey +``` + +#### Example of use + +When we store sensitive data for a deployment in a secret, some times we want to give to users the possibility of using theirs existing secrets. + +```yaml +# templates/secret.yaml +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.names.fullname" . }} + labels: + app: {{ include "common.names.fullname" . }} +type: Opaque +data: + password: {{ .Values.password | b64enc | quote }} + +# templates/dpl.yaml +--- +... + env: + - name: PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "common.secrets.name" (dict "existingSecret" .Values.existingSecret "context" $) }} + key: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "password") }} +... + +# values.yaml +--- +name: mySecret +keyMapping: + password: myPasswordKey +``` + +### ValidateValue + +#### NOTES.txt + +```console +{{- $validateValueConf00 := (dict "valueKey" "path.to.value00" "secret" "secretName" "field" "password-00") -}} +{{- $validateValueConf01 := (dict "valueKey" "path.to.value01" "secret" "secretName" "field" "password-01") -}} + +{{ include "common.validations.values.multiple.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }} +``` + +If we force those values to be empty we will see some alerts + +```console +$ helm install test mychart --set path.to.value00="",path.to.value01="" + 'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value: + + export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 -d) + + 'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value: + + export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 -d) +``` + +## Upgrading + +### To 1.0.0 + +[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL. + +**What changes were introduced in this major version?** + +- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field. +- Use `type: library`. [Here](https://v3.helm.sh/docs/faq/#library-chart-support) you can find more information. +- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts + +**Considerations when upgrading to this version** + +- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues +- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore +- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3 + +**Useful links** + +- https://docs.bitnami.com/tutorials/resolve-helm2-helm3-post-migration-issues/ +- https://helm.sh/docs/topics/v2_v3_migration/ +- https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/ + +## License + +Copyright © 2022 Bitnami + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/helm/airbyte-v1/charts/common/templates/_affinities.tpl b/helm/airbyte-v1/charts/common/templates/_affinities.tpl new file mode 100644 index 00000000..2387be26 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/_affinities.tpl @@ -0,0 +1,102 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Return a soft nodeAffinity definition +{{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes.soft" -}} +preferredDuringSchedulingIgnoredDuringExecution: + - preference: + matchExpressions: + - key: {{ .key }} + operator: In + values: + {{- range .values }} + - {{ . | quote }} + {{- end }} + weight: 1 +{{- end -}} + +{{/* +Return a hard nodeAffinity definition +{{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes.hard" -}} +requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: {{ .key }} + operator: In + values: + {{- range .values }} + - {{ . | quote }} + {{- end }} +{{- end -}} + +{{/* +Return a nodeAffinity definition +{{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes" -}} + {{- if eq .type "soft" }} + {{- include "common.affinities.nodes.soft" . -}} + {{- else if eq .type "hard" }} + {{- include "common.affinities.nodes.hard" . -}} + {{- end -}} +{{- end -}} + +{{/* +Return a soft podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods.soft" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}} +*/}} +{{- define "common.affinities.pods.soft" -}} +{{- $component := default "" .component -}} +{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} +preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 10 }} + {{- if not (empty $component) }} + {{ printf "app.kubernetes.io/component: %s" $component }} + {{- end }} + {{- range $key, $value := $extraMatchLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + namespaces: + - {{ include "common.names.namespace" .context | quote }} + topologyKey: kubernetes.io/hostname + weight: 1 +{{- end -}} + +{{/* +Return a hard podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods.hard" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}} +*/}} +{{- define "common.affinities.pods.hard" -}} +{{- $component := default "" .component -}} +{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} +requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 8 }} + {{- if not (empty $component) }} + {{ printf "app.kubernetes.io/component: %s" $component }} + {{- end }} + {{- range $key, $value := $extraMatchLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + namespaces: + - {{ include "common.names.namespace" .context | quote }} + topologyKey: kubernetes.io/hostname +{{- end -}} + +{{/* +Return a podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.pods" -}} + {{- if eq .type "soft" }} + {{- include "common.affinities.pods.soft" . -}} + {{- else if eq .type "hard" }} + {{- include "common.affinities.pods.hard" . -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/_capabilities.tpl b/helm/airbyte-v1/charts/common/templates/_capabilities.tpl new file mode 100644 index 00000000..9d9b7600 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/_capabilities.tpl @@ -0,0 +1,154 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Return the target Kubernetes version +*/}} +{{- define "common.capabilities.kubeVersion" -}} +{{- if .Values.global }} + {{- if .Values.global.kubeVersion }} + {{- .Values.global.kubeVersion -}} + {{- else }} + {{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} + {{- end -}} +{{- else }} +{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for poddisruptionbudget. +*/}} +{{- define "common.capabilities.policy.apiVersion" -}} +{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "policy/v1beta1" -}} +{{- else -}} +{{- print "policy/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for networkpolicy. +*/}} +{{- define "common.capabilities.networkPolicy.apiVersion" -}} +{{- if semverCompare "<1.7-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for cronjob. +*/}} +{{- define "common.capabilities.cronjob.apiVersion" -}} +{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "batch/v1beta1" -}} +{{- else -}} +{{- print "batch/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for deployment. +*/}} +{{- define "common.capabilities.deployment.apiVersion" -}} +{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for statefulset. +*/}} +{{- define "common.capabilities.statefulset.apiVersion" -}} +{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apps/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for ingress. +*/}} +{{- define "common.capabilities.ingress.apiVersion" -}} +{{- if .Values.ingress -}} +{{- if .Values.ingress.apiVersion -}} +{{- .Values.ingress.apiVersion -}} +{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end }} +{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for RBAC resources. +*/}} +{{- define "common.capabilities.rbac.apiVersion" -}} +{{- if semverCompare "<1.17-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "rbac.authorization.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "rbac.authorization.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for CRDs. +*/}} +{{- define "common.capabilities.crd.apiVersion" -}} +{{- if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apiextensions.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "apiextensions.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for APIService. +*/}} +{{- define "common.capabilities.apiService.apiVersion" -}} +{{- if semverCompare "<1.10-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apiregistration.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "apiregistration.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for Horizontal Pod Autoscaler. +*/}} +{{- define "common.capabilities.hpa.apiVersion" -}} +{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .context) -}} +{{- if .beta2 -}} +{{- print "autoscaling/v2beta2" -}} +{{- else -}} +{{- print "autoscaling/v2beta1" -}} +{{- end -}} +{{- else -}} +{{- print "autoscaling/v2" -}} +{{- end -}} +{{- end -}} + +{{/* +Returns true if the used Helm version is 3.3+. +A way to check the used Helm version was not introduced until version 3.3.0 with .Capabilities.HelmVersion, which contains an additional "{}}" structure. +This check is introduced as a regexMatch instead of {{ if .Capabilities.HelmVersion }} because checking for the key HelmVersion in <3.3 results in a "interface not found" error. +**To be removed when the catalog's minimun Helm version is 3.3** +*/}} +{{- define "common.capabilities.supportsHelmVersion" -}} +{{- if regexMatch "{(v[0-9])*[^}]*}}$" (.Capabilities | toString ) }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/_errors.tpl b/helm/airbyte-v1/charts/common/templates/_errors.tpl new file mode 100644 index 00000000..a79cc2e3 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/_errors.tpl @@ -0,0 +1,23 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Through error when upgrading using empty passwords values that must not be empty. + +Usage: +{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}} +{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}} +{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }} + +Required password params: + - validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error. + - context - Context - Required. Parent context. +*/}} +{{- define "common.errors.upgrade.passwords.empty" -}} + {{- $validationErrors := join "" .validationErrors -}} + {{- if and $validationErrors .context.Release.IsUpgrade -}} + {{- $errorString := "\nPASSWORDS ERROR: You must provide your current passwords when upgrading the release." -}} + {{- $errorString = print $errorString "\n Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims." -}} + {{- $errorString = print $errorString "\n Further information can be obtained at https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases" -}} + {{- $errorString = print $errorString "\n%s" -}} + {{- printf $errorString $validationErrors | fail -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/_images.tpl b/helm/airbyte-v1/charts/common/templates/_images.tpl new file mode 100644 index 00000000..42ffbc72 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/_images.tpl @@ -0,0 +1,75 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Return the proper image name +{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }} +*/}} +{{- define "common.images.image" -}} +{{- $registryName := .imageRoot.registry -}} +{{- $repositoryName := .imageRoot.repository -}} +{{- $tag := .imageRoot.tag | toString -}} +{{- if .global }} + {{- if .global.imageRegistry }} + {{- $registryName = .global.imageRegistry -}} + {{- end -}} +{{- end -}} +{{- if $registryName }} +{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- else -}} +{{- printf "%s:%s" $repositoryName $tag -}} +{{- end -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) +{{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }} +*/}} +{{- define "common.images.pullSecrets" -}} + {{- $pullSecrets := list }} + + {{- if .global }} + {{- range .global.imagePullSecrets -}} + {{- $pullSecrets = append $pullSecrets . -}} + {{- end -}} + {{- end -}} + + {{- range .images -}} + {{- range .pullSecrets -}} + {{- $pullSecrets = append $pullSecrets . -}} + {{- end -}} + {{- end -}} + + {{- if (not (empty $pullSecrets)) }} +imagePullSecrets: + {{- range $pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names evaluating values as templates +{{ include "common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }} +*/}} +{{- define "common.images.renderPullSecrets" -}} + {{- $pullSecrets := list }} + {{- $context := .context }} + + {{- if $context.Values.global }} + {{- range $context.Values.global.imagePullSecrets -}} + {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} + {{- end -}} + {{- end -}} + + {{- range .images -}} + {{- range .pullSecrets -}} + {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} + {{- end -}} + {{- end -}} + + {{- if (not (empty $pullSecrets)) }} +imagePullSecrets: + {{- range $pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/_ingress.tpl b/helm/airbyte-v1/charts/common/templates/_ingress.tpl new file mode 100644 index 00000000..8caf73a6 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/_ingress.tpl @@ -0,0 +1,68 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Generate backend entry that is compatible with all Kubernetes API versions. + +Usage: +{{ include "common.ingress.backend" (dict "serviceName" "backendName" "servicePort" "backendPort" "context" $) }} + +Params: + - serviceName - String. Name of an existing service backend + - servicePort - String/Int. Port name (or number) of the service. It will be translated to different yaml depending if it is a string or an integer. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "common.ingress.backend" -}} +{{- $apiVersion := (include "common.capabilities.ingress.apiVersion" .context) -}} +{{- if or (eq $apiVersion "extensions/v1beta1") (eq $apiVersion "networking.k8s.io/v1beta1") -}} +serviceName: {{ .serviceName }} +servicePort: {{ .servicePort }} +{{- else -}} +service: + name: {{ .serviceName }} + port: + {{- if typeIs "string" .servicePort }} + name: {{ .servicePort }} + {{- else if or (typeIs "int" .servicePort) (typeIs "float64" .servicePort) }} + number: {{ .servicePort | int }} + {{- end }} +{{- end -}} +{{- end -}} + +{{/* +Print "true" if the API pathType field is supported +Usage: +{{ include "common.ingress.supportsPathType" . }} +*/}} +{{- define "common.ingress.supportsPathType" -}} +{{- if (semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .)) -}} +{{- print "false" -}} +{{- else -}} +{{- print "true" -}} +{{- end -}} +{{- end -}} + +{{/* +Returns true if the ingressClassname field is supported +Usage: +{{ include "common.ingress.supportsIngressClassname" . }} +*/}} +{{- define "common.ingress.supportsIngressClassname" -}} +{{- if semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "false" -}} +{{- else -}} +{{- print "true" -}} +{{- end -}} +{{- end -}} + +{{/* +Return true if cert-manager required annotations for TLS signed +certificates are set in the Ingress annotations +Ref: https://cert-manager.io/docs/usage/ingress/#supported-annotations +Usage: +{{ include "common.ingress.certManagerRequest" ( dict "annotations" .Values.path.to.the.ingress.annotations ) }} +*/}} +{{- define "common.ingress.certManagerRequest" -}} +{{ if or (hasKey .annotations "cert-manager.io/cluster-issuer") (hasKey .annotations "cert-manager.io/issuer") }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/_labels.tpl b/helm/airbyte-v1/charts/common/templates/_labels.tpl new file mode 100644 index 00000000..252066c7 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/_labels.tpl @@ -0,0 +1,18 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Kubernetes standard labels +*/}} +{{- define "common.labels.standard" -}} +app.kubernetes.io/name: {{ include "common.names.name" . }} +helm.sh/chart: {{ include "common.names.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector +*/}} +{{- define "common.labels.matchLabels" -}} +app.kubernetes.io/name: {{ include "common.names.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/_names.tpl b/helm/airbyte-v1/charts/common/templates/_names.tpl new file mode 100644 index 00000000..1bdac8b7 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/_names.tpl @@ -0,0 +1,70 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "common.names.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "common.names.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "common.names.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create a default fully qualified dependency name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +Usage: +{{ include "common.names.dependency.fullname" (dict "chartName" "dependency-chart-name" "chartValues" .Values.dependency-chart "context" $) }} +*/}} +{{- define "common.names.dependency.fullname" -}} +{{- if .chartValues.fullnameOverride -}} +{{- .chartValues.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .chartName .chartValues.nameOverride -}} +{{- if contains $name .context.Release.Name -}} +{{- .context.Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .context.Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Allow the release namespace to be overridden for multi-namespace deployments in combined charts. +*/}} +{{- define "common.names.namespace" -}} +{{- if .Values.namespaceOverride -}} +{{- .Values.namespaceOverride -}} +{{- else -}} +{{- .Release.Namespace -}} +{{- end -}} +{{- end -}} + +{{/* +Create a fully qualified app name adding the installation's namespace. +*/}} +{{- define "common.names.fullname.namespace" -}} +{{- printf "%s-%s" (include "common.names.fullname" .) (include "common.names.namespace" .) | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/_secrets.tpl b/helm/airbyte-v1/charts/common/templates/_secrets.tpl new file mode 100644 index 00000000..a53fb44f --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/_secrets.tpl @@ -0,0 +1,140 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Generate secret name. + +Usage: +{{ include "common.secrets.name" (dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $) }} + +Params: + - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user + to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility. + +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret + - defaultNameSuffix - String - Optional. It is used only if we have several secrets in the same deployment. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "common.secrets.name" -}} +{{- $name := (include "common.names.fullname" .context) -}} + +{{- if .defaultNameSuffix -}} +{{- $name = printf "%s-%s" $name .defaultNameSuffix | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- with .existingSecret -}} +{{- if not (typeIs "string" .) -}} +{{- with .name -}} +{{- $name = . -}} +{{- end -}} +{{- else -}} +{{- $name = . -}} +{{- end -}} +{{- end -}} + +{{- printf "%s" $name -}} +{{- end -}} + +{{/* +Generate secret key. + +Usage: +{{ include "common.secrets.key" (dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName") }} + +Params: + - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user + to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility. + +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret + - key - String - Required. Name of the key in the secret. +*/}} +{{- define "common.secrets.key" -}} +{{- $key := .key -}} + +{{- if .existingSecret -}} + {{- if not (typeIs "string" .existingSecret) -}} + {{- if .existingSecret.keyMapping -}} + {{- $key = index .existingSecret.keyMapping $.key -}} + {{- end -}} + {{- end }} +{{- end -}} + +{{- printf "%s" $key -}} +{{- end -}} + +{{/* +Generate secret password or retrieve one if already created. + +Usage: +{{ include "common.secrets.passwords.manage" (dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $) }} + +Params: + - secret - String - Required - Name of the 'Secret' resource where the password is stored. + - key - String - Required - Name of the key in the secret. + - providedValues - List - Required - The path to the validating value in the values.yaml, e.g: "mysql.password". Will pick first parameter with a defined value. + - length - int - Optional - Length of the generated random password. + - strong - Boolean - Optional - Whether to add symbols to the generated random password. + - chartName - String - Optional - Name of the chart used when said chart is deployed as a subchart. + - context - Context - Required - Parent context. + +The order in which this function returns a secret password: + 1. Already existing 'Secret' resource + (If a 'Secret' resource is found under the name provided to the 'secret' parameter to this function and that 'Secret' resource contains a key with the name passed as the 'key' parameter to this function then the value of this existing secret password will be returned) + 2. Password provided via the values.yaml + (If one of the keys passed to the 'providedValues' parameter to this function is a valid path to a key in the values.yaml and has a value, the value of the first key with a value will be returned) + 3. Randomly generated secret password + (A new random secret password with the length specified in the 'length' parameter will be generated and returned) + +*/}} +{{- define "common.secrets.passwords.manage" -}} + +{{- $password := "" }} +{{- $subchart := "" }} +{{- $chartName := default "" .chartName }} +{{- $passwordLength := default 10 .length }} +{{- $providedPasswordKey := include "common.utils.getKeyFromList" (dict "keys" .providedValues "context" $.context) }} +{{- $providedPasswordValue := include "common.utils.getValueFromKey" (dict "key" $providedPasswordKey "context" $.context) }} +{{- $secretData := (lookup "v1" "Secret" $.context.Release.Namespace .secret).data }} +{{- if $secretData }} + {{- if hasKey $secretData .key }} + {{- $password = index $secretData .key }} + {{- else }} + {{- printf "\nPASSWORDS ERROR: The secret \"%s\" does not contain the key \"%s\"\n" .secret .key | fail -}} + {{- end -}} +{{- else if $providedPasswordValue }} + {{- $password = $providedPasswordValue | toString | b64enc | quote }} +{{- else }} + + {{- if .context.Values.enabled }} + {{- $subchart = $chartName }} + {{- end -}} + + {{- $requiredPassword := dict "valueKey" $providedPasswordKey "secret" .secret "field" .key "subchart" $subchart "context" $.context -}} + {{- $requiredPasswordError := include "common.validations.values.single.empty" $requiredPassword -}} + {{- $passwordValidationErrors := list $requiredPasswordError -}} + {{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordValidationErrors "context" $.context) -}} + + {{- if .strong }} + {{- $subStr := list (lower (randAlpha 1)) (randNumeric 1) (upper (randAlpha 1)) | join "_" }} + {{- $password = randAscii $passwordLength }} + {{- $password = regexReplaceAllLiteral "\\W" $password "@" | substr 5 $passwordLength }} + {{- $password = printf "%s%s" $subStr $password | toString | shuffle | b64enc | quote }} + {{- else }} + {{- $password = randAlphaNum $passwordLength | b64enc | quote }} + {{- end }} +{{- end -}} +{{- printf "%s" $password -}} +{{- end -}} + +{{/* +Returns whether a previous generated secret already exists + +Usage: +{{ include "common.secrets.exists" (dict "secret" "secret-name" "context" $) }} + +Params: + - secret - String - Required - Name of the 'Secret' resource where the password is stored. + - context - Context - Required - Parent context. +*/}} +{{- define "common.secrets.exists" -}} +{{- $secret := (lookup "v1" "Secret" $.context.Release.Namespace .secret) }} +{{- if $secret }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/_storage.tpl b/helm/airbyte-v1/charts/common/templates/_storage.tpl new file mode 100644 index 00000000..60e2a844 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/_storage.tpl @@ -0,0 +1,23 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Return the proper Storage Class +{{ include "common.storage.class" ( dict "persistence" .Values.path.to.the.persistence "global" $) }} +*/}} +{{- define "common.storage.class" -}} + +{{- $storageClass := .persistence.storageClass -}} +{{- if .global -}} + {{- if .global.storageClass -}} + {{- $storageClass = .global.storageClass -}} + {{- end -}} +{{- end -}} + +{{- if $storageClass -}} + {{- if (eq "-" $storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" $storageClass -}} + {{- end -}} +{{- end -}} + +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/_tplvalues.tpl b/helm/airbyte-v1/charts/common/templates/_tplvalues.tpl new file mode 100644 index 00000000..2db16685 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/_tplvalues.tpl @@ -0,0 +1,13 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Renders a value that contains template. +Usage: +{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }} +*/}} +{{- define "common.tplvalues.render" -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{- else }} + {{- tpl (.value | toYaml) .context }} + {{- end }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/_utils.tpl b/helm/airbyte-v1/charts/common/templates/_utils.tpl new file mode 100644 index 00000000..8c22b2a3 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/_utils.tpl @@ -0,0 +1,62 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Print instructions to get a secret value. +Usage: +{{ include "common.utils.secret.getvalue" (dict "secret" "secret-name" "field" "secret-value-field" "context" $) }} +*/}} +{{- define "common.utils.secret.getvalue" -}} +{{- $varname := include "common.utils.fieldToEnvVar" . -}} +export {{ $varname }}=$(kubectl get secret --namespace {{ .context.Release.Namespace | quote }} {{ .secret }} -o jsonpath="{.data.{{ .field }}}" | base64 -d) +{{- end -}} + +{{/* +Build env var name given a field +Usage: +{{ include "common.utils.fieldToEnvVar" dict "field" "my-password" }} +*/}} +{{- define "common.utils.fieldToEnvVar" -}} + {{- $fieldNameSplit := splitList "-" .field -}} + {{- $upperCaseFieldNameSplit := list -}} + + {{- range $fieldNameSplit -}} + {{- $upperCaseFieldNameSplit = append $upperCaseFieldNameSplit ( upper . ) -}} + {{- end -}} + + {{ join "_" $upperCaseFieldNameSplit }} +{{- end -}} + +{{/* +Gets a value from .Values given +Usage: +{{ include "common.utils.getValueFromKey" (dict "key" "path.to.key" "context" $) }} +*/}} +{{- define "common.utils.getValueFromKey" -}} +{{- $splitKey := splitList "." .key -}} +{{- $value := "" -}} +{{- $latestObj := $.context.Values -}} +{{- range $splitKey -}} + {{- if not $latestObj -}} + {{- printf "please review the entire path of '%s' exists in values" $.key | fail -}} + {{- end -}} + {{- $value = ( index $latestObj . ) -}} + {{- $latestObj = $value -}} +{{- end -}} +{{- printf "%v" (default "" $value) -}} +{{- end -}} + +{{/* +Returns first .Values key with a defined value or first of the list if all non-defined +Usage: +{{ include "common.utils.getKeyFromList" (dict "keys" (list "path.to.key1" "path.to.key2") "context" $) }} +*/}} +{{- define "common.utils.getKeyFromList" -}} +{{- $key := first .keys -}} +{{- $reverseKeys := reverse .keys }} +{{- range $reverseKeys }} + {{- $value := include "common.utils.getValueFromKey" (dict "key" . "context" $.context ) }} + {{- if $value -}} + {{- $key = . }} + {{- end -}} +{{- end -}} +{{- printf "%s" $key -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/_warnings.tpl b/helm/airbyte-v1/charts/common/templates/_warnings.tpl new file mode 100644 index 00000000..ae10fa41 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/_warnings.tpl @@ -0,0 +1,14 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Warning about using rolling tag. +Usage: +{{ include "common.warnings.rollingTag" .Values.path.to.the.imageRoot }} +*/}} +{{- define "common.warnings.rollingTag" -}} + +{{- if and (contains "bitnami/" .repository) (not (.tag | toString | regexFind "-r\\d+$|sha256:")) }} +WARNING: Rolling tag detected ({{ .repository }}:{{ .tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment. ++info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/ +{{- end }} + +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/validations/_cassandra.tpl b/helm/airbyte-v1/charts/common/templates/validations/_cassandra.tpl new file mode 100644 index 00000000..ded1ae3b --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/validations/_cassandra.tpl @@ -0,0 +1,72 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate Cassandra required passwords are not empty. + +Usage: +{{ include "common.validations.values.cassandra.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where Cassandra values are stored, e.g: "cassandra-passwords-secret" + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.cassandra.passwords" -}} + {{- $existingSecret := include "common.cassandra.values.existingSecret" . -}} + {{- $enabled := include "common.cassandra.values.enabled" . -}} + {{- $dbUserPrefix := include "common.cassandra.values.key.dbUser" . -}} + {{- $valueKeyPassword := printf "%s.password" $dbUserPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "cassandra-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.cassandra.values.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.cassandra.values.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.cassandra.dbUser.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.dbUser.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled cassandra. + +Usage: +{{ include "common.cassandra.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.cassandra.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.cassandra.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key dbUser + +Usage: +{{ include "common.cassandra.values.key.dbUser" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.cassandra.values.key.dbUser" -}} + {{- if .subchart -}} + cassandra.dbUser + {{- else -}} + dbUser + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/validations/_mariadb.tpl b/helm/airbyte-v1/charts/common/templates/validations/_mariadb.tpl new file mode 100644 index 00000000..b6906ff7 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/validations/_mariadb.tpl @@ -0,0 +1,103 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MariaDB required passwords are not empty. + +Usage: +{{ include "common.validations.values.mariadb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MariaDB values are stored, e.g: "mysql-passwords-secret" + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mariadb.passwords" -}} + {{- $existingSecret := include "common.mariadb.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mariadb.values.enabled" . -}} + {{- $architecture := include "common.mariadb.values.architecture" . -}} + {{- $authPrefix := include "common.mariadb.values.key.auth" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mariadb-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- if not (empty $valueUsername) -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mariadb-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replication") -}} + {{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mariadb-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mariadb.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mariadb.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mariadb. + +Usage: +{{ include "common.mariadb.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mariadb.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mariadb.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mariadb.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mariadb.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mariadb.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.key.auth" -}} + {{- if .subchart -}} + mariadb.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/validations/_mongodb.tpl b/helm/airbyte-v1/charts/common/templates/validations/_mongodb.tpl new file mode 100644 index 00000000..f820ec10 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/validations/_mongodb.tpl @@ -0,0 +1,108 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MongoDB® required passwords are not empty. + +Usage: +{{ include "common.validations.values.mongodb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MongoDB® values are stored, e.g: "mongodb-passwords-secret" + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mongodb.passwords" -}} + {{- $existingSecret := include "common.mongodb.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mongodb.values.enabled" . -}} + {{- $authPrefix := include "common.mongodb.values.key.auth" . -}} + {{- $architecture := include "common.mongodb.values.architecture" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyDatabase := printf "%s.database" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicaSetKey := printf "%s.replicaSetKey" $authPrefix -}} + {{- $valueKeyAuthEnabled := printf "%s.enabled" $authPrefix -}} + + {{- $authEnabled := include "common.utils.getValueFromKey" (dict "key" $valueKeyAuthEnabled "context" .context) -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") (eq $authEnabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mongodb-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- $valueDatabase := include "common.utils.getValueFromKey" (dict "key" $valueKeyDatabase "context" .context) }} + {{- if and $valueUsername $valueDatabase -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mongodb-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replicaset") -}} + {{- $requiredReplicaSetKey := dict "valueKey" $valueKeyReplicaSetKey "secret" .secret "field" "mongodb-replica-set-key" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicaSetKey -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mongodb.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDb is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mongodb.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mongodb. + +Usage: +{{ include "common.mongodb.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mongodb.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mongodb.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mongodb.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.key.auth" -}} + {{- if .subchart -}} + mongodb.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mongodb.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mongodb.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/validations/_mysql.tpl b/helm/airbyte-v1/charts/common/templates/validations/_mysql.tpl new file mode 100644 index 00000000..74472a06 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/validations/_mysql.tpl @@ -0,0 +1,103 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MySQL required passwords are not empty. + +Usage: +{{ include "common.validations.values.mysql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MySQL values are stored, e.g: "mysql-passwords-secret" + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mysql.passwords" -}} + {{- $existingSecret := include "common.mysql.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mysql.values.enabled" . -}} + {{- $architecture := include "common.mysql.values.architecture" . -}} + {{- $authPrefix := include "common.mysql.values.key.auth" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mysql-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- if not (empty $valueUsername) -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mysql-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replication") -}} + {{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mysql-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mysql.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mysql.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mysql. + +Usage: +{{ include "common.mysql.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mysql.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mysql.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mysql.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mysql.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mysql.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.key.auth" -}} + {{- if .subchart -}} + mysql.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/validations/_postgresql.tpl b/helm/airbyte-v1/charts/common/templates/validations/_postgresql.tpl new file mode 100644 index 00000000..164ec0d0 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/validations/_postgresql.tpl @@ -0,0 +1,129 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate PostgreSQL required passwords are not empty. + +Usage: +{{ include "common.validations.values.postgresql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where postgresql values are stored, e.g: "postgresql-passwords-secret" + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.postgresql.passwords" -}} + {{- $existingSecret := include "common.postgresql.values.existingSecret" . -}} + {{- $enabled := include "common.postgresql.values.enabled" . -}} + {{- $valueKeyPostgresqlPassword := include "common.postgresql.values.key.postgressPassword" . -}} + {{- $valueKeyPostgresqlReplicationEnabled := include "common.postgresql.values.key.replicationPassword" . -}} + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + {{- $requiredPostgresqlPassword := dict "valueKey" $valueKeyPostgresqlPassword "secret" .secret "field" "postgresql-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlPassword -}} + + {{- $enabledReplication := include "common.postgresql.values.enabled.replication" . -}} + {{- if (eq $enabledReplication "true") -}} + {{- $requiredPostgresqlReplicationPassword := dict "valueKey" $valueKeyPostgresqlReplicationEnabled "secret" .secret "field" "postgresql-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to decide whether evaluate global values. + +Usage: +{{ include "common.postgresql.values.use.global" (dict "key" "key-of-global" "context" $) }} +Params: + - key - String - Required. Field to be evaluated within global, e.g: "existingSecret" +*/}} +{{- define "common.postgresql.values.use.global" -}} + {{- if .context.Values.global -}} + {{- if .context.Values.global.postgresql -}} + {{- index .context.Values.global.postgresql .key | quote -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.postgresql.values.existingSecret" (dict "context" $) }} +*/}} +{{- define "common.postgresql.values.existingSecret" -}} + {{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "existingSecret" "context" .context) -}} + + {{- if .subchart -}} + {{- default (.context.Values.postgresql.existingSecret | quote) $globalValue -}} + {{- else -}} + {{- default (.context.Values.existingSecret | quote) $globalValue -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled postgresql. + +Usage: +{{ include "common.postgresql.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.postgresql.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.postgresql.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key postgressPassword. + +Usage: +{{ include "common.postgresql.values.key.postgressPassword" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.key.postgressPassword" -}} + {{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "postgresqlUsername" "context" .context) -}} + + {{- if not $globalValue -}} + {{- if .subchart -}} + postgresql.postgresqlPassword + {{- else -}} + postgresqlPassword + {{- end -}} + {{- else -}} + global.postgresql.postgresqlPassword + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled.replication. + +Usage: +{{ include "common.postgresql.values.enabled.replication" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.enabled.replication" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.postgresql.replication.enabled -}} + {{- else -}} + {{- printf "%v" .context.Values.replication.enabled -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key replication.password. + +Usage: +{{ include "common.postgresql.values.key.replicationPassword" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.key.replicationPassword" -}} + {{- if .subchart -}} + postgresql.replication.password + {{- else -}} + replication.password + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/validations/_redis.tpl b/helm/airbyte-v1/charts/common/templates/validations/_redis.tpl new file mode 100644 index 00000000..dcccfc1a --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/validations/_redis.tpl @@ -0,0 +1,76 @@ + +{{/* vim: set filetype=mustache: */}} +{{/* +Validate Redis® required passwords are not empty. + +Usage: +{{ include "common.validations.values.redis.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where redis values are stored, e.g: "redis-passwords-secret" + - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.redis.passwords" -}} + {{- $enabled := include "common.redis.values.enabled" . -}} + {{- $valueKeyPrefix := include "common.redis.values.keys.prefix" . -}} + {{- $standarizedVersion := include "common.redis.values.standarized.version" . }} + + {{- $existingSecret := ternary (printf "%s%s" $valueKeyPrefix "auth.existingSecret") (printf "%s%s" $valueKeyPrefix "existingSecret") (eq $standarizedVersion "true") }} + {{- $existingSecretValue := include "common.utils.getValueFromKey" (dict "key" $existingSecret "context" .context) }} + + {{- $valueKeyRedisPassword := ternary (printf "%s%s" $valueKeyPrefix "auth.password") (printf "%s%s" $valueKeyPrefix "password") (eq $standarizedVersion "true") }} + {{- $valueKeyRedisUseAuth := ternary (printf "%s%s" $valueKeyPrefix "auth.enabled") (printf "%s%s" $valueKeyPrefix "usePassword") (eq $standarizedVersion "true") }} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $useAuth := include "common.utils.getValueFromKey" (dict "key" $valueKeyRedisUseAuth "context" .context) -}} + {{- if eq $useAuth "true" -}} + {{- $requiredRedisPassword := dict "valueKey" $valueKeyRedisPassword "secret" .secret "field" "redis-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRedisPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled redis. + +Usage: +{{ include "common.redis.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.redis.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.redis.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right prefix path for the values + +Usage: +{{ include "common.redis.values.key.prefix" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false +*/}} +{{- define "common.redis.values.keys.prefix" -}} + {{- if .subchart -}}redis.{{- else -}}{{- end -}} +{{- end -}} + +{{/* +Checks whether the redis chart's includes the standarizations (version >= 14) + +Usage: +{{ include "common.redis.values.standarized.version" (dict "context" $) }} +*/}} +{{- define "common.redis.values.standarized.version" -}} + + {{- $standarizedAuth := printf "%s%s" (include "common.redis.values.keys.prefix" .) "auth" -}} + {{- $standarizedAuthValues := include "common.utils.getValueFromKey" (dict "key" $standarizedAuth "context" .context) }} + + {{- if $standarizedAuthValues -}} + {{- true -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/templates/validations/_validations.tpl b/helm/airbyte-v1/charts/common/templates/validations/_validations.tpl new file mode 100644 index 00000000..9a814cf4 --- /dev/null +++ b/helm/airbyte-v1/charts/common/templates/validations/_validations.tpl @@ -0,0 +1,46 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate values must not be empty. + +Usage: +{{- $validateValueConf00 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-00") -}} +{{- $validateValueConf01 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-01") -}} +{{ include "common.validations.values.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }} + +Validate value params: + - valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password" + - secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret" + - field - String - Optional. Name of the field in the secret data, e.g: "mysql-password" +*/}} +{{- define "common.validations.values.multiple.empty" -}} + {{- range .required -}} + {{- include "common.validations.values.single.empty" (dict "valueKey" .valueKey "secret" .secret "field" .field "context" $.context) -}} + {{- end -}} +{{- end -}} + +{{/* +Validate a value must not be empty. + +Usage: +{{ include "common.validations.value.empty" (dict "valueKey" "mariadb.password" "secret" "secretName" "field" "my-password" "subchart" "subchart" "context" $) }} + +Validate value params: + - valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password" + - secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret" + - field - String - Optional. Name of the field in the secret data, e.g: "mysql-password" + - subchart - String - Optional - Name of the subchart that the validated password is part of. +*/}} +{{- define "common.validations.values.single.empty" -}} + {{- $value := include "common.utils.getValueFromKey" (dict "key" .valueKey "context" .context) }} + {{- $subchart := ternary "" (printf "%s." .subchart) (empty .subchart) }} + + {{- if not $value -}} + {{- $varname := "my-value" -}} + {{- $getCurrentValue := "" -}} + {{- if and .secret .field -}} + {{- $varname = include "common.utils.fieldToEnvVar" . -}} + {{- $getCurrentValue = printf " To get the current value:\n\n %s\n" (include "common.utils.secret.getvalue" .) -}} + {{- end -}} + {{- printf "\n '%s' must not be empty, please add '--set %s%s=$%s' to the command.%s" .valueKey $subchart .valueKey $varname $getCurrentValue -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/common/values.yaml b/helm/airbyte-v1/charts/common/values.yaml new file mode 100644 index 00000000..f2df68e5 --- /dev/null +++ b/helm/airbyte-v1/charts/common/values.yaml @@ -0,0 +1,5 @@ +## bitnami/common +## It is required by CI/CD tools and processes. +## @skip exampleValue +## +exampleValue: common-chart diff --git a/helm/airbyte-v1/charts/connector-builder-server/.gitignore b/helm/airbyte-v1/charts/connector-builder-server/.gitignore new file mode 100644 index 00000000..88e91e8a --- /dev/null +++ b/helm/airbyte-v1/charts/connector-builder-server/.gitignore @@ -0,0 +1,2 @@ +# Charts are downloaded at install time with `helm dep build`. +charts diff --git a/helm/airbyte-v1/charts/connector-builder-server/Chart.lock b/helm/airbyte-v1/charts/connector-builder-server/Chart.lock new file mode 100644 index 00000000..746fb41b --- /dev/null +++ b/helm/airbyte-v1/charts/connector-builder-server/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2022-10-17T18:35:15.123937677Z" diff --git a/helm/airbyte-v1/charts/connector-builder-server/Chart.yaml b/helm/airbyte-v1/charts/connector-builder-server/Chart.yaml new file mode 100644 index 00000000..a4e8f766 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-builder-server/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: Helm chart to deploy airbyte-connector-builder-server +name: connector-builder-server +type: application +version: 1.3.0 diff --git a/helm/airbyte-v1/charts/connector-builder-server/README.md b/helm/airbyte-v1/charts/connector-builder-server/README.md new file mode 100644 index 00000000..9b49f69a --- /dev/null +++ b/helm/airbyte-v1/charts/connector-builder-server/README.md @@ -0,0 +1,64 @@ +# connector-builder-server + +![Version: 0.67.17](https://img.shields.io/badge/Version-0.67.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: dev](https://img.shields.io/badge/AppVersion-dev-informational?style=flat-square) + +Helm chart to deploy airbyte-connector-builder-server + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 1.x.x | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| containerSecurityContext | object | `{}` | | +| debug.enabled | bool | `false` | | +| debug.remoteDebugPort | int | `5005` | | +| enabled | bool | `true` | | +| env_vars | object | `{}` | | +| extraContainers | list | `[]` | | +| extraEnv | list | `[]` | | +| extraInitContainers | list | `[]` | | +| extraVolumeMounts | list | `[]` | | +| extraVolumes | list | `[]` | | +| global.configMapName | string | `""` | | +| global.credVolumeOverride | string | `""` | | +| global.database.secretName | string | `""` | | +| global.database.secretValue | string | `""` | | +| global.deploymentMode | string | `"oss"` | | +| global.deploymentStrategyType | string | `"RollingUpdate"` | | +| global.extraContainers | list | `[]` | | +| global.extraLabels | object | `{}` | | +| global.extraSelectorLabels | object | `{}` | | +| global.secretName | string | `""` | | +| global.serviceAccountName | string | `"placeholderServiceAccount"` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"airbyte/connector-builder-server"` | | +| livenessProbe.enabled | bool | `true` | | +| livenessProbe.failureThreshold | int | `3` | | +| livenessProbe.initialDelaySeconds | int | `30` | | +| livenessProbe.periodSeconds | int | `10` | | +| livenessProbe.successThreshold | int | `1` | | +| livenessProbe.timeoutSeconds | int | `1` | | +| log.level | string | `"INFO"` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| readinessProbe.enabled | bool | `true` | | +| readinessProbe.failureThreshold | int | `3` | | +| readinessProbe.initialDelaySeconds | int | `10` | | +| readinessProbe.periodSeconds | int | `10` | | +| readinessProbe.successThreshold | int | `1` | | +| readinessProbe.timeoutSeconds | int | `1` | | +| replicaCount | int | `1` | | +| resources.limits | object | `{}` | | +| resources.requests | object | `{}` | | +| secrets | object | `{}` | | +| service.annotations | object | `{}` | | +| service.port | int | `80` | | +| service.type | string | `"NodePort"` | | +| tolerations | list | `[]` | | + diff --git a/helm/airbyte-v1/charts/connector-builder-server/templates/_helpers.tpl b/helm/airbyte-v1/charts/connector-builder-server/templates/_helpers.tpl new file mode 100644 index 00000000..174aebfe --- /dev/null +++ b/helm/airbyte-v1/charts/connector-builder-server/templates/_helpers.tpl @@ -0,0 +1,59 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "airbyte.labels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "airbyte.selectorLabels" -}} +app.kubernetes.io/name: {{ include "airbyte.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Define db secret +*/}} + +{{- define "database.secret.name" -}} +{{- printf "%s-postgresql" .Release.Name }} +{{- end }} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/connector-builder-server/templates/_images.tpl b/helm/airbyte-v1/charts/connector-builder-server/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-builder-server/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/connector-builder-server/templates/deployment.yaml b/helm/airbyte-v1/charts/connector-builder-server/templates/deployment.yaml new file mode 100644 index 00000000..4eef212e --- /dev/null +++ b/helm/airbyte-v1/charts/connector-builder-server/templates/deployment.yaml @@ -0,0 +1,179 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "common.names.fullname" . }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "airbyte.selectorLabels" . | nindent 6 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 6 }} + {{- end }} + strategy: + type: {{ .Values.deploymentStrategyType }} + template: + metadata: + labels: + {{- include "airbyte.selectorLabels" . | nindent 8 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 8 }} + {{- end }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.podAnnotations }} + annotations: + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ .Values.global.serviceAccountName }} + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.extraInitContainers }} + initContainers: + {{- toYaml .Values.extraInitContainers | nindent 6 }} + {{- end }} + containers: + - name: airbyte-connector-builder-server + image: {{ include "imageUrl" (list .Values.image $) }} + imagePullPolicy: "{{ .Values.image.pullPolicy }}" + env: + {{- if .Values.debug.enabled }} + - name: JAVA_TOOL_OPTIONS + value: "-Xdebug -agentlib:jdwp=transport=dt_socket,address=0.0.0.0:{{ .Values.debug.remoteDebugPort }},server=y,suspend=n" + {{- end}} + {{- if eq .Values.global.deploymentMode "oss" }} + - name: AIRBYTE_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: AIRBYTE_VERSION + - name: MICROMETER_METRICS_ENABLED + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MICROMETER_METRICS_ENABLED + - name: MICROMETER_METRICS_STATSD_FLAVOR + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MICROMETER_METRICS_STATSD_FLAVOR + - name: SEGMENT_WRITE_KEY + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: SEGMENT_WRITE_KEY + - name: STATSD_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STATSD_HOST + - name: STATSD_PORT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STATSD_PORT + - name: TRACKING_STRATEGY + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TRACKING_STRATEGY + {{- end }} + + # Values from secret + {{- if .Values.secrets }} + {{- range $k, $v := .Values.secrets }} + - name: {{ $k }} + valueFrom: + secretKeyRef: + name: server-secrets + key: {{ $k }} + {{- end }} + {{- end }} + + # Values from env + {{- if or .Values.env_vars .Values.global.env_vars }} + {{- range $k, $v := mergeOverwrite .Values.env_vars .Values.global.env_vars }} + - name: {{ $k }} + value: {{ $v | quote }} + {{- end }} + {{- end }} + + # Values from extraEnv for more compability(if you want to use external secret source or other stuff) + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 8 }} + {{- end }} + + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: /v1/health + port: http + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: /v1/health + port: http + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} + + ports: + - name: http + containerPort: 8080 + protocol: TCP + {{- if .Values.debug.enabled }} + - name: debug + containerPort: {{ .Values.debug.remoteDebugPort }} + protocol: TCP + {{- end}} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 10 }} + {{- end }} + {{- if .Values.containerSecurityContext }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 10 }} + {{- end }} + volumeMounts: + {{- if .Values.extraVolumeMounts }} + {{ toYaml .Values.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.global.extraVolumeMounts }} + {{ toYaml .Values.global.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 6 }} + {{- end }} + {{- if .Values.global.extraContainers }} + {{ toYaml .Values.global.extraContainers | nindent 6 }} + {{- end }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + {{- if .Values.extraVolumes }} +{{ toYaml .Values.extraVolumes | nindent 6 }} + {{- end }} diff --git a/helm/airbyte-v1/charts/connector-builder-server/templates/secrets.yaml b/helm/airbyte-v1/charts/connector-builder-server/templates/secrets.yaml new file mode 100644 index 00000000..e00ae6ba --- /dev/null +++ b/helm/airbyte-v1/charts/connector-builder-server/templates/secrets.yaml @@ -0,0 +1,17 @@ +# Create secrets only for the local deployment +{{- if .Values.secrets }} +apiVersion: v1 +kind: Secret +metadata: + name: connector-builder-server-secrets + labels: + {{- include "airbyte.labels" . | nindent 4 }} + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-1" +type: Opaque +data: + {{- range $k, $v := mergeOverwrite .Values.secrets .Values.global.secrets }} + {{ $k }}: {{ if $v }}{{ $v | b64enc }} {{else}}""{{end}} + {{- end }} +{{- end }} diff --git a/helm/airbyte-v1/charts/connector-builder-server/templates/service.yaml b/helm/airbyte-v1/charts/connector-builder-server/templates/service.yaml new file mode 100644 index 00000000..6f1cb26e --- /dev/null +++ b/helm/airbyte-v1/charts/connector-builder-server/templates/service.yaml @@ -0,0 +1,20 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: {{.Release.Name }}-airbyte-connector-builder-server-svc + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "airbyte.selectorLabels" . | nindent 4 }} diff --git a/helm/airbyte-v1/charts/connector-builder-server/values.yaml b/helm/airbyte-v1/charts/connector-builder-server/values.yaml new file mode 100644 index 00000000..64326ab9 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-builder-server/values.yaml @@ -0,0 +1,192 @@ +global: + serviceAccountName: placeholderServiceAccount + deploymentMode: oss + deploymentStrategyType: RollingUpdate + configMapName: "" + secretName: "" + credVolumeOverride: "" + extraContainers: [] + ## extraSelectorLabels [object] - use to specify own additional selector labels for deployment + extraSelectorLabels: {} + ## extraLabels [object] - use to specify own additional labels for deployment + extraLabels: {} + database: + secretName: "" + secretValue: "" + + # Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "" + +enabled: true +## replicaCount Number of server replicas +replicaCount: 1 + +## image.repository The repository to use for the airbyte server image. +## image.pullPolicy the pull policy to use for the airbyte server image +## image.tag The airbyte server image tag. Defaults to the chart's AppVersion +image: + repository: airbyte/connector-builder-server + pullPolicy: IfNotPresent + +## podAnnotations [object] Add extra annotations to the server pod +## +podAnnotations: {} + +## containerSecurityContext Security context for the container +## Examples: +## containerSecurityContext: +## runAsNonRoot: true +## runAsUser: 1000 +## readOnlyRootFilesystem: true +containerSecurityContext: {} + +## Configure extra options for the server containers' liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## livenessProbe.enabled Enable livenessProbe on the server +## livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe +## livenessProbe.periodSeconds Period seconds for livenessProbe +## livenessProbe.timeoutSeconds Timeout seconds for livenessProbe +## livenessProbe.failureThreshold Failure threshold for livenessProbe +## livenessProbe.successThreshold Success threshold for livenessProbe +## +livenessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## readinessProbe.enabled Enable readinessProbe on the server +## readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe +## readinessProbe.periodSeconds Period seconds for readinessProbe +## readinessProbe.timeoutSeconds Timeout seconds for readinessProbe +## readinessProbe.failureThreshold Failure threshold for readinessProbe +## readinessProbe.successThreshold Success threshold for readinessProbe +## +readinessProbe: + enabled: true + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## Server app resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## We usually recommend not to specify default resources and to leave this as a conscious +## choice for the user. This also increases chances charts run on environments with little +## resources, such as Minikube. If you do want to specify resources, uncomment the following +## lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## resources.limits [object] The resources limits for the server container +## resources.requests [object] The requested resources for the server container +resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + +## service.type The service type to use for the API server +## service.port The service port to expose the API server on +service: + type: NodePort + port: 80 + annotations: {} + +## nodeSelector [object] Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## tolerations [array] Tolerations for server pod assignment. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## affinity [object] Affinity and anti-affinity for server pod assignment. +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## log.level The log level to log at +log: + level: "INFO" + +## extraVolumeMounts [array] Additional volumeMounts for server container(s). +## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumeMounts: +## - name: tmpdir +## mountPath: /tmp +## +extraVolumeMounts: [] + +## extraVolumes [array] Additional volumes for server pod(s). +## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumes: +## - name: tmpdir +## emptyDir: {} +## +extraVolumes: [] + +## extraContainer [array] Additional container for server pod(s) +## Example: +# extraContainers: +# - name: otel_collector +# image: somerepo/someimage:sometag +# args: [ +# "--important-args" +# ] +# ports: +# - containerPort: 443 +# volumeMounts: +# - name: volumeMountCool +# mountPath: /some/path +# readOnly: true +extraContainers: [] + +## extraInitContainers [array] Additional init containers for server pod(s) +## Example: +# extraInitContainers: +# - name: sleepy +# image: alpine +# command: ['sleep', '60'] + +extraInitContainers: [] + +## extraEnv [array] Supply extra env variables to main container using full notation +## Example: (With default env vars and values taken from generated config map) +# extraEnv: +# - name: AIRBYTE_VERSION +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: AIRBYTE_VERSION +## +extraEnv: [] +## secrets [object] Supply additional secrets to container +## Example: +## secrets: +## DATABASE_PASSWORD: strong-password +## DATABASE_USER: my-db-user +secrets: {} + +## env_vars [object] Supply extra env variables to main container using simplified notation +## Example: +# env_vars: +# AIRBYTE_VERSION: 0.40.4 +env_vars: {} + +debug: + enabled: false + remoteDebugPort: 5005 diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/Chart.lock b/helm/airbyte-v1/charts/connector-rollout-worker/Chart.lock new file mode 100644 index 00000000..9778a41b --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2024-12-09T21:57:06.251315255Z" diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/Chart.yaml b/helm/airbyte-v1/charts/connector-rollout-worker/Chart.yaml new file mode 100644 index 00000000..4c69c7f3 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: Helm chart to deploy airbyte-connector-rollout-worker +name: connector-rollout-worker +type: application +version: 1.3.0 diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/README.md b/helm/airbyte-v1/charts/connector-rollout-worker/README.md new file mode 100644 index 00000000..ad3e11f2 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/README.md @@ -0,0 +1,60 @@ +# connector-rollout-worker + +![Version: 0.67.17](https://img.shields.io/badge/Version-0.67.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: dev](https://img.shields.io/badge/AppVersion-dev-informational?style=flat-square) + +Helm chart to deploy airbyte-connector-rollout-worker + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 1.x.x | + +## Values + +| Key | Type | Default | Description | +|---------------------------------------------------|------|--------------------------------------|-------------| +| affinity | object | `{}` | | +| containerSecurityContext | object | `{}` | | +| debug.enabled | bool | `false` | | +| debug.remoteDebugPort | int | `5005` | | +| enabled | bool | `true` | | +| env_vars | object | `{}` | | +| extraContainers | list | `[]` | | +| extraEnv | list | `[]` | | +| extraInitContainers | list | `[]` | | +| extraLabels | object | `{}` | | +| extraSelectorLabels | object | `{}` | | +| extraVolumeMounts | list | `[]` | | +| extraVolumes | list | `[]` | | +| global.credVolumeOverride | string | `""` | | +| global.database.secretName | string | `""` | | +| global.database.secretValue | string | `""` | | +| global.extraContainers | list | `[]` | | +| global.extraLabels | object | `{}` | | +| global.extraSelectorLabels | object | `{}` | | +| global.secretName | string | `""` | | +| global.serviceAccountName | string | `"airbyte-admin"` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"airbyte/connector-rollout-worker"` | | +| livenessProbe.enabled | bool | `true` | | +| livenessProbe.failureThreshold | int | `3` | | +| livenessProbe.initialDelaySeconds | int | `50` | | +| livenessProbe.periodSeconds | int | `10` | | +| livenessProbe.successThreshold | int | `1` | | +| livenessProbe.timeoutSeconds | int | `1` | | +| log.level | string | `"INFO"` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| readinessProbe.enabled | bool | `true` | | +| readinessProbe.failureThreshold | int | `3` | | +| readinessProbe.initialDelaySeconds | int | `10` | | +| readinessProbe.periodSeconds | int | `10` | | +| readinessProbe.successThreshold | int | `1` | | +| readinessProbe.timeoutSeconds | int | `1` | | +| replicaCount | int | `1` | | +| resources.limits | object | `{}` | | +| resources.requests | object | `{}` | | +| secrets | object | `{}` | | +| tolerations | list | `[]` | | diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/.helmignore b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/.helmignore new file mode 100644 index 00000000..50af0317 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/.helmignore @@ -0,0 +1,22 @@ +# 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 +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/Chart.yaml b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/Chart.yaml new file mode 100644 index 00000000..39edbb3c --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/Chart.yaml @@ -0,0 +1,23 @@ +annotations: + category: Infrastructure +apiVersion: v2 +appVersion: 1.17.1 +description: A Library Helm Chart for grouping common logic between bitnami charts. + This chart is not deployable by itself. +home: https://github.com/bitnami/charts/tree/master/bitnami/common +icon: https://bitnami.com/downloads/logos/bitnami-mark.png +keywords: +- common +- helper +- template +- function +- bitnami +maintainers: +- name: Bitnami + url: https://github.com/bitnami/charts +name: common +sources: +- https://github.com/bitnami/charts +- https://www.bitnami.com/ +type: library +version: 1.17.1 diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/README.md b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/README.md new file mode 100644 index 00000000..a2ecd604 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/README.md @@ -0,0 +1,350 @@ +# Bitnami Common Library Chart + +A [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between bitnami charts. + +## TL;DR + +```yaml +dependencies: + - name: common + version: 1.x.x + repository: https://charts.bitnami.com/bitnami +``` + +```bash +$ helm dependency update +``` + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.names.fullname" . }} +data: + myvalue: "Hello World" +``` + +## Introduction + +This chart provides a common template helpers which can be used to develop new charts using [Helm](https://helm.sh) package manager. + +Bitnami charts can be used with [Kubeapps](https://kubeapps.dev/) for deployment and management of Helm Charts in clusters. + +## Prerequisites + +- Kubernetes 1.19+ +- Helm 3.2.0+ + +## Parameters + +The following table lists the helpers available in the library which are scoped in different sections. + +### Affinities + +| Helper identifier | Description | Expected Input | +|-------------------------------|------------------------------------------------------|------------------------------------------------| +| `common.affinities.nodes.soft` | Return a soft nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` | +| `common.affinities.nodes.hard` | Return a hard nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` | +| `common.affinities.pods.soft` | Return a soft podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` | +| `common.affinities.pods.hard` | Return a hard podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` | + +### Capabilities + +| Helper identifier | Description | Expected Input | +|------------------------------------------------|------------------------------------------------------------------------------------------------|-------------------| +| `common.capabilities.kubeVersion` | Return the target Kubernetes version (using client default if .Values.kubeVersion is not set). | `.` Chart context | +| `common.capabilities.cronjob.apiVersion` | Return the appropriate apiVersion for cronjob. | `.` Chart context | +| `common.capabilities.deployment.apiVersion` | Return the appropriate apiVersion for deployment. | `.` Chart context | +| `common.capabilities.statefulset.apiVersion` | Return the appropriate apiVersion for statefulset. | `.` Chart context | +| `common.capabilities.ingress.apiVersion` | Return the appropriate apiVersion for ingress. | `.` Chart context | +| `common.capabilities.rbac.apiVersion` | Return the appropriate apiVersion for RBAC resources. | `.` Chart context | +| `common.capabilities.crd.apiVersion` | Return the appropriate apiVersion for CRDs. | `.` Chart context | +| `common.capabilities.policy.apiVersion` | Return the appropriate apiVersion for podsecuritypolicy. | `.` Chart context | +| `common.capabilities.networkPolicy.apiVersion` | Return the appropriate apiVersion for networkpolicy. | `.` Chart context | +| `common.capabilities.apiService.apiVersion` | Return the appropriate apiVersion for APIService. | `.` Chart context | +| `common.capabilities.hpa.apiVersion` | Return the appropriate apiVersion for Horizontal Pod Autoscaler | `.` Chart context | +| `common.capabilities.supportsHelmVersion` | Returns true if the used Helm version is 3.3+ | `.` Chart context | + +### Errors + +| Helper identifier | Description | Expected Input | +|-----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| +| `common.errors.upgrade.passwords.empty` | It will ensure required passwords are given when we are upgrading a chart. If `validationErrors` is not empty it will throw an error and will stop the upgrade action. | `dict "validationErrors" (list $validationError00 $validationError01) "context" $` | + +### Images + +| Helper identifier | Description | Expected Input | +|-----------------------------|------------------------------------------------------|---------------------------------------------------------------------------------------------------------| +| `common.images.image` | Return the proper and full image name | `dict "imageRoot" .Values.path.to.the.image "global" $`, see [ImageRoot](#imageroot) for the structure. | +| `common.images.pullSecrets` | Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global` | +| `common.images.renderPullSecrets` | Return the proper Docker Image Registry Secret Names (evaluates values as templates) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $` | + +### Ingress + +| Helper identifier | Description | Expected Input | +|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.ingress.backend` | Generate a proper Ingress backend entry depending on the API version | `dict "serviceName" "foo" "servicePort" "bar"`, see the [Ingress deprecation notice](https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/) for the syntax differences | +| `common.ingress.supportsPathType` | Prints "true" if the pathType field is supported | `.` Chart context | +| `common.ingress.supportsIngressClassname` | Prints "true" if the ingressClassname field is supported | `.` Chart context | +| `common.ingress.certManagerRequest` | Prints "true" if required cert-manager annotations for TLS signed certificates are set in the Ingress annotations | `dict "annotations" .Values.path.to.the.ingress.annotations` | + +### Labels + +| Helper identifier | Description | Expected Input | +|-----------------------------|-----------------------------------------------------------------------------|-------------------| +| `common.labels.standard` | Return Kubernetes standard labels | `.` Chart context | +| `common.labels.matchLabels` | Labels to use on `deploy.spec.selector.matchLabels` and `svc.spec.selector` | `.` Chart context | + +### Names + +| Helper identifier | Description | Expected Input | +|-----------------------------------|-----------------------------------------------------------------------|-------------------| +| `common.names.name` | Expand the name of the chart or use `.Values.nameOverride` | `.` Chart context | +| `common.names.fullname` | Create a default fully qualified app name. | `.` Chart context | +| `common.names.namespace` | Allow the release namespace to be overridden | `.` Chart context | +| `common.names.fullname.namespace` | Create a fully qualified app name adding the installation's namespace | `.` Chart context | +| `common.names.chart` | Chart name plus version | `.` Chart context | + +### Secrets + +| Helper identifier | Description | Expected Input | +|---------------------------|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.secrets.name` | Generate the name of the secret. | `dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $` see [ExistingSecret](#existingsecret) for the structure. | +| `common.secrets.key` | Generate secret key. | `dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName"` see [ExistingSecret](#existingsecret) for the structure. | +| `common.passwords.manage` | Generate secret password or retrieve one if already created. | `dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $`, length, strong and chartNAme fields are optional. | +| `common.secrets.exists` | Returns whether a previous generated secret already exists. | `dict "secret" "secret-name" "context" $` | + +### Storage + +| Helper identifier | Description | Expected Input | +|-------------------------------|---------------------------------------|---------------------------------------------------------------------------------------------------------------------| +| `common.storage.class` | Return the proper Storage Class | `dict "persistence" .Values.path.to.the.persistence "global" $`, see [Persistence](#persistence) for the structure. | + +### TplValues + +| Helper identifier | Description | Expected Input | +|---------------------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.tplvalues.render` | Renders a value that contains template | `dict "value" .Values.path.to.the.Value "context" $`, value is the value should rendered as template, context frequently is the chart context `$` or `.` | + +### Utils + +| Helper identifier | Description | Expected Input | +|--------------------------------|------------------------------------------------------------------------------------------|------------------------------------------------------------------------| +| `common.utils.fieldToEnvVar` | Build environment variable name given a field. | `dict "field" "my-password"` | +| `common.utils.secret.getvalue` | Print instructions to get a secret value. | `dict "secret" "secret-name" "field" "secret-value-field" "context" $` | +| `common.utils.getValueFromKey` | Gets a value from `.Values` object given its key path | `dict "key" "path.to.key" "context" $` | +| `common.utils.getKeyFromList` | Returns first `.Values` key with a defined value or first of the list if all non-defined | `dict "keys" (list "path.to.key1" "path.to.key2") "context" $` | + +### Validations + +| Helper identifier | Description | Expected Input | +|--------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.validations.values.single.empty` | Validate a value must not be empty. | `dict "valueKey" "path.to.value" "secret" "secret.name" "field" "my-password" "subchart" "subchart" "context" $` secret, field and subchart are optional. In case they are given, the helper will generate a how to get instruction. See [ValidateValue](#validatevalue) | +| `common.validations.values.multiple.empty` | Validate a multiple values must not be empty. It returns a shared error for all the values. | `dict "required" (list $validateValueConf00 $validateValueConf01) "context" $`. See [ValidateValue](#validatevalue) | +| `common.validations.values.mariadb.passwords` | This helper will ensure required password for MariaDB are not empty. It returns a shared error for all the values. | `dict "secret" "mariadb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mariadb chart and the helper. | +| `common.validations.values.mysql.passwords` | This helper will ensure required password for MySQL are not empty. It returns a shared error for all the values. | `dict "secret" "mysql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mysql chart and the helper. | +| `common.validations.values.postgresql.passwords` | This helper will ensure required password for PostgreSQL are not empty. It returns a shared error for all the values. | `dict "secret" "postgresql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use postgresql chart and the helper. | +| `common.validations.values.redis.passwords` | This helper will ensure required password for Redis® are not empty. It returns a shared error for all the values. | `dict "secret" "redis-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use redis chart and the helper. | +| `common.validations.values.cassandra.passwords` | This helper will ensure required password for Cassandra are not empty. It returns a shared error for all the values. | `dict "secret" "cassandra-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use cassandra chart and the helper. | +| `common.validations.values.mongodb.passwords` | This helper will ensure required password for MongoDB® are not empty. It returns a shared error for all the values. | `dict "secret" "mongodb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mongodb chart and the helper. | + +### Warnings + +| Helper identifier | Description | Expected Input | +|------------------------------|----------------------------------|------------------------------------------------------------| +| `common.warnings.rollingTag` | Warning about using rolling tag. | `ImageRoot` see [ImageRoot](#imageroot) for the structure. | + +## Special input schemas + +### ImageRoot + +```yaml +registry: + type: string + description: Docker registry where the image is located + example: docker.io + +repository: + type: string + description: Repository and image name + example: bitnami/nginx + +tag: + type: string + description: image tag + example: 1.16.1-debian-10-r63 + +pullPolicy: + type: string + description: Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + +pullSecrets: + type: array + items: + type: string + description: Optionally specify an array of imagePullSecrets (evaluated as templates). + +debug: + type: boolean + description: Set to true if you would like to see extra information on logs + example: false + +## An instance would be: +# registry: docker.io +# repository: bitnami/nginx +# tag: 1.16.1-debian-10-r63 +# pullPolicy: IfNotPresent +# debug: false +``` + +### Persistence + +```yaml +enabled: + type: boolean + description: Whether enable persistence. + example: true + +storageClass: + type: string + description: Ghost data Persistent Volume Storage Class, If set to "-", storageClassName: "" which disables dynamic provisioning. + example: "-" + +accessMode: + type: string + description: Access mode for the Persistent Volume Storage. + example: ReadWriteOnce + +size: + type: string + description: Size the Persistent Volume Storage. + example: 8Gi + +path: + type: string + description: Path to be persisted. + example: /bitnami + +## An instance would be: +# enabled: true +# storageClass: "-" +# accessMode: ReadWriteOnce +# size: 8Gi +# path: /bitnami +``` + +### ExistingSecret + +```yaml +name: + type: string + description: Name of the existing secret. + example: mySecret +keyMapping: + description: Mapping between the expected key name and the name of the key in the existing secret. + type: object + +## An instance would be: +# name: mySecret +# keyMapping: +# password: myPasswordKey +``` + +#### Example of use + +When we store sensitive data for a deployment in a secret, some times we want to give to users the possibility of using theirs existing secrets. + +```yaml +# templates/secret.yaml +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.names.fullname" . }} + labels: + app: {{ include "common.names.fullname" . }} +type: Opaque +data: + password: {{ .Values.password | b64enc | quote }} + +# templates/dpl.yaml +--- +... + env: + - name: PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "common.secrets.name" (dict "existingSecret" .Values.existingSecret "context" $) }} + key: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "password") }} +... + +# values.yaml +--- +name: mySecret +keyMapping: + password: myPasswordKey +``` + +### ValidateValue + +#### NOTES.txt + +```console +{{- $validateValueConf00 := (dict "valueKey" "path.to.value00" "secret" "secretName" "field" "password-00") -}} +{{- $validateValueConf01 := (dict "valueKey" "path.to.value01" "secret" "secretName" "field" "password-01") -}} + +{{ include "common.validations.values.multiple.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }} +``` + +If we force those values to be empty we will see some alerts + +```console +$ helm install test mychart --set path.to.value00="",path.to.value01="" + 'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value: + + export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 -d) + + 'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value: + + export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 -d) +``` + +## Upgrading + +### To 1.0.0 + +[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL. + +**What changes were introduced in this major version?** + +- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field. +- Use `type: library`. [Here](https://v3.helm.sh/docs/faq/#library-chart-support) you can find more information. +- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts + +**Considerations when upgrading to this version** + +- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues +- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore +- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3 + +**Useful links** + +- https://docs.bitnami.com/tutorials/resolve-helm2-helm3-post-migration-issues/ +- https://helm.sh/docs/topics/v2_v3_migration/ +- https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/ + +## License + +Copyright © 2022 Bitnami + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_affinities.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_affinities.tpl new file mode 100644 index 00000000..2387be26 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_affinities.tpl @@ -0,0 +1,102 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Return a soft nodeAffinity definition +{{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes.soft" -}} +preferredDuringSchedulingIgnoredDuringExecution: + - preference: + matchExpressions: + - key: {{ .key }} + operator: In + values: + {{- range .values }} + - {{ . | quote }} + {{- end }} + weight: 1 +{{- end -}} + +{{/* +Return a hard nodeAffinity definition +{{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes.hard" -}} +requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: {{ .key }} + operator: In + values: + {{- range .values }} + - {{ . | quote }} + {{- end }} +{{- end -}} + +{{/* +Return a nodeAffinity definition +{{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes" -}} + {{- if eq .type "soft" }} + {{- include "common.affinities.nodes.soft" . -}} + {{- else if eq .type "hard" }} + {{- include "common.affinities.nodes.hard" . -}} + {{- end -}} +{{- end -}} + +{{/* +Return a soft podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods.soft" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}} +*/}} +{{- define "common.affinities.pods.soft" -}} +{{- $component := default "" .component -}} +{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} +preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 10 }} + {{- if not (empty $component) }} + {{ printf "app.kubernetes.io/component: %s" $component }} + {{- end }} + {{- range $key, $value := $extraMatchLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + namespaces: + - {{ include "common.names.namespace" .context | quote }} + topologyKey: kubernetes.io/hostname + weight: 1 +{{- end -}} + +{{/* +Return a hard podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods.hard" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}} +*/}} +{{- define "common.affinities.pods.hard" -}} +{{- $component := default "" .component -}} +{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} +requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 8 }} + {{- if not (empty $component) }} + {{ printf "app.kubernetes.io/component: %s" $component }} + {{- end }} + {{- range $key, $value := $extraMatchLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + namespaces: + - {{ include "common.names.namespace" .context | quote }} + topologyKey: kubernetes.io/hostname +{{- end -}} + +{{/* +Return a podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.pods" -}} + {{- if eq .type "soft" }} + {{- include "common.affinities.pods.soft" . -}} + {{- else if eq .type "hard" }} + {{- include "common.affinities.pods.hard" . -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_capabilities.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_capabilities.tpl new file mode 100644 index 00000000..9d9b7600 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_capabilities.tpl @@ -0,0 +1,154 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Return the target Kubernetes version +*/}} +{{- define "common.capabilities.kubeVersion" -}} +{{- if .Values.global }} + {{- if .Values.global.kubeVersion }} + {{- .Values.global.kubeVersion -}} + {{- else }} + {{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} + {{- end -}} +{{- else }} +{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for poddisruptionbudget. +*/}} +{{- define "common.capabilities.policy.apiVersion" -}} +{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "policy/v1beta1" -}} +{{- else -}} +{{- print "policy/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for networkpolicy. +*/}} +{{- define "common.capabilities.networkPolicy.apiVersion" -}} +{{- if semverCompare "<1.7-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for cronjob. +*/}} +{{- define "common.capabilities.cronjob.apiVersion" -}} +{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "batch/v1beta1" -}} +{{- else -}} +{{- print "batch/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for deployment. +*/}} +{{- define "common.capabilities.deployment.apiVersion" -}} +{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for statefulset. +*/}} +{{- define "common.capabilities.statefulset.apiVersion" -}} +{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apps/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for ingress. +*/}} +{{- define "common.capabilities.ingress.apiVersion" -}} +{{- if .Values.ingress -}} +{{- if .Values.ingress.apiVersion -}} +{{- .Values.ingress.apiVersion -}} +{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end }} +{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for RBAC resources. +*/}} +{{- define "common.capabilities.rbac.apiVersion" -}} +{{- if semverCompare "<1.17-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "rbac.authorization.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "rbac.authorization.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for CRDs. +*/}} +{{- define "common.capabilities.crd.apiVersion" -}} +{{- if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apiextensions.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "apiextensions.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for APIService. +*/}} +{{- define "common.capabilities.apiService.apiVersion" -}} +{{- if semverCompare "<1.10-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apiregistration.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "apiregistration.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for Horizontal Pod Autoscaler. +*/}} +{{- define "common.capabilities.hpa.apiVersion" -}} +{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .context) -}} +{{- if .beta2 -}} +{{- print "autoscaling/v2beta2" -}} +{{- else -}} +{{- print "autoscaling/v2beta1" -}} +{{- end -}} +{{- else -}} +{{- print "autoscaling/v2" -}} +{{- end -}} +{{- end -}} + +{{/* +Returns true if the used Helm version is 3.3+. +A way to check the used Helm version was not introduced until version 3.3.0 with .Capabilities.HelmVersion, which contains an additional "{}}" structure. +This check is introduced as a regexMatch instead of {{ if .Capabilities.HelmVersion }} because checking for the key HelmVersion in <3.3 results in a "interface not found" error. +**To be removed when the catalog's minimun Helm version is 3.3** +*/}} +{{- define "common.capabilities.supportsHelmVersion" -}} +{{- if regexMatch "{(v[0-9])*[^}]*}}$" (.Capabilities | toString ) }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_errors.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_errors.tpl new file mode 100644 index 00000000..a79cc2e3 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_errors.tpl @@ -0,0 +1,23 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Through error when upgrading using empty passwords values that must not be empty. + +Usage: +{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}} +{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}} +{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }} + +Required password params: + - validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error. + - context - Context - Required. Parent context. +*/}} +{{- define "common.errors.upgrade.passwords.empty" -}} + {{- $validationErrors := join "" .validationErrors -}} + {{- if and $validationErrors .context.Release.IsUpgrade -}} + {{- $errorString := "\nPASSWORDS ERROR: You must provide your current passwords when upgrading the release." -}} + {{- $errorString = print $errorString "\n Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims." -}} + {{- $errorString = print $errorString "\n Further information can be obtained at https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases" -}} + {{- $errorString = print $errorString "\n%s" -}} + {{- printf $errorString $validationErrors | fail -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_images.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_images.tpl new file mode 100644 index 00000000..42ffbc72 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_images.tpl @@ -0,0 +1,75 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Return the proper image name +{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }} +*/}} +{{- define "common.images.image" -}} +{{- $registryName := .imageRoot.registry -}} +{{- $repositoryName := .imageRoot.repository -}} +{{- $tag := .imageRoot.tag | toString -}} +{{- if .global }} + {{- if .global.imageRegistry }} + {{- $registryName = .global.imageRegistry -}} + {{- end -}} +{{- end -}} +{{- if $registryName }} +{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- else -}} +{{- printf "%s:%s" $repositoryName $tag -}} +{{- end -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) +{{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }} +*/}} +{{- define "common.images.pullSecrets" -}} + {{- $pullSecrets := list }} + + {{- if .global }} + {{- range .global.imagePullSecrets -}} + {{- $pullSecrets = append $pullSecrets . -}} + {{- end -}} + {{- end -}} + + {{- range .images -}} + {{- range .pullSecrets -}} + {{- $pullSecrets = append $pullSecrets . -}} + {{- end -}} + {{- end -}} + + {{- if (not (empty $pullSecrets)) }} +imagePullSecrets: + {{- range $pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names evaluating values as templates +{{ include "common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }} +*/}} +{{- define "common.images.renderPullSecrets" -}} + {{- $pullSecrets := list }} + {{- $context := .context }} + + {{- if $context.Values.global }} + {{- range $context.Values.global.imagePullSecrets -}} + {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} + {{- end -}} + {{- end -}} + + {{- range .images -}} + {{- range .pullSecrets -}} + {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} + {{- end -}} + {{- end -}} + + {{- if (not (empty $pullSecrets)) }} +imagePullSecrets: + {{- range $pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_ingress.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_ingress.tpl new file mode 100644 index 00000000..8caf73a6 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_ingress.tpl @@ -0,0 +1,68 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Generate backend entry that is compatible with all Kubernetes API versions. + +Usage: +{{ include "common.ingress.backend" (dict "serviceName" "backendName" "servicePort" "backendPort" "context" $) }} + +Params: + - serviceName - String. Name of an existing service backend + - servicePort - String/Int. Port name (or number) of the service. It will be translated to different yaml depending if it is a string or an integer. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "common.ingress.backend" -}} +{{- $apiVersion := (include "common.capabilities.ingress.apiVersion" .context) -}} +{{- if or (eq $apiVersion "extensions/v1beta1") (eq $apiVersion "networking.k8s.io/v1beta1") -}} +serviceName: {{ .serviceName }} +servicePort: {{ .servicePort }} +{{- else -}} +service: + name: {{ .serviceName }} + port: + {{- if typeIs "string" .servicePort }} + name: {{ .servicePort }} + {{- else if or (typeIs "int" .servicePort) (typeIs "float64" .servicePort) }} + number: {{ .servicePort | int }} + {{- end }} +{{- end -}} +{{- end -}} + +{{/* +Print "true" if the API pathType field is supported +Usage: +{{ include "common.ingress.supportsPathType" . }} +*/}} +{{- define "common.ingress.supportsPathType" -}} +{{- if (semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .)) -}} +{{- print "false" -}} +{{- else -}} +{{- print "true" -}} +{{- end -}} +{{- end -}} + +{{/* +Returns true if the ingressClassname field is supported +Usage: +{{ include "common.ingress.supportsIngressClassname" . }} +*/}} +{{- define "common.ingress.supportsIngressClassname" -}} +{{- if semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "false" -}} +{{- else -}} +{{- print "true" -}} +{{- end -}} +{{- end -}} + +{{/* +Return true if cert-manager required annotations for TLS signed +certificates are set in the Ingress annotations +Ref: https://cert-manager.io/docs/usage/ingress/#supported-annotations +Usage: +{{ include "common.ingress.certManagerRequest" ( dict "annotations" .Values.path.to.the.ingress.annotations ) }} +*/}} +{{- define "common.ingress.certManagerRequest" -}} +{{ if or (hasKey .annotations "cert-manager.io/cluster-issuer") (hasKey .annotations "cert-manager.io/issuer") }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_labels.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_labels.tpl new file mode 100644 index 00000000..252066c7 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_labels.tpl @@ -0,0 +1,18 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Kubernetes standard labels +*/}} +{{- define "common.labels.standard" -}} +app.kubernetes.io/name: {{ include "common.names.name" . }} +helm.sh/chart: {{ include "common.names.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector +*/}} +{{- define "common.labels.matchLabels" -}} +app.kubernetes.io/name: {{ include "common.names.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_names.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_names.tpl new file mode 100644 index 00000000..1bdac8b7 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_names.tpl @@ -0,0 +1,70 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "common.names.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "common.names.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "common.names.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create a default fully qualified dependency name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +Usage: +{{ include "common.names.dependency.fullname" (dict "chartName" "dependency-chart-name" "chartValues" .Values.dependency-chart "context" $) }} +*/}} +{{- define "common.names.dependency.fullname" -}} +{{- if .chartValues.fullnameOverride -}} +{{- .chartValues.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .chartName .chartValues.nameOverride -}} +{{- if contains $name .context.Release.Name -}} +{{- .context.Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .context.Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Allow the release namespace to be overridden for multi-namespace deployments in combined charts. +*/}} +{{- define "common.names.namespace" -}} +{{- if .Values.namespaceOverride -}} +{{- .Values.namespaceOverride -}} +{{- else -}} +{{- .Release.Namespace -}} +{{- end -}} +{{- end -}} + +{{/* +Create a fully qualified app name adding the installation's namespace. +*/}} +{{- define "common.names.fullname.namespace" -}} +{{- printf "%s-%s" (include "common.names.fullname" .) (include "common.names.namespace" .) | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_secrets.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_secrets.tpl new file mode 100644 index 00000000..a53fb44f --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_secrets.tpl @@ -0,0 +1,140 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Generate secret name. + +Usage: +{{ include "common.secrets.name" (dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $) }} + +Params: + - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user + to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility. + +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret + - defaultNameSuffix - String - Optional. It is used only if we have several secrets in the same deployment. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "common.secrets.name" -}} +{{- $name := (include "common.names.fullname" .context) -}} + +{{- if .defaultNameSuffix -}} +{{- $name = printf "%s-%s" $name .defaultNameSuffix | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- with .existingSecret -}} +{{- if not (typeIs "string" .) -}} +{{- with .name -}} +{{- $name = . -}} +{{- end -}} +{{- else -}} +{{- $name = . -}} +{{- end -}} +{{- end -}} + +{{- printf "%s" $name -}} +{{- end -}} + +{{/* +Generate secret key. + +Usage: +{{ include "common.secrets.key" (dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName") }} + +Params: + - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user + to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility. + +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret + - key - String - Required. Name of the key in the secret. +*/}} +{{- define "common.secrets.key" -}} +{{- $key := .key -}} + +{{- if .existingSecret -}} + {{- if not (typeIs "string" .existingSecret) -}} + {{- if .existingSecret.keyMapping -}} + {{- $key = index .existingSecret.keyMapping $.key -}} + {{- end -}} + {{- end }} +{{- end -}} + +{{- printf "%s" $key -}} +{{- end -}} + +{{/* +Generate secret password or retrieve one if already created. + +Usage: +{{ include "common.secrets.passwords.manage" (dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $) }} + +Params: + - secret - String - Required - Name of the 'Secret' resource where the password is stored. + - key - String - Required - Name of the key in the secret. + - providedValues - List - Required - The path to the validating value in the values.yaml, e.g: "mysql.password". Will pick first parameter with a defined value. + - length - int - Optional - Length of the generated random password. + - strong - Boolean - Optional - Whether to add symbols to the generated random password. + - chartName - String - Optional - Name of the chart used when said chart is deployed as a subchart. + - context - Context - Required - Parent context. + +The order in which this function returns a secret password: + 1. Already existing 'Secret' resource + (If a 'Secret' resource is found under the name provided to the 'secret' parameter to this function and that 'Secret' resource contains a key with the name passed as the 'key' parameter to this function then the value of this existing secret password will be returned) + 2. Password provided via the values.yaml + (If one of the keys passed to the 'providedValues' parameter to this function is a valid path to a key in the values.yaml and has a value, the value of the first key with a value will be returned) + 3. Randomly generated secret password + (A new random secret password with the length specified in the 'length' parameter will be generated and returned) + +*/}} +{{- define "common.secrets.passwords.manage" -}} + +{{- $password := "" }} +{{- $subchart := "" }} +{{- $chartName := default "" .chartName }} +{{- $passwordLength := default 10 .length }} +{{- $providedPasswordKey := include "common.utils.getKeyFromList" (dict "keys" .providedValues "context" $.context) }} +{{- $providedPasswordValue := include "common.utils.getValueFromKey" (dict "key" $providedPasswordKey "context" $.context) }} +{{- $secretData := (lookup "v1" "Secret" $.context.Release.Namespace .secret).data }} +{{- if $secretData }} + {{- if hasKey $secretData .key }} + {{- $password = index $secretData .key }} + {{- else }} + {{- printf "\nPASSWORDS ERROR: The secret \"%s\" does not contain the key \"%s\"\n" .secret .key | fail -}} + {{- end -}} +{{- else if $providedPasswordValue }} + {{- $password = $providedPasswordValue | toString | b64enc | quote }} +{{- else }} + + {{- if .context.Values.enabled }} + {{- $subchart = $chartName }} + {{- end -}} + + {{- $requiredPassword := dict "valueKey" $providedPasswordKey "secret" .secret "field" .key "subchart" $subchart "context" $.context -}} + {{- $requiredPasswordError := include "common.validations.values.single.empty" $requiredPassword -}} + {{- $passwordValidationErrors := list $requiredPasswordError -}} + {{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordValidationErrors "context" $.context) -}} + + {{- if .strong }} + {{- $subStr := list (lower (randAlpha 1)) (randNumeric 1) (upper (randAlpha 1)) | join "_" }} + {{- $password = randAscii $passwordLength }} + {{- $password = regexReplaceAllLiteral "\\W" $password "@" | substr 5 $passwordLength }} + {{- $password = printf "%s%s" $subStr $password | toString | shuffle | b64enc | quote }} + {{- else }} + {{- $password = randAlphaNum $passwordLength | b64enc | quote }} + {{- end }} +{{- end -}} +{{- printf "%s" $password -}} +{{- end -}} + +{{/* +Returns whether a previous generated secret already exists + +Usage: +{{ include "common.secrets.exists" (dict "secret" "secret-name" "context" $) }} + +Params: + - secret - String - Required - Name of the 'Secret' resource where the password is stored. + - context - Context - Required - Parent context. +*/}} +{{- define "common.secrets.exists" -}} +{{- $secret := (lookup "v1" "Secret" $.context.Release.Namespace .secret) }} +{{- if $secret }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_storage.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_storage.tpl new file mode 100644 index 00000000..60e2a844 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_storage.tpl @@ -0,0 +1,23 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Return the proper Storage Class +{{ include "common.storage.class" ( dict "persistence" .Values.path.to.the.persistence "global" $) }} +*/}} +{{- define "common.storage.class" -}} + +{{- $storageClass := .persistence.storageClass -}} +{{- if .global -}} + {{- if .global.storageClass -}} + {{- $storageClass = .global.storageClass -}} + {{- end -}} +{{- end -}} + +{{- if $storageClass -}} + {{- if (eq "-" $storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" $storageClass -}} + {{- end -}} +{{- end -}} + +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_tplvalues.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_tplvalues.tpl new file mode 100644 index 00000000..2db16685 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_tplvalues.tpl @@ -0,0 +1,13 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Renders a value that contains template. +Usage: +{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }} +*/}} +{{- define "common.tplvalues.render" -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{- else }} + {{- tpl (.value | toYaml) .context }} + {{- end }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_utils.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_utils.tpl new file mode 100644 index 00000000..8c22b2a3 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_utils.tpl @@ -0,0 +1,62 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Print instructions to get a secret value. +Usage: +{{ include "common.utils.secret.getvalue" (dict "secret" "secret-name" "field" "secret-value-field" "context" $) }} +*/}} +{{- define "common.utils.secret.getvalue" -}} +{{- $varname := include "common.utils.fieldToEnvVar" . -}} +export {{ $varname }}=$(kubectl get secret --namespace {{ .context.Release.Namespace | quote }} {{ .secret }} -o jsonpath="{.data.{{ .field }}}" | base64 -d) +{{- end -}} + +{{/* +Build env var name given a field +Usage: +{{ include "common.utils.fieldToEnvVar" dict "field" "my-password" }} +*/}} +{{- define "common.utils.fieldToEnvVar" -}} + {{- $fieldNameSplit := splitList "-" .field -}} + {{- $upperCaseFieldNameSplit := list -}} + + {{- range $fieldNameSplit -}} + {{- $upperCaseFieldNameSplit = append $upperCaseFieldNameSplit ( upper . ) -}} + {{- end -}} + + {{ join "_" $upperCaseFieldNameSplit }} +{{- end -}} + +{{/* +Gets a value from .Values given +Usage: +{{ include "common.utils.getValueFromKey" (dict "key" "path.to.key" "context" $) }} +*/}} +{{- define "common.utils.getValueFromKey" -}} +{{- $splitKey := splitList "." .key -}} +{{- $value := "" -}} +{{- $latestObj := $.context.Values -}} +{{- range $splitKey -}} + {{- if not $latestObj -}} + {{- printf "please review the entire path of '%s' exists in values" $.key | fail -}} + {{- end -}} + {{- $value = ( index $latestObj . ) -}} + {{- $latestObj = $value -}} +{{- end -}} +{{- printf "%v" (default "" $value) -}} +{{- end -}} + +{{/* +Returns first .Values key with a defined value or first of the list if all non-defined +Usage: +{{ include "common.utils.getKeyFromList" (dict "keys" (list "path.to.key1" "path.to.key2") "context" $) }} +*/}} +{{- define "common.utils.getKeyFromList" -}} +{{- $key := first .keys -}} +{{- $reverseKeys := reverse .keys }} +{{- range $reverseKeys }} + {{- $value := include "common.utils.getValueFromKey" (dict "key" . "context" $.context ) }} + {{- if $value -}} + {{- $key = . }} + {{- end -}} +{{- end -}} +{{- printf "%s" $key -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_warnings.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_warnings.tpl new file mode 100644 index 00000000..ae10fa41 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/_warnings.tpl @@ -0,0 +1,14 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Warning about using rolling tag. +Usage: +{{ include "common.warnings.rollingTag" .Values.path.to.the.imageRoot }} +*/}} +{{- define "common.warnings.rollingTag" -}} + +{{- if and (contains "bitnami/" .repository) (not (.tag | toString | regexFind "-r\\d+$|sha256:")) }} +WARNING: Rolling tag detected ({{ .repository }}:{{ .tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment. ++info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/ +{{- end }} + +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_cassandra.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_cassandra.tpl new file mode 100644 index 00000000..ded1ae3b --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_cassandra.tpl @@ -0,0 +1,72 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate Cassandra required passwords are not empty. + +Usage: +{{ include "common.validations.values.cassandra.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where Cassandra values are stored, e.g: "cassandra-passwords-secret" + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.cassandra.passwords" -}} + {{- $existingSecret := include "common.cassandra.values.existingSecret" . -}} + {{- $enabled := include "common.cassandra.values.enabled" . -}} + {{- $dbUserPrefix := include "common.cassandra.values.key.dbUser" . -}} + {{- $valueKeyPassword := printf "%s.password" $dbUserPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "cassandra-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.cassandra.values.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.cassandra.values.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.cassandra.dbUser.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.dbUser.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled cassandra. + +Usage: +{{ include "common.cassandra.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.cassandra.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.cassandra.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key dbUser + +Usage: +{{ include "common.cassandra.values.key.dbUser" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.cassandra.values.key.dbUser" -}} + {{- if .subchart -}} + cassandra.dbUser + {{- else -}} + dbUser + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_mariadb.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_mariadb.tpl new file mode 100644 index 00000000..b6906ff7 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_mariadb.tpl @@ -0,0 +1,103 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MariaDB required passwords are not empty. + +Usage: +{{ include "common.validations.values.mariadb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MariaDB values are stored, e.g: "mysql-passwords-secret" + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mariadb.passwords" -}} + {{- $existingSecret := include "common.mariadb.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mariadb.values.enabled" . -}} + {{- $architecture := include "common.mariadb.values.architecture" . -}} + {{- $authPrefix := include "common.mariadb.values.key.auth" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mariadb-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- if not (empty $valueUsername) -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mariadb-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replication") -}} + {{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mariadb-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mariadb.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mariadb.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mariadb. + +Usage: +{{ include "common.mariadb.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mariadb.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mariadb.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mariadb.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mariadb.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mariadb.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.key.auth" -}} + {{- if .subchart -}} + mariadb.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_mongodb.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_mongodb.tpl new file mode 100644 index 00000000..f820ec10 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_mongodb.tpl @@ -0,0 +1,108 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MongoDB® required passwords are not empty. + +Usage: +{{ include "common.validations.values.mongodb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MongoDB® values are stored, e.g: "mongodb-passwords-secret" + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mongodb.passwords" -}} + {{- $existingSecret := include "common.mongodb.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mongodb.values.enabled" . -}} + {{- $authPrefix := include "common.mongodb.values.key.auth" . -}} + {{- $architecture := include "common.mongodb.values.architecture" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyDatabase := printf "%s.database" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicaSetKey := printf "%s.replicaSetKey" $authPrefix -}} + {{- $valueKeyAuthEnabled := printf "%s.enabled" $authPrefix -}} + + {{- $authEnabled := include "common.utils.getValueFromKey" (dict "key" $valueKeyAuthEnabled "context" .context) -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") (eq $authEnabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mongodb-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- $valueDatabase := include "common.utils.getValueFromKey" (dict "key" $valueKeyDatabase "context" .context) }} + {{- if and $valueUsername $valueDatabase -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mongodb-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replicaset") -}} + {{- $requiredReplicaSetKey := dict "valueKey" $valueKeyReplicaSetKey "secret" .secret "field" "mongodb-replica-set-key" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicaSetKey -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mongodb.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDb is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mongodb.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mongodb. + +Usage: +{{ include "common.mongodb.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mongodb.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mongodb.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mongodb.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.key.auth" -}} + {{- if .subchart -}} + mongodb.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mongodb.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mongodb.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_mysql.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_mysql.tpl new file mode 100644 index 00000000..74472a06 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_mysql.tpl @@ -0,0 +1,103 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MySQL required passwords are not empty. + +Usage: +{{ include "common.validations.values.mysql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MySQL values are stored, e.g: "mysql-passwords-secret" + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mysql.passwords" -}} + {{- $existingSecret := include "common.mysql.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mysql.values.enabled" . -}} + {{- $architecture := include "common.mysql.values.architecture" . -}} + {{- $authPrefix := include "common.mysql.values.key.auth" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mysql-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- if not (empty $valueUsername) -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mysql-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replication") -}} + {{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mysql-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mysql.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mysql.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mysql. + +Usage: +{{ include "common.mysql.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mysql.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mysql.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mysql.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mysql.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mysql.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.key.auth" -}} + {{- if .subchart -}} + mysql.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_postgresql.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_postgresql.tpl new file mode 100644 index 00000000..164ec0d0 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_postgresql.tpl @@ -0,0 +1,129 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate PostgreSQL required passwords are not empty. + +Usage: +{{ include "common.validations.values.postgresql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where postgresql values are stored, e.g: "postgresql-passwords-secret" + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.postgresql.passwords" -}} + {{- $existingSecret := include "common.postgresql.values.existingSecret" . -}} + {{- $enabled := include "common.postgresql.values.enabled" . -}} + {{- $valueKeyPostgresqlPassword := include "common.postgresql.values.key.postgressPassword" . -}} + {{- $valueKeyPostgresqlReplicationEnabled := include "common.postgresql.values.key.replicationPassword" . -}} + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + {{- $requiredPostgresqlPassword := dict "valueKey" $valueKeyPostgresqlPassword "secret" .secret "field" "postgresql-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlPassword -}} + + {{- $enabledReplication := include "common.postgresql.values.enabled.replication" . -}} + {{- if (eq $enabledReplication "true") -}} + {{- $requiredPostgresqlReplicationPassword := dict "valueKey" $valueKeyPostgresqlReplicationEnabled "secret" .secret "field" "postgresql-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to decide whether evaluate global values. + +Usage: +{{ include "common.postgresql.values.use.global" (dict "key" "key-of-global" "context" $) }} +Params: + - key - String - Required. Field to be evaluated within global, e.g: "existingSecret" +*/}} +{{- define "common.postgresql.values.use.global" -}} + {{- if .context.Values.global -}} + {{- if .context.Values.global.postgresql -}} + {{- index .context.Values.global.postgresql .key | quote -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.postgresql.values.existingSecret" (dict "context" $) }} +*/}} +{{- define "common.postgresql.values.existingSecret" -}} + {{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "existingSecret" "context" .context) -}} + + {{- if .subchart -}} + {{- default (.context.Values.postgresql.existingSecret | quote) $globalValue -}} + {{- else -}} + {{- default (.context.Values.existingSecret | quote) $globalValue -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled postgresql. + +Usage: +{{ include "common.postgresql.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.postgresql.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.postgresql.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key postgressPassword. + +Usage: +{{ include "common.postgresql.values.key.postgressPassword" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.key.postgressPassword" -}} + {{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "postgresqlUsername" "context" .context) -}} + + {{- if not $globalValue -}} + {{- if .subchart -}} + postgresql.postgresqlPassword + {{- else -}} + postgresqlPassword + {{- end -}} + {{- else -}} + global.postgresql.postgresqlPassword + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled.replication. + +Usage: +{{ include "common.postgresql.values.enabled.replication" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.enabled.replication" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.postgresql.replication.enabled -}} + {{- else -}} + {{- printf "%v" .context.Values.replication.enabled -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key replication.password. + +Usage: +{{ include "common.postgresql.values.key.replicationPassword" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.key.replicationPassword" -}} + {{- if .subchart -}} + postgresql.replication.password + {{- else -}} + replication.password + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_redis.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_redis.tpl new file mode 100644 index 00000000..dcccfc1a --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_redis.tpl @@ -0,0 +1,76 @@ + +{{/* vim: set filetype=mustache: */}} +{{/* +Validate Redis® required passwords are not empty. + +Usage: +{{ include "common.validations.values.redis.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where redis values are stored, e.g: "redis-passwords-secret" + - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.redis.passwords" -}} + {{- $enabled := include "common.redis.values.enabled" . -}} + {{- $valueKeyPrefix := include "common.redis.values.keys.prefix" . -}} + {{- $standarizedVersion := include "common.redis.values.standarized.version" . }} + + {{- $existingSecret := ternary (printf "%s%s" $valueKeyPrefix "auth.existingSecret") (printf "%s%s" $valueKeyPrefix "existingSecret") (eq $standarizedVersion "true") }} + {{- $existingSecretValue := include "common.utils.getValueFromKey" (dict "key" $existingSecret "context" .context) }} + + {{- $valueKeyRedisPassword := ternary (printf "%s%s" $valueKeyPrefix "auth.password") (printf "%s%s" $valueKeyPrefix "password") (eq $standarizedVersion "true") }} + {{- $valueKeyRedisUseAuth := ternary (printf "%s%s" $valueKeyPrefix "auth.enabled") (printf "%s%s" $valueKeyPrefix "usePassword") (eq $standarizedVersion "true") }} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $useAuth := include "common.utils.getValueFromKey" (dict "key" $valueKeyRedisUseAuth "context" .context) -}} + {{- if eq $useAuth "true" -}} + {{- $requiredRedisPassword := dict "valueKey" $valueKeyRedisPassword "secret" .secret "field" "redis-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRedisPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled redis. + +Usage: +{{ include "common.redis.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.redis.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.redis.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right prefix path for the values + +Usage: +{{ include "common.redis.values.key.prefix" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false +*/}} +{{- define "common.redis.values.keys.prefix" -}} + {{- if .subchart -}}redis.{{- else -}}{{- end -}} +{{- end -}} + +{{/* +Checks whether the redis chart's includes the standarizations (version >= 14) + +Usage: +{{ include "common.redis.values.standarized.version" (dict "context" $) }} +*/}} +{{- define "common.redis.values.standarized.version" -}} + + {{- $standarizedAuth := printf "%s%s" (include "common.redis.values.keys.prefix" .) "auth" -}} + {{- $standarizedAuthValues := include "common.utils.getValueFromKey" (dict "key" $standarizedAuth "context" .context) }} + + {{- if $standarizedAuthValues -}} + {{- true -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_validations.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_validations.tpl new file mode 100644 index 00000000..9a814cf4 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/templates/validations/_validations.tpl @@ -0,0 +1,46 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate values must not be empty. + +Usage: +{{- $validateValueConf00 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-00") -}} +{{- $validateValueConf01 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-01") -}} +{{ include "common.validations.values.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }} + +Validate value params: + - valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password" + - secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret" + - field - String - Optional. Name of the field in the secret data, e.g: "mysql-password" +*/}} +{{- define "common.validations.values.multiple.empty" -}} + {{- range .required -}} + {{- include "common.validations.values.single.empty" (dict "valueKey" .valueKey "secret" .secret "field" .field "context" $.context) -}} + {{- end -}} +{{- end -}} + +{{/* +Validate a value must not be empty. + +Usage: +{{ include "common.validations.value.empty" (dict "valueKey" "mariadb.password" "secret" "secretName" "field" "my-password" "subchart" "subchart" "context" $) }} + +Validate value params: + - valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password" + - secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret" + - field - String - Optional. Name of the field in the secret data, e.g: "mysql-password" + - subchart - String - Optional - Name of the subchart that the validated password is part of. +*/}} +{{- define "common.validations.values.single.empty" -}} + {{- $value := include "common.utils.getValueFromKey" (dict "key" .valueKey "context" .context) }} + {{- $subchart := ternary "" (printf "%s." .subchart) (empty .subchart) }} + + {{- if not $value -}} + {{- $varname := "my-value" -}} + {{- $getCurrentValue := "" -}} + {{- if and .secret .field -}} + {{- $varname = include "common.utils.fieldToEnvVar" . -}} + {{- $getCurrentValue = printf " To get the current value:\n\n %s\n" (include "common.utils.secret.getvalue" .) -}} + {{- end -}} + {{- printf "\n '%s' must not be empty, please add '--set %s%s=$%s' to the command.%s" .valueKey $subchart .valueKey $varname $getCurrentValue -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/values.yaml b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/values.yaml new file mode 100644 index 00000000..f2df68e5 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/charts/common/values.yaml @@ -0,0 +1,5 @@ +## bitnami/common +## It is required by CI/CD tools and processes. +## @skip exampleValue +## +exampleValue: common-chart diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/templates/_helpers.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/templates/_helpers.tpl new file mode 100644 index 00000000..7be7bc1a --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/templates/_helpers.tpl @@ -0,0 +1,51 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "airbyte.labels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "airbyte.selectorLabels" -}} +app.kubernetes.io/name: {{ include "airbyte.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/templates/_images.tpl b/helm/airbyte-v1/charts/connector-rollout-worker/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/templates/deployment.yaml b/helm/airbyte-v1/charts/connector-rollout-worker/templates/deployment.yaml new file mode 100644 index 00000000..f1094295 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/templates/deployment.yaml @@ -0,0 +1,216 @@ +{{- if or (eq .Values.global.edition "community") (eq .Values.global.enterprise.connectorRolloutOptIn true)}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "common.names.fullname" . }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} + {{- if .Values.extraLabels }} + {{ toYaml (mergeOverwrite .Values.extraLabels .Values.global.extraLabels) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "airbyte.selectorLabels" . | nindent 6 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 6 }} + {{- end }} + strategy: + type: Recreate + template: + metadata: + labels: + {{- include "airbyte.selectorLabels" . | nindent 8 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 8 }} + {{- end }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.podAnnotations }} + annotations: + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ .Values.global.serviceAccountName }} + automountServiceAccountToken: true + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.extraInitContainers }} + initContainers: + {{- toYaml .Values.extraInitContainers | nindent 6 }} + {{- end }} + containers: + - name: airbyte-connector-rollout-worker-container + image: {{ include "imageUrl" (list .Values.image $) }} + imagePullPolicy: "{{ .Values.image.pullPolicy }}" + env: + {{- if .Values.debug.enabled }} + - name: JAVA_TOOL_OPTIONS + value: "-Xdebug -agentlib:jdwp=transport=dt_socket,address=0.0.0.0:{{ .Values.debug.remoteDebugPort }},server=y,suspend=n" + {{- end }} + {{- if eq .Values.global.deploymentMode "oss" }} + - name: AIRBYTE_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: AIRBYTE_VERSION + - name: INTERNAL_API_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: INTERNAL_API_HOST + - name: MICROMETER_METRICS_ENABLED + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MICROMETER_METRICS_ENABLED + - name: MICROMETER_METRICS_STATSD_FLAVOR + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MICROMETER_METRICS_STATSD_FLAVOR + - name: SEGMENT_WRITE_KEY + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: SEGMENT_WRITE_KEY + - name: STATSD_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STATSD_HOST + - name: STATSD_PORT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STATSD_PORT + - name: TRACKING_STRATEGY + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TRACKING_STRATEGY + - name: WEBAPP_URL + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WEBAPP_URL + - name: TEMPORAL_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TEMPORAL_HOST + - name: TEMPORAL_WORKER_PORTS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TEMPORAL_WORKER_PORTS + - name: LOG_LEVEL + value: "{{ .Values.log.level }}" + {{- end }} + {{- if or (eq .Values.global.edition "pro") (eq .Values.global.edition "enterprise") }} + - name: AIRBYTE_API_AUTH_HEADER_NAME + value: "X-Airbyte-Auth" + - name: AIRBYTE_API_AUTH_HEADER_VALUE + value: "Internal worker" + {{- else if and (eq .Values.global.deploymentMode "oss") .Values.global.auth.enabled }} + # Self-Managed Enterprise and Community w/ auth enabled use the same auth header, just + # splitting into two separate blocks for readability. + - name: AIRBYTE_API_AUTH_HEADER_NAME + value: "X-Airbyte-Auth" + - name: AIRBYTE_API_AUTH_HEADER_VALUE + value: "Internal worker" + {{- end }} + + # Values from secret + {{- if .Values.secrets }} + {{- range $k, $v := .Values.secrets }} + - name: {{ $k }} + valueFrom: + secretKeyRef: + name: connector-rollout-worker-secrets + key: {{ $k }} + {{- end }} + {{- end }} + + # Values from env + {{- if or .Values.env_vars .Values.global.env_vars }} + {{- range $k, $v := mergeOverwrite .Values.env_vars .Values.global.env_vars }} + - name: {{ $k }} + value: {{ $v | quote }} + {{- end }} + {{- end }} + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 8 }} + {{- end }} + + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: /health/liveness + port: heartbeat + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: /health/readiness + port: heartbeat + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} + ports: + {{- if .Values.debug.enabled }} + - name: debug + containerPort: {{ .Values.debug.remoteDebugPort }} + protocol: TCP + {{- end}} + - name: heartbeat + containerPort: 8016 # for heartbeat server + + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 10 }} + {{- end }} + {{- if .Values.containerSecurityContext }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 10 }} + {{- end }} + volumeMounts: + {{- if .Values.extraVolumeMounts }} + {{ toYaml .Values.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.global.extraVolumeMounts }} + {{ toYaml .Values.global.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 6 }} + {{- end }} + {{- if .Values.global.extraContainers }} + {{ toYaml .Values.global.extraContainers | nindent 6 }} + {{- end }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + {{- if .Values.extraVolumes }} + {{ toYaml .Values.extraVolumes | nindent 6 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/templates/secrets.yaml b/helm/airbyte-v1/charts/connector-rollout-worker/templates/secrets.yaml new file mode 100644 index 00000000..24e141b1 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/templates/secrets.yaml @@ -0,0 +1,17 @@ +# Create secrets only for the local deployment +{{- if .Values.secrets }} +apiVersion: v1 +kind: Secret +metadata: + name: connector-rollout-worker-secrets + labels: + {{- include "airbyte.labels" . | nindent 4 }} + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-1" +type: Opaque +data: + {{- range $k, $v := mergeOverwrite .Values.secrets .Values.global.secrets }} + {{ $k }}: {{ if $v }}{{ $v | b64enc }} {{else}}""{{end}} + {{- end }} +{{- end }} diff --git a/helm/airbyte-v1/charts/connector-rollout-worker/values.yaml b/helm/airbyte-v1/charts/connector-rollout-worker/values.yaml new file mode 100644 index 00000000..85d6bf18 --- /dev/null +++ b/helm/airbyte-v1/charts/connector-rollout-worker/values.yaml @@ -0,0 +1,273 @@ +global: + + serviceAccountName: &service-account-name "airbyte-admin" + edition: community + credVolumeOverride: "" + secretName: "" + extraContainers: [] + ## extraSelectorLabels [object] - use to specify own additional selector labels for deployment + extraSelectorLabels: {} + ## extraLabels [object] - use to specify own additional labels for deployment + extraLabels: {} + database: + secretName: "" + secretValue: "" + + # Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "" + + enterprise: + connectorRolloutOptIn: false + + jobs: + ## Jobs resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## jobs.resources.limits [object] The resources limits for jobs + ## jobs.resources.requests [object] The requested resources for jobs + resources: + ## Example: + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + + kube: + ## JOB_KUBE_ANNOTATIONS + ## pod annotations of the sync job and the default pod annotations fallback for others jobs + ## jobs.kube.annotations [object] key/value annotations applied to kube jobs + annotations: {} + + ## JOB_KUBE_LABELS + ## pod labels of the sync job and the default pod labels fallback for others jobs + ## jobs.kube.labels [object] key/value labels applied to kube jobs + labels: {} + + ## JOB_KUBE_NODE_SELECTORS + ## pod node selector of the sync job and the default pod node selector fallback for others jobs + ## jobs.kube.nodeSelector [object] key/value node selector applied to kube jobs + nodeSelector: {} + + ## JOB_KUBE_TOLERATIONS + ## jobs.kube.tolerations [array] Tolerations for jobs.kube pod assignment. + ## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + ## any boolean values should be quoted to ensure the value is passed through as a string, eg: + ## - key: airbyte-server + ## operator: Equal + ## value: "true" + ## effect: NoSchedule + tolerations: [] + + ## JOB_KUBE_MAIN_CONTAINER_IMAGE_PULL_SECRET + ## image pull secret to use for job pod + ## jobs.kube.main_container_image_pull_secret [string] image pull secret to use for job pod + main_container_image_pull_secret: "" + + images: + ## JOB_KUBE_BUSYBOX_IMAGE + ## busybox image used by the job pod + ## jobs.kube.images.busybox [string] busybox image used by the job pod + busybox: "" + ## JOB_KUBE_SOCAT_IMAGE + ## socat image used by the job pod + ## jobs.kube.images.socat [string] socat image used by the job pod + socat: "" + ## JOB_KUBE_CURL_IMAGE + ## curl image used by the job pod + ## jobs.kube.images.curl [string] curl image used by the job pod + curl: "" + +enabled: true +## connector-rollout-worker.replicaCount Number of connector-rollout-worker replicas +replicaCount: 1 + +## connector-rollout-worker.image.repository The repository to use for the airbyte connector-rollout-worker image. +## connector-rollout-worker.image.pullPolicy the pull policy to use for the airbyte connector-rollout-worker image +## connector-rollout-worker.image.tag The airbyte connector-rollout-worker image tag. Defaults to the chart's AppVersion +image: + repository: airbyte/connector-rollout-worker + pullPolicy: IfNotPresent + +## connector-rollout-worker.podAnnotations [object] Add extra annotations to the connector-rollout-worker pod(s) +## +podAnnotations: {} + +## connector-rollout-worker.podLabels [object] Add extra labels to the connector-rollout-worker pod(s) +## +podLabels: {} + +## connector-rollout-worker.containerSecurityContext Security context for the container +## Examples: +## containerSecurityContext: +## runAsNonRoot: true +## runAsUser: 1000 +## readOnlyRootFilesystem: true +containerSecurityContext: {} + +## Configure extra options for the connector-rollout-worker containers' liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## connector-rollout-worker.livenessProbe.enabled Enable livenessProbe on the connector-rollout-worker +## connector-rollout-worker.livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe +## connector-rollout-worker.livenessProbe.periodSeconds Period seconds for livenessProbe +## connector-rollout-worker.livenessProbe.timeoutSeconds Timeout seconds for livenessProbe +## connector-rollout-worker.livenessProbe.failureThreshold Failure threshold for livenessProbe +## connector-rollout-worker.livenessProbe.successThreshold Success threshold for livenessProbe +## +livenessProbe: + enabled: true + initialDelaySeconds: 50 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## connector-rollout-worker.readinessProbe.enabled Enable readinessProbe on the connector-rollout-worker +## connector-rollout-worker.readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe +## connector-rollout-worker.readinessProbe.periodSeconds Period seconds for readinessProbe +## connector-rollout-worker.readinessProbe.timeoutSeconds Timeout seconds for readinessProbe +## connector-rollout-worker.readinessProbe.failureThreshold Failure threshold for readinessProbe +## connector-rollout-worker.readinessProbe.successThreshold Success threshold for readinessProbe +## +readinessProbe: + enabled: true + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## connector-rollout-worker resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## We usually recommend not to specify default resources and to leave this as a conscious +## choice for the user. This also increases chances charts run on environments with little +## resources, such as Minikube. If you do want to specify resources, uncomment the following +## lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## connector-rollout-worker.resources.limits [object] The resources limits for the connector-rollout-worker container +## connector-rollout-worker.resources.requests [object] The requested resources for the connector-rollout-worker container +resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + +## connector-rollout-worker.nodeSelector [object] Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## connector-rollout-worker.tolerations [array] Tolerations for connector-rollout-worker pod assignment. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## connector-rollout-worker.affinity [object] Affinity and anti-affinity for connector-rollout-worker pod assignment. +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## connector-rollout-worker.log.level The log level to log at. +log: + level: "INFO" + + + +## connector-rollout-worker.extraVolumeMounts [array] Additional volumeMounts for connector-rollout-worker container(s). +## Examples (when using `connector-rollout-worker.containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumeMounts: +## - name: tmpdir +## mountPath: /tmp +## +extraVolumeMounts: [] + +## connector-rollout-worker.extraVolumes [array] Additional volumes for connector-rollout-worker pod(s). +## Examples (when using `connector-rollout-worker.containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumes: +## - name: tmpdir +## emptyDir: {} +## +extraVolumes: [] + +## extraContainer [array] Additional container for server pod(s) +## Example: +# extraContainers: +# - name: otel_collector +# image: somerepo/someimage:sometag +# args: [ +# "--important-args" +# ] +# ports: +# - containerPort: 443 +# volumeMounts: +# - name: volumeMountCool +# mountPath: /some/path +# readOnly: true +extraContainers: [] + +## extraInitContainers [array] Additional init containers for server pod(s) +## Example: +# extraInitContainers: +# - name: sleepy +# image: alpine +# command: ['sleep', '60'] + +extraInitContainers: [] + +## extraEnv [array] Supply extra env variables to main container using full notation +## Example: (With default env vars and values taken from generated config map) +# extraEnv: +# - name: AIRBYTE_VERSION +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: AIRBYTE_VERSION +## +extraEnv: [] +## secrets [object] Supply additional secrets to container +## Example: +## secrets: +## DATABASE_PASSWORD: strong-password +## DATABASE_USER: my-db-user +secrets: {} + +## env_vars [object] Supply extra env variables to main container using simplified notation +## Example with default values for connector-rollout-worker: +# env_vars: +# AIRBYTE_VERSION: 0.40.4 + +# # Workspace storage for running jobs (logs, etc) +# WORKSPACE_ROOT: /workspace +# WORKSPACE_DOCKER_MOUNT: airbyte_workspace + +# # Miscellaneous +# TRACKING_STRATEGY: segment +# WEBAPP_URL: airbyte-webapp-svc:80 +# INTERNAL_API_HOST: http://airbyte-server-svc:8001 +env_vars: {} + +## extraSelectorLabels [object] - use to specify own additional selector labels for deployment +extraSelectorLabels: {} +## extraLabels [object] - use to specify own additional labels for deployment +extraLabels: {} + +debug: + enabled: true + remoteDebugPort: 5005 diff --git a/helm/airbyte-v1/charts/cron/Chart.lock b/helm/airbyte-v1/charts/cron/Chart.lock new file mode 100644 index 00000000..435017d8 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2022-10-25T16:47:38.253767-04:00" diff --git a/helm/airbyte-v1/charts/cron/Chart.yaml b/helm/airbyte-v1/charts/cron/Chart.yaml new file mode 100644 index 00000000..09559008 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: Helm chart to deploy airbyte-cron +name: cron +type: application +version: 1.3.0 diff --git a/helm/airbyte-v1/charts/cron/README.md b/helm/airbyte-v1/charts/cron/README.md new file mode 100644 index 00000000..9f628a60 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/README.md @@ -0,0 +1,62 @@ +# cron + +![Version: 0.67.17](https://img.shields.io/badge/Version-0.67.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: dev](https://img.shields.io/badge/AppVersion-dev-informational?style=flat-square) + +Helm chart to deploy airbyte-cron + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 1.x.x | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| containerSecurityContext | object | `{}` | | +| enabled | bool | `true` | | +| env_vars | object | `{}` | | +| extraContainers | list | `[]` | | +| extraEnv | list | `[]` | | +| extraInitContainers | list | `[]` | | +| extraLabels | object | `{}` | | +| extraSelectorLabels | object | `{}` | | +| extraVolumeMounts | list | `[]` | | +| extraVolumes | list | `[]` | | +| global.configMapName | string | `""` | | +| global.database.secretName | string | `""` | | +| global.database.secretValue | string | `""` | | +| global.deploymentMode | string | `"oss"` | | +| global.extraContainers | list | `[]` | | +| global.extraLabels | object | `{}` | | +| global.extraSelectorLabels | object | `{}` | | +| global.secretName | string | `""` | | +| global.secrets | object | `{}` | | +| global.serviceAccountName | string | `"placeholderServiceAccount"` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"airbyte/cron"` | | +| livenessProbe.enabled | bool | `true` | | +| livenessProbe.failureThreshold | int | `3` | | +| livenessProbe.initialDelaySeconds | int | `30` | | +| livenessProbe.periodSeconds | int | `10` | | +| livenessProbe.successThreshold | int | `1` | | +| livenessProbe.timeoutSeconds | int | `1` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| readinessProbe.containerSecurityContext | object | `{}` | | +| readinessProbe.enabled | bool | `true` | | +| readinessProbe.failureThreshold | int | `3` | | +| readinessProbe.initialDelaySeconds | int | `10` | | +| readinessProbe.periodSeconds | int | `10` | | +| readinessProbe.successThreshold | int | `1` | | +| readinessProbe.timeoutSeconds | int | `1` | | +| replicaCount | int | `1` | | +| resources.limits | object | `{}` | | +| resources.requests | object | `{}` | | +| secrets | object | `{}` | | +| tolerations | list | `[]` | | +| workloadApi | object | `{}` | | + diff --git a/helm/airbyte-v1/charts/cron/charts/common/.helmignore b/helm/airbyte-v1/charts/cron/charts/common/.helmignore new file mode 100644 index 00000000..50af0317 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/.helmignore @@ -0,0 +1,22 @@ +# 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 +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/airbyte-v1/charts/cron/charts/common/Chart.yaml b/helm/airbyte-v1/charts/cron/charts/common/Chart.yaml new file mode 100644 index 00000000..39edbb3c --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/Chart.yaml @@ -0,0 +1,23 @@ +annotations: + category: Infrastructure +apiVersion: v2 +appVersion: 1.17.1 +description: A Library Helm Chart for grouping common logic between bitnami charts. + This chart is not deployable by itself. +home: https://github.com/bitnami/charts/tree/master/bitnami/common +icon: https://bitnami.com/downloads/logos/bitnami-mark.png +keywords: +- common +- helper +- template +- function +- bitnami +maintainers: +- name: Bitnami + url: https://github.com/bitnami/charts +name: common +sources: +- https://github.com/bitnami/charts +- https://www.bitnami.com/ +type: library +version: 1.17.1 diff --git a/helm/airbyte-v1/charts/cron/charts/common/README.md b/helm/airbyte-v1/charts/cron/charts/common/README.md new file mode 100644 index 00000000..a2ecd604 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/README.md @@ -0,0 +1,350 @@ +# Bitnami Common Library Chart + +A [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between bitnami charts. + +## TL;DR + +```yaml +dependencies: + - name: common + version: 1.x.x + repository: https://charts.bitnami.com/bitnami +``` + +```bash +$ helm dependency update +``` + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.names.fullname" . }} +data: + myvalue: "Hello World" +``` + +## Introduction + +This chart provides a common template helpers which can be used to develop new charts using [Helm](https://helm.sh) package manager. + +Bitnami charts can be used with [Kubeapps](https://kubeapps.dev/) for deployment and management of Helm Charts in clusters. + +## Prerequisites + +- Kubernetes 1.19+ +- Helm 3.2.0+ + +## Parameters + +The following table lists the helpers available in the library which are scoped in different sections. + +### Affinities + +| Helper identifier | Description | Expected Input | +|-------------------------------|------------------------------------------------------|------------------------------------------------| +| `common.affinities.nodes.soft` | Return a soft nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` | +| `common.affinities.nodes.hard` | Return a hard nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` | +| `common.affinities.pods.soft` | Return a soft podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` | +| `common.affinities.pods.hard` | Return a hard podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` | + +### Capabilities + +| Helper identifier | Description | Expected Input | +|------------------------------------------------|------------------------------------------------------------------------------------------------|-------------------| +| `common.capabilities.kubeVersion` | Return the target Kubernetes version (using client default if .Values.kubeVersion is not set). | `.` Chart context | +| `common.capabilities.cronjob.apiVersion` | Return the appropriate apiVersion for cronjob. | `.` Chart context | +| `common.capabilities.deployment.apiVersion` | Return the appropriate apiVersion for deployment. | `.` Chart context | +| `common.capabilities.statefulset.apiVersion` | Return the appropriate apiVersion for statefulset. | `.` Chart context | +| `common.capabilities.ingress.apiVersion` | Return the appropriate apiVersion for ingress. | `.` Chart context | +| `common.capabilities.rbac.apiVersion` | Return the appropriate apiVersion for RBAC resources. | `.` Chart context | +| `common.capabilities.crd.apiVersion` | Return the appropriate apiVersion for CRDs. | `.` Chart context | +| `common.capabilities.policy.apiVersion` | Return the appropriate apiVersion for podsecuritypolicy. | `.` Chart context | +| `common.capabilities.networkPolicy.apiVersion` | Return the appropriate apiVersion for networkpolicy. | `.` Chart context | +| `common.capabilities.apiService.apiVersion` | Return the appropriate apiVersion for APIService. | `.` Chart context | +| `common.capabilities.hpa.apiVersion` | Return the appropriate apiVersion for Horizontal Pod Autoscaler | `.` Chart context | +| `common.capabilities.supportsHelmVersion` | Returns true if the used Helm version is 3.3+ | `.` Chart context | + +### Errors + +| Helper identifier | Description | Expected Input | +|-----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| +| `common.errors.upgrade.passwords.empty` | It will ensure required passwords are given when we are upgrading a chart. If `validationErrors` is not empty it will throw an error and will stop the upgrade action. | `dict "validationErrors" (list $validationError00 $validationError01) "context" $` | + +### Images + +| Helper identifier | Description | Expected Input | +|-----------------------------|------------------------------------------------------|---------------------------------------------------------------------------------------------------------| +| `common.images.image` | Return the proper and full image name | `dict "imageRoot" .Values.path.to.the.image "global" $`, see [ImageRoot](#imageroot) for the structure. | +| `common.images.pullSecrets` | Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global` | +| `common.images.renderPullSecrets` | Return the proper Docker Image Registry Secret Names (evaluates values as templates) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $` | + +### Ingress + +| Helper identifier | Description | Expected Input | +|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.ingress.backend` | Generate a proper Ingress backend entry depending on the API version | `dict "serviceName" "foo" "servicePort" "bar"`, see the [Ingress deprecation notice](https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/) for the syntax differences | +| `common.ingress.supportsPathType` | Prints "true" if the pathType field is supported | `.` Chart context | +| `common.ingress.supportsIngressClassname` | Prints "true" if the ingressClassname field is supported | `.` Chart context | +| `common.ingress.certManagerRequest` | Prints "true" if required cert-manager annotations for TLS signed certificates are set in the Ingress annotations | `dict "annotations" .Values.path.to.the.ingress.annotations` | + +### Labels + +| Helper identifier | Description | Expected Input | +|-----------------------------|-----------------------------------------------------------------------------|-------------------| +| `common.labels.standard` | Return Kubernetes standard labels | `.` Chart context | +| `common.labels.matchLabels` | Labels to use on `deploy.spec.selector.matchLabels` and `svc.spec.selector` | `.` Chart context | + +### Names + +| Helper identifier | Description | Expected Input | +|-----------------------------------|-----------------------------------------------------------------------|-------------------| +| `common.names.name` | Expand the name of the chart or use `.Values.nameOverride` | `.` Chart context | +| `common.names.fullname` | Create a default fully qualified app name. | `.` Chart context | +| `common.names.namespace` | Allow the release namespace to be overridden | `.` Chart context | +| `common.names.fullname.namespace` | Create a fully qualified app name adding the installation's namespace | `.` Chart context | +| `common.names.chart` | Chart name plus version | `.` Chart context | + +### Secrets + +| Helper identifier | Description | Expected Input | +|---------------------------|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.secrets.name` | Generate the name of the secret. | `dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $` see [ExistingSecret](#existingsecret) for the structure. | +| `common.secrets.key` | Generate secret key. | `dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName"` see [ExistingSecret](#existingsecret) for the structure. | +| `common.passwords.manage` | Generate secret password or retrieve one if already created. | `dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $`, length, strong and chartNAme fields are optional. | +| `common.secrets.exists` | Returns whether a previous generated secret already exists. | `dict "secret" "secret-name" "context" $` | + +### Storage + +| Helper identifier | Description | Expected Input | +|-------------------------------|---------------------------------------|---------------------------------------------------------------------------------------------------------------------| +| `common.storage.class` | Return the proper Storage Class | `dict "persistence" .Values.path.to.the.persistence "global" $`, see [Persistence](#persistence) for the structure. | + +### TplValues + +| Helper identifier | Description | Expected Input | +|---------------------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.tplvalues.render` | Renders a value that contains template | `dict "value" .Values.path.to.the.Value "context" $`, value is the value should rendered as template, context frequently is the chart context `$` or `.` | + +### Utils + +| Helper identifier | Description | Expected Input | +|--------------------------------|------------------------------------------------------------------------------------------|------------------------------------------------------------------------| +| `common.utils.fieldToEnvVar` | Build environment variable name given a field. | `dict "field" "my-password"` | +| `common.utils.secret.getvalue` | Print instructions to get a secret value. | `dict "secret" "secret-name" "field" "secret-value-field" "context" $` | +| `common.utils.getValueFromKey` | Gets a value from `.Values` object given its key path | `dict "key" "path.to.key" "context" $` | +| `common.utils.getKeyFromList` | Returns first `.Values` key with a defined value or first of the list if all non-defined | `dict "keys" (list "path.to.key1" "path.to.key2") "context" $` | + +### Validations + +| Helper identifier | Description | Expected Input | +|--------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.validations.values.single.empty` | Validate a value must not be empty. | `dict "valueKey" "path.to.value" "secret" "secret.name" "field" "my-password" "subchart" "subchart" "context" $` secret, field and subchart are optional. In case they are given, the helper will generate a how to get instruction. See [ValidateValue](#validatevalue) | +| `common.validations.values.multiple.empty` | Validate a multiple values must not be empty. It returns a shared error for all the values. | `dict "required" (list $validateValueConf00 $validateValueConf01) "context" $`. See [ValidateValue](#validatevalue) | +| `common.validations.values.mariadb.passwords` | This helper will ensure required password for MariaDB are not empty. It returns a shared error for all the values. | `dict "secret" "mariadb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mariadb chart and the helper. | +| `common.validations.values.mysql.passwords` | This helper will ensure required password for MySQL are not empty. It returns a shared error for all the values. | `dict "secret" "mysql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mysql chart and the helper. | +| `common.validations.values.postgresql.passwords` | This helper will ensure required password for PostgreSQL are not empty. It returns a shared error for all the values. | `dict "secret" "postgresql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use postgresql chart and the helper. | +| `common.validations.values.redis.passwords` | This helper will ensure required password for Redis® are not empty. It returns a shared error for all the values. | `dict "secret" "redis-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use redis chart and the helper. | +| `common.validations.values.cassandra.passwords` | This helper will ensure required password for Cassandra are not empty. It returns a shared error for all the values. | `dict "secret" "cassandra-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use cassandra chart and the helper. | +| `common.validations.values.mongodb.passwords` | This helper will ensure required password for MongoDB® are not empty. It returns a shared error for all the values. | `dict "secret" "mongodb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mongodb chart and the helper. | + +### Warnings + +| Helper identifier | Description | Expected Input | +|------------------------------|----------------------------------|------------------------------------------------------------| +| `common.warnings.rollingTag` | Warning about using rolling tag. | `ImageRoot` see [ImageRoot](#imageroot) for the structure. | + +## Special input schemas + +### ImageRoot + +```yaml +registry: + type: string + description: Docker registry where the image is located + example: docker.io + +repository: + type: string + description: Repository and image name + example: bitnami/nginx + +tag: + type: string + description: image tag + example: 1.16.1-debian-10-r63 + +pullPolicy: + type: string + description: Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + +pullSecrets: + type: array + items: + type: string + description: Optionally specify an array of imagePullSecrets (evaluated as templates). + +debug: + type: boolean + description: Set to true if you would like to see extra information on logs + example: false + +## An instance would be: +# registry: docker.io +# repository: bitnami/nginx +# tag: 1.16.1-debian-10-r63 +# pullPolicy: IfNotPresent +# debug: false +``` + +### Persistence + +```yaml +enabled: + type: boolean + description: Whether enable persistence. + example: true + +storageClass: + type: string + description: Ghost data Persistent Volume Storage Class, If set to "-", storageClassName: "" which disables dynamic provisioning. + example: "-" + +accessMode: + type: string + description: Access mode for the Persistent Volume Storage. + example: ReadWriteOnce + +size: + type: string + description: Size the Persistent Volume Storage. + example: 8Gi + +path: + type: string + description: Path to be persisted. + example: /bitnami + +## An instance would be: +# enabled: true +# storageClass: "-" +# accessMode: ReadWriteOnce +# size: 8Gi +# path: /bitnami +``` + +### ExistingSecret + +```yaml +name: + type: string + description: Name of the existing secret. + example: mySecret +keyMapping: + description: Mapping between the expected key name and the name of the key in the existing secret. + type: object + +## An instance would be: +# name: mySecret +# keyMapping: +# password: myPasswordKey +``` + +#### Example of use + +When we store sensitive data for a deployment in a secret, some times we want to give to users the possibility of using theirs existing secrets. + +```yaml +# templates/secret.yaml +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.names.fullname" . }} + labels: + app: {{ include "common.names.fullname" . }} +type: Opaque +data: + password: {{ .Values.password | b64enc | quote }} + +# templates/dpl.yaml +--- +... + env: + - name: PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "common.secrets.name" (dict "existingSecret" .Values.existingSecret "context" $) }} + key: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "password") }} +... + +# values.yaml +--- +name: mySecret +keyMapping: + password: myPasswordKey +``` + +### ValidateValue + +#### NOTES.txt + +```console +{{- $validateValueConf00 := (dict "valueKey" "path.to.value00" "secret" "secretName" "field" "password-00") -}} +{{- $validateValueConf01 := (dict "valueKey" "path.to.value01" "secret" "secretName" "field" "password-01") -}} + +{{ include "common.validations.values.multiple.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }} +``` + +If we force those values to be empty we will see some alerts + +```console +$ helm install test mychart --set path.to.value00="",path.to.value01="" + 'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value: + + export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 -d) + + 'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value: + + export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 -d) +``` + +## Upgrading + +### To 1.0.0 + +[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL. + +**What changes were introduced in this major version?** + +- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field. +- Use `type: library`. [Here](https://v3.helm.sh/docs/faq/#library-chart-support) you can find more information. +- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts + +**Considerations when upgrading to this version** + +- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues +- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore +- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3 + +**Useful links** + +- https://docs.bitnami.com/tutorials/resolve-helm2-helm3-post-migration-issues/ +- https://helm.sh/docs/topics/v2_v3_migration/ +- https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/ + +## License + +Copyright © 2022 Bitnami + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/_affinities.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/_affinities.tpl new file mode 100644 index 00000000..2387be26 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/_affinities.tpl @@ -0,0 +1,102 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Return a soft nodeAffinity definition +{{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes.soft" -}} +preferredDuringSchedulingIgnoredDuringExecution: + - preference: + matchExpressions: + - key: {{ .key }} + operator: In + values: + {{- range .values }} + - {{ . | quote }} + {{- end }} + weight: 1 +{{- end -}} + +{{/* +Return a hard nodeAffinity definition +{{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes.hard" -}} +requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: {{ .key }} + operator: In + values: + {{- range .values }} + - {{ . | quote }} + {{- end }} +{{- end -}} + +{{/* +Return a nodeAffinity definition +{{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes" -}} + {{- if eq .type "soft" }} + {{- include "common.affinities.nodes.soft" . -}} + {{- else if eq .type "hard" }} + {{- include "common.affinities.nodes.hard" . -}} + {{- end -}} +{{- end -}} + +{{/* +Return a soft podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods.soft" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}} +*/}} +{{- define "common.affinities.pods.soft" -}} +{{- $component := default "" .component -}} +{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} +preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 10 }} + {{- if not (empty $component) }} + {{ printf "app.kubernetes.io/component: %s" $component }} + {{- end }} + {{- range $key, $value := $extraMatchLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + namespaces: + - {{ include "common.names.namespace" .context | quote }} + topologyKey: kubernetes.io/hostname + weight: 1 +{{- end -}} + +{{/* +Return a hard podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods.hard" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}} +*/}} +{{- define "common.affinities.pods.hard" -}} +{{- $component := default "" .component -}} +{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} +requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 8 }} + {{- if not (empty $component) }} + {{ printf "app.kubernetes.io/component: %s" $component }} + {{- end }} + {{- range $key, $value := $extraMatchLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + namespaces: + - {{ include "common.names.namespace" .context | quote }} + topologyKey: kubernetes.io/hostname +{{- end -}} + +{{/* +Return a podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.pods" -}} + {{- if eq .type "soft" }} + {{- include "common.affinities.pods.soft" . -}} + {{- else if eq .type "hard" }} + {{- include "common.affinities.pods.hard" . -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/_capabilities.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/_capabilities.tpl new file mode 100644 index 00000000..9d9b7600 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/_capabilities.tpl @@ -0,0 +1,154 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Return the target Kubernetes version +*/}} +{{- define "common.capabilities.kubeVersion" -}} +{{- if .Values.global }} + {{- if .Values.global.kubeVersion }} + {{- .Values.global.kubeVersion -}} + {{- else }} + {{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} + {{- end -}} +{{- else }} +{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for poddisruptionbudget. +*/}} +{{- define "common.capabilities.policy.apiVersion" -}} +{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "policy/v1beta1" -}} +{{- else -}} +{{- print "policy/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for networkpolicy. +*/}} +{{- define "common.capabilities.networkPolicy.apiVersion" -}} +{{- if semverCompare "<1.7-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for cronjob. +*/}} +{{- define "common.capabilities.cronjob.apiVersion" -}} +{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "batch/v1beta1" -}} +{{- else -}} +{{- print "batch/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for deployment. +*/}} +{{- define "common.capabilities.deployment.apiVersion" -}} +{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for statefulset. +*/}} +{{- define "common.capabilities.statefulset.apiVersion" -}} +{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apps/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for ingress. +*/}} +{{- define "common.capabilities.ingress.apiVersion" -}} +{{- if .Values.ingress -}} +{{- if .Values.ingress.apiVersion -}} +{{- .Values.ingress.apiVersion -}} +{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end }} +{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for RBAC resources. +*/}} +{{- define "common.capabilities.rbac.apiVersion" -}} +{{- if semverCompare "<1.17-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "rbac.authorization.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "rbac.authorization.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for CRDs. +*/}} +{{- define "common.capabilities.crd.apiVersion" -}} +{{- if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apiextensions.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "apiextensions.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for APIService. +*/}} +{{- define "common.capabilities.apiService.apiVersion" -}} +{{- if semverCompare "<1.10-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apiregistration.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "apiregistration.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for Horizontal Pod Autoscaler. +*/}} +{{- define "common.capabilities.hpa.apiVersion" -}} +{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .context) -}} +{{- if .beta2 -}} +{{- print "autoscaling/v2beta2" -}} +{{- else -}} +{{- print "autoscaling/v2beta1" -}} +{{- end -}} +{{- else -}} +{{- print "autoscaling/v2" -}} +{{- end -}} +{{- end -}} + +{{/* +Returns true if the used Helm version is 3.3+. +A way to check the used Helm version was not introduced until version 3.3.0 with .Capabilities.HelmVersion, which contains an additional "{}}" structure. +This check is introduced as a regexMatch instead of {{ if .Capabilities.HelmVersion }} because checking for the key HelmVersion in <3.3 results in a "interface not found" error. +**To be removed when the catalog's minimun Helm version is 3.3** +*/}} +{{- define "common.capabilities.supportsHelmVersion" -}} +{{- if regexMatch "{(v[0-9])*[^}]*}}$" (.Capabilities | toString ) }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/_errors.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/_errors.tpl new file mode 100644 index 00000000..a79cc2e3 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/_errors.tpl @@ -0,0 +1,23 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Through error when upgrading using empty passwords values that must not be empty. + +Usage: +{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}} +{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}} +{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }} + +Required password params: + - validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error. + - context - Context - Required. Parent context. +*/}} +{{- define "common.errors.upgrade.passwords.empty" -}} + {{- $validationErrors := join "" .validationErrors -}} + {{- if and $validationErrors .context.Release.IsUpgrade -}} + {{- $errorString := "\nPASSWORDS ERROR: You must provide your current passwords when upgrading the release." -}} + {{- $errorString = print $errorString "\n Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims." -}} + {{- $errorString = print $errorString "\n Further information can be obtained at https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases" -}} + {{- $errorString = print $errorString "\n%s" -}} + {{- printf $errorString $validationErrors | fail -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/_images.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/_images.tpl new file mode 100644 index 00000000..42ffbc72 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/_images.tpl @@ -0,0 +1,75 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Return the proper image name +{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }} +*/}} +{{- define "common.images.image" -}} +{{- $registryName := .imageRoot.registry -}} +{{- $repositoryName := .imageRoot.repository -}} +{{- $tag := .imageRoot.tag | toString -}} +{{- if .global }} + {{- if .global.imageRegistry }} + {{- $registryName = .global.imageRegistry -}} + {{- end -}} +{{- end -}} +{{- if $registryName }} +{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- else -}} +{{- printf "%s:%s" $repositoryName $tag -}} +{{- end -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) +{{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }} +*/}} +{{- define "common.images.pullSecrets" -}} + {{- $pullSecrets := list }} + + {{- if .global }} + {{- range .global.imagePullSecrets -}} + {{- $pullSecrets = append $pullSecrets . -}} + {{- end -}} + {{- end -}} + + {{- range .images -}} + {{- range .pullSecrets -}} + {{- $pullSecrets = append $pullSecrets . -}} + {{- end -}} + {{- end -}} + + {{- if (not (empty $pullSecrets)) }} +imagePullSecrets: + {{- range $pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names evaluating values as templates +{{ include "common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }} +*/}} +{{- define "common.images.renderPullSecrets" -}} + {{- $pullSecrets := list }} + {{- $context := .context }} + + {{- if $context.Values.global }} + {{- range $context.Values.global.imagePullSecrets -}} + {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} + {{- end -}} + {{- end -}} + + {{- range .images -}} + {{- range .pullSecrets -}} + {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} + {{- end -}} + {{- end -}} + + {{- if (not (empty $pullSecrets)) }} +imagePullSecrets: + {{- range $pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/_ingress.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/_ingress.tpl new file mode 100644 index 00000000..8caf73a6 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/_ingress.tpl @@ -0,0 +1,68 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Generate backend entry that is compatible with all Kubernetes API versions. + +Usage: +{{ include "common.ingress.backend" (dict "serviceName" "backendName" "servicePort" "backendPort" "context" $) }} + +Params: + - serviceName - String. Name of an existing service backend + - servicePort - String/Int. Port name (or number) of the service. It will be translated to different yaml depending if it is a string or an integer. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "common.ingress.backend" -}} +{{- $apiVersion := (include "common.capabilities.ingress.apiVersion" .context) -}} +{{- if or (eq $apiVersion "extensions/v1beta1") (eq $apiVersion "networking.k8s.io/v1beta1") -}} +serviceName: {{ .serviceName }} +servicePort: {{ .servicePort }} +{{- else -}} +service: + name: {{ .serviceName }} + port: + {{- if typeIs "string" .servicePort }} + name: {{ .servicePort }} + {{- else if or (typeIs "int" .servicePort) (typeIs "float64" .servicePort) }} + number: {{ .servicePort | int }} + {{- end }} +{{- end -}} +{{- end -}} + +{{/* +Print "true" if the API pathType field is supported +Usage: +{{ include "common.ingress.supportsPathType" . }} +*/}} +{{- define "common.ingress.supportsPathType" -}} +{{- if (semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .)) -}} +{{- print "false" -}} +{{- else -}} +{{- print "true" -}} +{{- end -}} +{{- end -}} + +{{/* +Returns true if the ingressClassname field is supported +Usage: +{{ include "common.ingress.supportsIngressClassname" . }} +*/}} +{{- define "common.ingress.supportsIngressClassname" -}} +{{- if semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "false" -}} +{{- else -}} +{{- print "true" -}} +{{- end -}} +{{- end -}} + +{{/* +Return true if cert-manager required annotations for TLS signed +certificates are set in the Ingress annotations +Ref: https://cert-manager.io/docs/usage/ingress/#supported-annotations +Usage: +{{ include "common.ingress.certManagerRequest" ( dict "annotations" .Values.path.to.the.ingress.annotations ) }} +*/}} +{{- define "common.ingress.certManagerRequest" -}} +{{ if or (hasKey .annotations "cert-manager.io/cluster-issuer") (hasKey .annotations "cert-manager.io/issuer") }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/_labels.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/_labels.tpl new file mode 100644 index 00000000..252066c7 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/_labels.tpl @@ -0,0 +1,18 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Kubernetes standard labels +*/}} +{{- define "common.labels.standard" -}} +app.kubernetes.io/name: {{ include "common.names.name" . }} +helm.sh/chart: {{ include "common.names.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector +*/}} +{{- define "common.labels.matchLabels" -}} +app.kubernetes.io/name: {{ include "common.names.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/_names.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/_names.tpl new file mode 100644 index 00000000..1bdac8b7 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/_names.tpl @@ -0,0 +1,70 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "common.names.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "common.names.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "common.names.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create a default fully qualified dependency name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +Usage: +{{ include "common.names.dependency.fullname" (dict "chartName" "dependency-chart-name" "chartValues" .Values.dependency-chart "context" $) }} +*/}} +{{- define "common.names.dependency.fullname" -}} +{{- if .chartValues.fullnameOverride -}} +{{- .chartValues.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .chartName .chartValues.nameOverride -}} +{{- if contains $name .context.Release.Name -}} +{{- .context.Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .context.Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Allow the release namespace to be overridden for multi-namespace deployments in combined charts. +*/}} +{{- define "common.names.namespace" -}} +{{- if .Values.namespaceOverride -}} +{{- .Values.namespaceOverride -}} +{{- else -}} +{{- .Release.Namespace -}} +{{- end -}} +{{- end -}} + +{{/* +Create a fully qualified app name adding the installation's namespace. +*/}} +{{- define "common.names.fullname.namespace" -}} +{{- printf "%s-%s" (include "common.names.fullname" .) (include "common.names.namespace" .) | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/_secrets.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/_secrets.tpl new file mode 100644 index 00000000..a53fb44f --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/_secrets.tpl @@ -0,0 +1,140 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Generate secret name. + +Usage: +{{ include "common.secrets.name" (dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $) }} + +Params: + - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user + to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility. + +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret + - defaultNameSuffix - String - Optional. It is used only if we have several secrets in the same deployment. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "common.secrets.name" -}} +{{- $name := (include "common.names.fullname" .context) -}} + +{{- if .defaultNameSuffix -}} +{{- $name = printf "%s-%s" $name .defaultNameSuffix | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- with .existingSecret -}} +{{- if not (typeIs "string" .) -}} +{{- with .name -}} +{{- $name = . -}} +{{- end -}} +{{- else -}} +{{- $name = . -}} +{{- end -}} +{{- end -}} + +{{- printf "%s" $name -}} +{{- end -}} + +{{/* +Generate secret key. + +Usage: +{{ include "common.secrets.key" (dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName") }} + +Params: + - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user + to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility. + +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret + - key - String - Required. Name of the key in the secret. +*/}} +{{- define "common.secrets.key" -}} +{{- $key := .key -}} + +{{- if .existingSecret -}} + {{- if not (typeIs "string" .existingSecret) -}} + {{- if .existingSecret.keyMapping -}} + {{- $key = index .existingSecret.keyMapping $.key -}} + {{- end -}} + {{- end }} +{{- end -}} + +{{- printf "%s" $key -}} +{{- end -}} + +{{/* +Generate secret password or retrieve one if already created. + +Usage: +{{ include "common.secrets.passwords.manage" (dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $) }} + +Params: + - secret - String - Required - Name of the 'Secret' resource where the password is stored. + - key - String - Required - Name of the key in the secret. + - providedValues - List - Required - The path to the validating value in the values.yaml, e.g: "mysql.password". Will pick first parameter with a defined value. + - length - int - Optional - Length of the generated random password. + - strong - Boolean - Optional - Whether to add symbols to the generated random password. + - chartName - String - Optional - Name of the chart used when said chart is deployed as a subchart. + - context - Context - Required - Parent context. + +The order in which this function returns a secret password: + 1. Already existing 'Secret' resource + (If a 'Secret' resource is found under the name provided to the 'secret' parameter to this function and that 'Secret' resource contains a key with the name passed as the 'key' parameter to this function then the value of this existing secret password will be returned) + 2. Password provided via the values.yaml + (If one of the keys passed to the 'providedValues' parameter to this function is a valid path to a key in the values.yaml and has a value, the value of the first key with a value will be returned) + 3. Randomly generated secret password + (A new random secret password with the length specified in the 'length' parameter will be generated and returned) + +*/}} +{{- define "common.secrets.passwords.manage" -}} + +{{- $password := "" }} +{{- $subchart := "" }} +{{- $chartName := default "" .chartName }} +{{- $passwordLength := default 10 .length }} +{{- $providedPasswordKey := include "common.utils.getKeyFromList" (dict "keys" .providedValues "context" $.context) }} +{{- $providedPasswordValue := include "common.utils.getValueFromKey" (dict "key" $providedPasswordKey "context" $.context) }} +{{- $secretData := (lookup "v1" "Secret" $.context.Release.Namespace .secret).data }} +{{- if $secretData }} + {{- if hasKey $secretData .key }} + {{- $password = index $secretData .key }} + {{- else }} + {{- printf "\nPASSWORDS ERROR: The secret \"%s\" does not contain the key \"%s\"\n" .secret .key | fail -}} + {{- end -}} +{{- else if $providedPasswordValue }} + {{- $password = $providedPasswordValue | toString | b64enc | quote }} +{{- else }} + + {{- if .context.Values.enabled }} + {{- $subchart = $chartName }} + {{- end -}} + + {{- $requiredPassword := dict "valueKey" $providedPasswordKey "secret" .secret "field" .key "subchart" $subchart "context" $.context -}} + {{- $requiredPasswordError := include "common.validations.values.single.empty" $requiredPassword -}} + {{- $passwordValidationErrors := list $requiredPasswordError -}} + {{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordValidationErrors "context" $.context) -}} + + {{- if .strong }} + {{- $subStr := list (lower (randAlpha 1)) (randNumeric 1) (upper (randAlpha 1)) | join "_" }} + {{- $password = randAscii $passwordLength }} + {{- $password = regexReplaceAllLiteral "\\W" $password "@" | substr 5 $passwordLength }} + {{- $password = printf "%s%s" $subStr $password | toString | shuffle | b64enc | quote }} + {{- else }} + {{- $password = randAlphaNum $passwordLength | b64enc | quote }} + {{- end }} +{{- end -}} +{{- printf "%s" $password -}} +{{- end -}} + +{{/* +Returns whether a previous generated secret already exists + +Usage: +{{ include "common.secrets.exists" (dict "secret" "secret-name" "context" $) }} + +Params: + - secret - String - Required - Name of the 'Secret' resource where the password is stored. + - context - Context - Required - Parent context. +*/}} +{{- define "common.secrets.exists" -}} +{{- $secret := (lookup "v1" "Secret" $.context.Release.Namespace .secret) }} +{{- if $secret }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/_storage.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/_storage.tpl new file mode 100644 index 00000000..60e2a844 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/_storage.tpl @@ -0,0 +1,23 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Return the proper Storage Class +{{ include "common.storage.class" ( dict "persistence" .Values.path.to.the.persistence "global" $) }} +*/}} +{{- define "common.storage.class" -}} + +{{- $storageClass := .persistence.storageClass -}} +{{- if .global -}} + {{- if .global.storageClass -}} + {{- $storageClass = .global.storageClass -}} + {{- end -}} +{{- end -}} + +{{- if $storageClass -}} + {{- if (eq "-" $storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" $storageClass -}} + {{- end -}} +{{- end -}} + +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/_tplvalues.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/_tplvalues.tpl new file mode 100644 index 00000000..2db16685 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/_tplvalues.tpl @@ -0,0 +1,13 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Renders a value that contains template. +Usage: +{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }} +*/}} +{{- define "common.tplvalues.render" -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{- else }} + {{- tpl (.value | toYaml) .context }} + {{- end }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/_utils.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/_utils.tpl new file mode 100644 index 00000000..8c22b2a3 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/_utils.tpl @@ -0,0 +1,62 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Print instructions to get a secret value. +Usage: +{{ include "common.utils.secret.getvalue" (dict "secret" "secret-name" "field" "secret-value-field" "context" $) }} +*/}} +{{- define "common.utils.secret.getvalue" -}} +{{- $varname := include "common.utils.fieldToEnvVar" . -}} +export {{ $varname }}=$(kubectl get secret --namespace {{ .context.Release.Namespace | quote }} {{ .secret }} -o jsonpath="{.data.{{ .field }}}" | base64 -d) +{{- end -}} + +{{/* +Build env var name given a field +Usage: +{{ include "common.utils.fieldToEnvVar" dict "field" "my-password" }} +*/}} +{{- define "common.utils.fieldToEnvVar" -}} + {{- $fieldNameSplit := splitList "-" .field -}} + {{- $upperCaseFieldNameSplit := list -}} + + {{- range $fieldNameSplit -}} + {{- $upperCaseFieldNameSplit = append $upperCaseFieldNameSplit ( upper . ) -}} + {{- end -}} + + {{ join "_" $upperCaseFieldNameSplit }} +{{- end -}} + +{{/* +Gets a value from .Values given +Usage: +{{ include "common.utils.getValueFromKey" (dict "key" "path.to.key" "context" $) }} +*/}} +{{- define "common.utils.getValueFromKey" -}} +{{- $splitKey := splitList "." .key -}} +{{- $value := "" -}} +{{- $latestObj := $.context.Values -}} +{{- range $splitKey -}} + {{- if not $latestObj -}} + {{- printf "please review the entire path of '%s' exists in values" $.key | fail -}} + {{- end -}} + {{- $value = ( index $latestObj . ) -}} + {{- $latestObj = $value -}} +{{- end -}} +{{- printf "%v" (default "" $value) -}} +{{- end -}} + +{{/* +Returns first .Values key with a defined value or first of the list if all non-defined +Usage: +{{ include "common.utils.getKeyFromList" (dict "keys" (list "path.to.key1" "path.to.key2") "context" $) }} +*/}} +{{- define "common.utils.getKeyFromList" -}} +{{- $key := first .keys -}} +{{- $reverseKeys := reverse .keys }} +{{- range $reverseKeys }} + {{- $value := include "common.utils.getValueFromKey" (dict "key" . "context" $.context ) }} + {{- if $value -}} + {{- $key = . }} + {{- end -}} +{{- end -}} +{{- printf "%s" $key -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/_warnings.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/_warnings.tpl new file mode 100644 index 00000000..ae10fa41 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/_warnings.tpl @@ -0,0 +1,14 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Warning about using rolling tag. +Usage: +{{ include "common.warnings.rollingTag" .Values.path.to.the.imageRoot }} +*/}} +{{- define "common.warnings.rollingTag" -}} + +{{- if and (contains "bitnami/" .repository) (not (.tag | toString | regexFind "-r\\d+$|sha256:")) }} +WARNING: Rolling tag detected ({{ .repository }}:{{ .tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment. ++info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/ +{{- end }} + +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_cassandra.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_cassandra.tpl new file mode 100644 index 00000000..ded1ae3b --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_cassandra.tpl @@ -0,0 +1,72 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate Cassandra required passwords are not empty. + +Usage: +{{ include "common.validations.values.cassandra.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where Cassandra values are stored, e.g: "cassandra-passwords-secret" + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.cassandra.passwords" -}} + {{- $existingSecret := include "common.cassandra.values.existingSecret" . -}} + {{- $enabled := include "common.cassandra.values.enabled" . -}} + {{- $dbUserPrefix := include "common.cassandra.values.key.dbUser" . -}} + {{- $valueKeyPassword := printf "%s.password" $dbUserPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "cassandra-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.cassandra.values.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.cassandra.values.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.cassandra.dbUser.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.dbUser.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled cassandra. + +Usage: +{{ include "common.cassandra.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.cassandra.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.cassandra.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key dbUser + +Usage: +{{ include "common.cassandra.values.key.dbUser" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.cassandra.values.key.dbUser" -}} + {{- if .subchart -}} + cassandra.dbUser + {{- else -}} + dbUser + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_mariadb.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_mariadb.tpl new file mode 100644 index 00000000..b6906ff7 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_mariadb.tpl @@ -0,0 +1,103 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MariaDB required passwords are not empty. + +Usage: +{{ include "common.validations.values.mariadb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MariaDB values are stored, e.g: "mysql-passwords-secret" + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mariadb.passwords" -}} + {{- $existingSecret := include "common.mariadb.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mariadb.values.enabled" . -}} + {{- $architecture := include "common.mariadb.values.architecture" . -}} + {{- $authPrefix := include "common.mariadb.values.key.auth" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mariadb-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- if not (empty $valueUsername) -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mariadb-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replication") -}} + {{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mariadb-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mariadb.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mariadb.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mariadb. + +Usage: +{{ include "common.mariadb.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mariadb.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mariadb.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mariadb.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mariadb.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mariadb.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.key.auth" -}} + {{- if .subchart -}} + mariadb.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_mongodb.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_mongodb.tpl new file mode 100644 index 00000000..f820ec10 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_mongodb.tpl @@ -0,0 +1,108 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MongoDB® required passwords are not empty. + +Usage: +{{ include "common.validations.values.mongodb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MongoDB® values are stored, e.g: "mongodb-passwords-secret" + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mongodb.passwords" -}} + {{- $existingSecret := include "common.mongodb.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mongodb.values.enabled" . -}} + {{- $authPrefix := include "common.mongodb.values.key.auth" . -}} + {{- $architecture := include "common.mongodb.values.architecture" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyDatabase := printf "%s.database" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicaSetKey := printf "%s.replicaSetKey" $authPrefix -}} + {{- $valueKeyAuthEnabled := printf "%s.enabled" $authPrefix -}} + + {{- $authEnabled := include "common.utils.getValueFromKey" (dict "key" $valueKeyAuthEnabled "context" .context) -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") (eq $authEnabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mongodb-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- $valueDatabase := include "common.utils.getValueFromKey" (dict "key" $valueKeyDatabase "context" .context) }} + {{- if and $valueUsername $valueDatabase -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mongodb-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replicaset") -}} + {{- $requiredReplicaSetKey := dict "valueKey" $valueKeyReplicaSetKey "secret" .secret "field" "mongodb-replica-set-key" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicaSetKey -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mongodb.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDb is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mongodb.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mongodb. + +Usage: +{{ include "common.mongodb.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mongodb.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mongodb.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mongodb.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.key.auth" -}} + {{- if .subchart -}} + mongodb.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mongodb.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mongodb.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_mysql.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_mysql.tpl new file mode 100644 index 00000000..74472a06 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_mysql.tpl @@ -0,0 +1,103 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MySQL required passwords are not empty. + +Usage: +{{ include "common.validations.values.mysql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MySQL values are stored, e.g: "mysql-passwords-secret" + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mysql.passwords" -}} + {{- $existingSecret := include "common.mysql.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mysql.values.enabled" . -}} + {{- $architecture := include "common.mysql.values.architecture" . -}} + {{- $authPrefix := include "common.mysql.values.key.auth" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mysql-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- if not (empty $valueUsername) -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mysql-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replication") -}} + {{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mysql-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mysql.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mysql.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mysql. + +Usage: +{{ include "common.mysql.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mysql.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mysql.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mysql.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mysql.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mysql.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.key.auth" -}} + {{- if .subchart -}} + mysql.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_postgresql.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_postgresql.tpl new file mode 100644 index 00000000..164ec0d0 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_postgresql.tpl @@ -0,0 +1,129 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate PostgreSQL required passwords are not empty. + +Usage: +{{ include "common.validations.values.postgresql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where postgresql values are stored, e.g: "postgresql-passwords-secret" + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.postgresql.passwords" -}} + {{- $existingSecret := include "common.postgresql.values.existingSecret" . -}} + {{- $enabled := include "common.postgresql.values.enabled" . -}} + {{- $valueKeyPostgresqlPassword := include "common.postgresql.values.key.postgressPassword" . -}} + {{- $valueKeyPostgresqlReplicationEnabled := include "common.postgresql.values.key.replicationPassword" . -}} + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + {{- $requiredPostgresqlPassword := dict "valueKey" $valueKeyPostgresqlPassword "secret" .secret "field" "postgresql-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlPassword -}} + + {{- $enabledReplication := include "common.postgresql.values.enabled.replication" . -}} + {{- if (eq $enabledReplication "true") -}} + {{- $requiredPostgresqlReplicationPassword := dict "valueKey" $valueKeyPostgresqlReplicationEnabled "secret" .secret "field" "postgresql-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to decide whether evaluate global values. + +Usage: +{{ include "common.postgresql.values.use.global" (dict "key" "key-of-global" "context" $) }} +Params: + - key - String - Required. Field to be evaluated within global, e.g: "existingSecret" +*/}} +{{- define "common.postgresql.values.use.global" -}} + {{- if .context.Values.global -}} + {{- if .context.Values.global.postgresql -}} + {{- index .context.Values.global.postgresql .key | quote -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.postgresql.values.existingSecret" (dict "context" $) }} +*/}} +{{- define "common.postgresql.values.existingSecret" -}} + {{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "existingSecret" "context" .context) -}} + + {{- if .subchart -}} + {{- default (.context.Values.postgresql.existingSecret | quote) $globalValue -}} + {{- else -}} + {{- default (.context.Values.existingSecret | quote) $globalValue -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled postgresql. + +Usage: +{{ include "common.postgresql.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.postgresql.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.postgresql.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key postgressPassword. + +Usage: +{{ include "common.postgresql.values.key.postgressPassword" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.key.postgressPassword" -}} + {{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "postgresqlUsername" "context" .context) -}} + + {{- if not $globalValue -}} + {{- if .subchart -}} + postgresql.postgresqlPassword + {{- else -}} + postgresqlPassword + {{- end -}} + {{- else -}} + global.postgresql.postgresqlPassword + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled.replication. + +Usage: +{{ include "common.postgresql.values.enabled.replication" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.enabled.replication" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.postgresql.replication.enabled -}} + {{- else -}} + {{- printf "%v" .context.Values.replication.enabled -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key replication.password. + +Usage: +{{ include "common.postgresql.values.key.replicationPassword" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.key.replicationPassword" -}} + {{- if .subchart -}} + postgresql.replication.password + {{- else -}} + replication.password + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_redis.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_redis.tpl new file mode 100644 index 00000000..dcccfc1a --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_redis.tpl @@ -0,0 +1,76 @@ + +{{/* vim: set filetype=mustache: */}} +{{/* +Validate Redis® required passwords are not empty. + +Usage: +{{ include "common.validations.values.redis.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where redis values are stored, e.g: "redis-passwords-secret" + - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.redis.passwords" -}} + {{- $enabled := include "common.redis.values.enabled" . -}} + {{- $valueKeyPrefix := include "common.redis.values.keys.prefix" . -}} + {{- $standarizedVersion := include "common.redis.values.standarized.version" . }} + + {{- $existingSecret := ternary (printf "%s%s" $valueKeyPrefix "auth.existingSecret") (printf "%s%s" $valueKeyPrefix "existingSecret") (eq $standarizedVersion "true") }} + {{- $existingSecretValue := include "common.utils.getValueFromKey" (dict "key" $existingSecret "context" .context) }} + + {{- $valueKeyRedisPassword := ternary (printf "%s%s" $valueKeyPrefix "auth.password") (printf "%s%s" $valueKeyPrefix "password") (eq $standarizedVersion "true") }} + {{- $valueKeyRedisUseAuth := ternary (printf "%s%s" $valueKeyPrefix "auth.enabled") (printf "%s%s" $valueKeyPrefix "usePassword") (eq $standarizedVersion "true") }} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $useAuth := include "common.utils.getValueFromKey" (dict "key" $valueKeyRedisUseAuth "context" .context) -}} + {{- if eq $useAuth "true" -}} + {{- $requiredRedisPassword := dict "valueKey" $valueKeyRedisPassword "secret" .secret "field" "redis-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRedisPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled redis. + +Usage: +{{ include "common.redis.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.redis.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.redis.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right prefix path for the values + +Usage: +{{ include "common.redis.values.key.prefix" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false +*/}} +{{- define "common.redis.values.keys.prefix" -}} + {{- if .subchart -}}redis.{{- else -}}{{- end -}} +{{- end -}} + +{{/* +Checks whether the redis chart's includes the standarizations (version >= 14) + +Usage: +{{ include "common.redis.values.standarized.version" (dict "context" $) }} +*/}} +{{- define "common.redis.values.standarized.version" -}} + + {{- $standarizedAuth := printf "%s%s" (include "common.redis.values.keys.prefix" .) "auth" -}} + {{- $standarizedAuthValues := include "common.utils.getValueFromKey" (dict "key" $standarizedAuth "context" .context) }} + + {{- if $standarizedAuthValues -}} + {{- true -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_validations.tpl b/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_validations.tpl new file mode 100644 index 00000000..9a814cf4 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/templates/validations/_validations.tpl @@ -0,0 +1,46 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate values must not be empty. + +Usage: +{{- $validateValueConf00 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-00") -}} +{{- $validateValueConf01 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-01") -}} +{{ include "common.validations.values.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }} + +Validate value params: + - valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password" + - secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret" + - field - String - Optional. Name of the field in the secret data, e.g: "mysql-password" +*/}} +{{- define "common.validations.values.multiple.empty" -}} + {{- range .required -}} + {{- include "common.validations.values.single.empty" (dict "valueKey" .valueKey "secret" .secret "field" .field "context" $.context) -}} + {{- end -}} +{{- end -}} + +{{/* +Validate a value must not be empty. + +Usage: +{{ include "common.validations.value.empty" (dict "valueKey" "mariadb.password" "secret" "secretName" "field" "my-password" "subchart" "subchart" "context" $) }} + +Validate value params: + - valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password" + - secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret" + - field - String - Optional. Name of the field in the secret data, e.g: "mysql-password" + - subchart - String - Optional - Name of the subchart that the validated password is part of. +*/}} +{{- define "common.validations.values.single.empty" -}} + {{- $value := include "common.utils.getValueFromKey" (dict "key" .valueKey "context" .context) }} + {{- $subchart := ternary "" (printf "%s." .subchart) (empty .subchart) }} + + {{- if not $value -}} + {{- $varname := "my-value" -}} + {{- $getCurrentValue := "" -}} + {{- if and .secret .field -}} + {{- $varname = include "common.utils.fieldToEnvVar" . -}} + {{- $getCurrentValue = printf " To get the current value:\n\n %s\n" (include "common.utils.secret.getvalue" .) -}} + {{- end -}} + {{- printf "\n '%s' must not be empty, please add '--set %s%s=$%s' to the command.%s" .valueKey $subchart .valueKey $varname $getCurrentValue -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/cron/charts/common/values.yaml b/helm/airbyte-v1/charts/cron/charts/common/values.yaml new file mode 100644 index 00000000..f2df68e5 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/charts/common/values.yaml @@ -0,0 +1,5 @@ +## bitnami/common +## It is required by CI/CD tools and processes. +## @skip exampleValue +## +exampleValue: common-chart diff --git a/helm/airbyte-v1/charts/cron/templates/_helpers.tpl b/helm/airbyte-v1/charts/cron/templates/_helpers.tpl new file mode 100644 index 00000000..174aebfe --- /dev/null +++ b/helm/airbyte-v1/charts/cron/templates/_helpers.tpl @@ -0,0 +1,59 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "airbyte.labels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "airbyte.selectorLabels" -}} +app.kubernetes.io/name: {{ include "airbyte.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Define db secret +*/}} + +{{- define "database.secret.name" -}} +{{- printf "%s-postgresql" .Release.Name }} +{{- end }} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/cron/templates/_images.tpl b/helm/airbyte-v1/charts/cron/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/cron/templates/cron-secrets.yaml b/helm/airbyte-v1/charts/cron/templates/cron-secrets.yaml new file mode 100644 index 00000000..1d22b17e --- /dev/null +++ b/helm/airbyte-v1/charts/cron/templates/cron-secrets.yaml @@ -0,0 +1,18 @@ +# Create secrets only for the local deployment +{{- if .Values.secrets }} +apiVersion: v1 +kind: Secret +metadata: + name: cron-secrets + labels: + {{- include "airbyte.labels" . | nindent 4 }} + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-1" + +type: Opaque +data: + {{- range $k, $v := mergeOverwrite .Values.secrets .Values.global.secrets }} + {{ $k }}: {{ if $v }}{{ $v | b64enc }} {{else}}""{{end}} + {{- end }} + {{- end }} diff --git a/helm/airbyte-v1/charts/cron/templates/deployment.yaml b/helm/airbyte-v1/charts/cron/templates/deployment.yaml new file mode 100644 index 00000000..f64fb6a6 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/templates/deployment.yaml @@ -0,0 +1,187 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "common.names.fullname" . }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} + {{- if .Values.extraLabels }} + {{ toYaml (mergeOverwrite .Values.extraLabels .Values.global.extraLabels) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "airbyte.selectorLabels" . | nindent 6 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 6 }} + {{- end }} + template: + metadata: + labels: + {{- include "airbyte.selectorLabels" . | nindent 8 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 8 }} + {{- end }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.podAnnotations }} + annotations: + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ .Values.global.serviceAccountName }} + automountServiceAccountToken: true + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.extraInitContainers }} + initContainers: + {{- toYaml .Values.extraInitContainers | nindent 6 }} + {{- end }} + containers: + - name: airbyte-cron + image: {{ include "imageUrl" (list .Values.image $) }} + imagePullPolicy: "{{ .Values.image.pullPolicy }}" + env: + {{- if eq .Values.global.deploymentMode "oss" }} + - name: AIRBYTE_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: AIRBYTE_VERSION + - name: CONFIGS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: CONFIGS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + - name: MICROMETER_METRICS_ENABLED + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MICROMETER_METRICS_ENABLED + - name: MICROMETER_METRICS_STATSD_FLAVOR + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MICROMETER_METRICS_STATSD_FLAVOR + - name: MICRONAUT_ENVIRONMENTS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: CRON_MICRONAUT_ENVIRONMENTS + - name: TEMPORAL_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TEMPORAL_HOST + - name: SEGMENT_WRITE_KEY + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: SEGMENT_WRITE_KEY + - name: STATSD_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STATSD_HOST + - name: STATSD_PORT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STATSD_PORT + - name: TRACKING_STRATEGY + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TRACKING_STRATEGY + - name: WORKFLOW_FAILURE_RESTART_DELAY_SECONDS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WORKFLOW_FAILURE_RESTART_DELAY_SECONDS + - name: WORKLOAD_API_BEARER_TOKEN + valueFrom: + secretKeyRef: + name: {{ index .Values "workloadApi" "bearerTokenSecretName" | default (printf "%s-airbyte-secrets" .Release.Name ) }} + key: {{ index .Values "workloadApi" "bearerTokenSecretKey" | default "WORKLOAD_API_BEARER_TOKEN" }} + - name: WORKLOAD_API_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WORKLOAD_API_HOST + - name: WORKSPACE_DOCKER_MOUNT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WORKSPACE_DOCKER_MOUNT + - name: WORKSPACE_ROOT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WORKSPACE_ROOT + + # Database + {{- include "airbyte.database.envs" . | nindent 10 }} + + {{- end }} + + + # Values from secret + {{- if .Values.secrets }} + {{- range $k, $v := .Values.secrets }} + - name: {{ $k }} + valueFrom: + secretKeyRef: + name: cron-secrets + key: {{ $k }} + {{- end }} + {{- end }} + + # Values from env + {{- if or .Values.env_vars .Values.global.env_vars }} + {{- range $k, $v := mergeOverwrite .Values.env_vars .Values.global.env_vars }} + - name: {{ $k }} + value: {{ $v | quote }} + {{- end }} + {{- end }} + + # Values from extraEnv for more compability(if you want to use external secret source or other stuff) + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 10 }} + {{- end }} + + {{- if .Values.containerSecurityContext }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 12 }} + {{- end }} + + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + + {{- if .Values.extraVolumeMounts }} + volumeMounts: {{ toYaml .Values.extraVolumeMounts | nindent 10 }} + {{- end }} + + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 8 }} + {{- end }} + {{- if .Values.global.extraContainers }} + {{ toYaml .Values.global.extraContainers | nindent 8 }} + {{- end }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 10 }} + {{- if .Values.extraVolumes }} + volumes: {{ toYaml .Values.extraVolumes | nindent 6 }} + {{- end }} diff --git a/helm/airbyte-v1/charts/cron/values.yaml b/helm/airbyte-v1/charts/cron/values.yaml new file mode 100644 index 00000000..1bbace43 --- /dev/null +++ b/helm/airbyte-v1/charts/cron/values.yaml @@ -0,0 +1,233 @@ +global: + serviceAccountName: placeholderServiceAccount + deploymentMode: oss + configMapName: "" + secretName: "" + extraContainers: [] + ## extraSelectorLabels [object] - use to specify own additional selector labels for deployment + extraSelectorLabels: {} + ## extraLabels [object] - use to specify own additional labels for deployment + extraLabels: {} + database: + secretName: "" + secretValue: "" + secrets: {} + + # Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "" + +enabled: true +## cron.replicaCount Number of cron replicas +replicaCount: 1 + +## cron.image.repository The repository to use for the airbyte cron image. +## cron.image.pullPolicy the pull policy to use for the airbyte cron image +## cron.image.tag The airbyte cron image tag. Defaults to the chart's AppVersion +image: + repository: airbyte/cron + pullPolicy: IfNotPresent + +## cron.podAnnotations [object] Add extra annotations to the cron pod(s) +## +podAnnotations: {} + +## cron.podLabels [object] Add extra labels to the cron pod(s) +## +podLabels: {} + +## cron.containerSecurityContext Security context for the container +## Examples: +## containerSecurityContext: +## runAsNonRoot: true +## runAsUser: 1000 +## readOnlyRootFilesystem: true +containerSecurityContext: {} + +## Configure extra options for the cron containers' liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## cron.livenessProbe.enabled Enable livenessProbe on the cron +## cron.livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe +## cron.livenessProbe.periodSeconds Period seconds for livenessProbe +## cron.livenessProbe.timeoutSeconds Timeout seconds for livenessProbe +## cron.livenessProbe.failureThreshold Failure threshold for livenessProbe +## cron.livenessProbe.successThreshold Success threshold for livenessProbe +## +livenessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## cron.readinessProbe.enabled Enable readinessProbe on the cron +## cron.readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe +## cron.readinessProbe.periodSeconds Period seconds for readinessProbe +## cron.readinessProbe.timeoutSeconds Timeout seconds for readinessProbe +## cron.readinessProbe.failureThreshold Failure threshold for readinessProbe +## cron.readinessProbe.successThreshold Success threshold for readinessProbe +## +readinessProbe: + enabled: true + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + + ## server.containerSecurityContext Security context for the container + ## Examples: + ## containerSecurityContext: + ## runAsNonRoot: true + ## runAsUser: 1000 + ## readOnlyRootFilesystem: true + containerSecurityContext: {} + +## Web app resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## We usually recommend not to specify default resources and to leave this as a conscious +## choice for the user. This also increases chances charts run on environments with little +## resources, such as Minikube. If you do want to specify resources, uncomment the following +## lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## cron.resources.limits [object] The resources limits for the Web container +## cron.resources.requests [object] The requested resources for the Web container +resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + +## cron.nodeSelector [object] Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## cron.tolerations [array] Tolerations for cron pod assignment. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## cron.affinity [object] Affinity and anti-affinity for cron pod assignment. +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## cron.extraVolumeMounts [array] Additional volumeMounts for cron container(s). +## Examples (when using `cron.containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumeMounts: +## - name: var-run +## mountPath: /var/run/ +## - name: var-cache-nginx +## mountPath: /var/cache/nginx +## - mountPath: /etc/nginx/conf.d +## name: nginx-conf-d +## +extraVolumeMounts: [] + +## cron.extraVolumes [array] Additional volumes for cron pod(s). +## Examples (when using `cron.containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumes: +## - name: var-run +## emptyDir: {} +## - name: var-cache-nginx +## emptyDir: {} +## - name: nginx-conf-d +## emptyDir: {} +## +extraVolumes: [] + +## extraContainer [array] Additional container for server pod(s) +## Example: +# extraContainers: +# - name: otel_collector +# image: somerepo/someimage:sometag +# args: [ +# "--important-args" +# ] +# ports: +# - containerPort: 443 +# volumeMounts: +# - name: volumeMountCool +# mountPath: /some/path +# readOnly: true +extraContainers: [] + +## extraInitContainers [array] Additional init containers for server pod(s) +## Example: +# extraInitContainers: +# - name: sleepy +# image: alpine +# command: ['sleep', '60'] + +extraInitContainers: [] + +## extraEnv [array] Supply extra env variables to main container using full notation +## Example: (With default env vars and values taken from generated config map) +# extraEnv: +# - name: POSTGRES_USER +# valueFrom: +# secretKeyRef: +# name: airbyte-secrets +# key: DATABASE_USER +# - name: POSTGRES_PWD +# valueFrom: +# secretKeyRef: +# name: airbyte-secrets +# key: DATABASE_PASSWORD +# - name: DYNAMIC_CONFIG_FILE_PATH +# value: "config/dynamicconfig/development.yaml" +# - name: DB +# value: "postgresql" +# - name: DB_PORT +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: DATABASE_PORT +# - name: POSTGRES_SEEDS +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: DATABASE_HOST +## +extraEnv: [] +## secrets [object] Supply additional secrets to container +## Example: +## secrets: +## DATABASE_PASSWORD: strong-password +## DATABASE_USER: my-db-user +secrets: {} + +## env_vars [object] Supply extra env variables to main container using simplified notation +## Example with default vars for cron: +# env_vars: +# AIRBYTE_VERSION: 0.40.4 + +# # Miscellaneous +# TRACKING_STRATEGY: segment +# API_URL: /api/v1/ +# INTERNAL_API_HOST: http://airbyte-server-svc:8001 + +env_vars: {} + + +## workloadApi: +## bearerTokenSecretName: workload-api-bearer-token-name kubernetes secret name where bearer token is stored +## bearerTokenSecretKey: workload-api-bearer-token-key kubernetes secret key where bearer token is stored +workloadApi: {} + + +## extraSelectorLabels [object] - use to specify own additional selector labels for deployment +extraSelectorLabels: {} +## extraLabels [object] - use to specify own additional labels for deployment +extraLabels: {} diff --git a/helm/airbyte-v1/charts/keycloak-setup/.gitignore b/helm/airbyte-v1/charts/keycloak-setup/.gitignore new file mode 100644 index 00000000..88e91e8a --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak-setup/.gitignore @@ -0,0 +1,2 @@ +# Charts are downloaded at install time with `helm dep build`. +charts diff --git a/helm/airbyte-v1/charts/keycloak-setup/Chart.lock b/helm/airbyte-v1/charts/keycloak-setup/Chart.lock new file mode 100644 index 00000000..991eab27 --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak-setup/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2024-12-09T21:57:21.272173303Z" diff --git a/helm/airbyte-v1/charts/keycloak-setup/Chart.yaml b/helm/airbyte-v1/charts/keycloak-setup/Chart.yaml new file mode 100644 index 00000000..cab564c4 --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak-setup/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: Helm chart to deploy airbyte-keycloak-setup +name: keycloak-setup +type: application +version: 1.3.0 diff --git a/helm/airbyte-v1/charts/keycloak-setup/README.md b/helm/airbyte-v1/charts/keycloak-setup/README.md new file mode 100644 index 00000000..724dc7c8 --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak-setup/README.md @@ -0,0 +1,48 @@ +# keycloak-setup + +![Version: 0.67.17](https://img.shields.io/badge/Version-0.67.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: dev](https://img.shields.io/badge/AppVersion-dev-informational?style=flat-square) + +Helm chart to deploy airbyte-keycloak-setup + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 1.x.x | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| containerSecurityContext | object | `{}` | | +| enabled | bool | `true` | | +| env_vars | object | `{}` | | +| extraContainers | list | `[]` | | +| extraEnv | list | `[]` | | +| extraInitContainers | list | `[]` | | +| extraLabels | object | `{}` | | +| extraSelectorLabels | object | `{}` | | +| extraVolumeMounts | list | `[]` | | +| extraVolumes | list | `[]` | | +| global.database.secretName | string | `""` | | +| global.database.secretValue | string | `""` | | +| global.deploymentMode | string | `"oss"` | | +| global.edition | string | `"community"` | | +| global.env_vars | object | `{}` | | +| global.extraContainers | list | `[]` | | +| global.extraLabels | object | `{}` | | +| global.extraSelectorLabels | object | `{}` | | +| global.secretName | string | `""` | | +| global.secrets | object | `{}` | | +| global.serviceAccountName | string | `"placeholderServiceAccount"` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"airbyte/keycloak-setup"` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| resources.limits | object | `{}` | | +| resources.requests | object | `{}` | | +| secrets | object | `{}` | | +| tolerations | list | `[]` | | + diff --git a/helm/airbyte-v1/charts/keycloak-setup/templates/_helpers.tpl b/helm/airbyte-v1/charts/keycloak-setup/templates/_helpers.tpl new file mode 100644 index 00000000..7be7bc1a --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak-setup/templates/_helpers.tpl @@ -0,0 +1,51 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "airbyte.labels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "airbyte.selectorLabels" -}} +app.kubernetes.io/name: {{ include "airbyte.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/keycloak-setup/templates/_images.tpl b/helm/airbyte-v1/charts/keycloak-setup/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak-setup/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/keycloak-setup/templates/job.yaml b/helm/airbyte-v1/charts/keycloak-setup/templates/job.yaml new file mode 100644 index 00000000..41e534df --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak-setup/templates/job.yaml @@ -0,0 +1,143 @@ +{{- if or (eq .Values.global.edition "pro") (eq .Values.global.edition "enterprise") }} +{{- if eq .Values.global.deploymentMode "oss" }} +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ include "common.names.fullname" . }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} + {{- if .Values.extraLabels }} + {{ toYaml (mergeOverwrite .Values.extraLabels .Values.global.extraLabels) | nindent 4 }} + {{- end }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 4 }} + {{- end }} + annotations: + "helm.sh/hook": "post-install, post-upgrade" + "helm.sh/hook-delete-policy": "before-hook-creation" +spec: + completions: 1 + template: + spec: + serviceAccountName: {{ .Values.global.serviceAccountName }} + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + restartPolicy: Never + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 12 }} + {{- end }} + initContainers: + - name: keycloak-readiness-check + image: {{ include "imageUrl" (list .Values.initContainers.keycloakReadinessCheck.image $) }} + command: [ "sh", "-c", "until curl --output /dev/null --head --fail http://${KEYCLOAK_INTERNAL_HOST}/auth/health/ready; do sleep 1; done;" ] + env: + - name: KEYCLOAK_INTERNAL_HOST + valueFrom: + configMapKeyRef: + name: {{ .Values.global.configMapName | default (printf "%s-airbyte-env" .Release.Name) }} + key: KEYCLOAK_INTERNAL_HOST + securityContext: + {{- toYaml .Values.initContainerSecurityContext | nindent 14 }} + {{- if .Values.extraInitContainers }} + {{- toYaml .Values.extraInitContainers | nindent 8 }} + {{- end }} + containers: + - name: airbyte-keycloak-setup-container + image: {{ include "imageUrl" (list .Values.image $) }} + imagePullPolicy: "{{ .Values.image.pullPolicy }}" + env: + - name: AIRBYTE_URL + valueFrom: + configMapKeyRef: + name: {{ .Values.global.configMapName | default (printf "%s-airbyte-env" .Release.Name) }} + key: AIRBYTE_URL + - name: KEYCLOAK_ADMIN_USER + valueFrom: + secretKeyRef: + name: {{ .Values.global.secretName | default (printf "%s-airbyte-secrets" .Release.Name) }} + key: KEYCLOAK_ADMIN_USER + - name: KEYCLOAK_ADMIN_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.global.secretName | default (printf "%s-airbyte-secrets" .Release.Name) }} + key: KEYCLOAK_ADMIN_PASSWORD + - name: KEYCLOAK_INTERNAL_HOST + valueFrom: + configMapKeyRef: + name: {{ .Values.global.configMapName | default (printf "%s-airbyte-env" .Release.Name) }} + key: KEYCLOAK_INTERNAL_HOST + + {{- include "airbyte.database.envs" . | nindent 12 }} + {{- include "airbyte.enterprise.instanceAdmin" . | nindent 12 }} + {{- include "airbyte.enterprise.identityProvider" . | nindent 12 }} + {{- include "airbyte.keycloak.database.envs" . | nindent 12 }} + + # Values from secret + {{- if .Values.secrets }} + {{- range $k, $v := .Values.secrets }} + - name: {{ $k }} + valueFrom: + secretKeyRef: + name: keycloak-secrets + key: {{ $k }} + {{- end }} + {{- end }} + + # Values from env + {{- if .Values.env_vars }} + {{- range $k, $v := mergeOverwrite .Values.env_vars .Values.global.env_vars }} + - name: {{ $k }} + value: {{ $v | quote }} + {{- end }} + {{- end }} + + # Values from extraEnv for more compability(if you want to use external secret source or other stuff) + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 12 }} + {{- end }} + + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + volumeMounts: + {{- if .Values.global.airbyteYml }} + - name: airbyte-yml-volume + mountPath: /app/configs/airbyte.yml + subPath: fileContents + readOnly: true + {{- end }} + {{- if .Values.extraVolumeMounts }} + {{- toYaml .Values.extraVolumeMounts | nindent 12 }} + {{- end }} + {{- if .Values.containerSecurityContext }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 12 }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 8 }} + {{- end }} + {{- if .Values.global.extraContainers }} + {{ toYaml .Values.global.extraContainers | nindent 8 }} + {{- end }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 10 }} + volumes: + {{- if .Values.global.airbyteYml }} + - name: airbyte-yml-volume + secret: + secretName: {{ .Release.Name }}-airbyte-yml + {{- end }} + {{- if .Values.extraVolumes }} + {{- toYaml .Values.extraVolumes | nindent 8 }} + {{- end }} +{{- end }} +{{- end }} diff --git a/helm/airbyte-v1/charts/keycloak-setup/values.yaml b/helm/airbyte-v1/charts/keycloak-setup/values.yaml new file mode 100644 index 00000000..f134b437 --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak-setup/values.yaml @@ -0,0 +1,190 @@ +## global.serviceAccountName Name of service account to be associated with service +## deploymentMode Determines deployment mode of airbyte +## secretName Overrides the secrate name with with credentials to S3 Bucket and logging +## database.secretName Name of database secret +## database.secretValue Value of database password key stored in secret +global: + serviceAccountName: placeholderServiceAccount + edition: community + deploymentMode: oss + secretName: "" + database: + secretName: "" + secretValue: "" + secrets: {} + env_vars: {} + extraContainers: [] + ## extraSelectorLabels [object] - use to specify own additional selector labels for deployment + extraSelectorLabels: {} + ## extraLabels [object] - use to specify own additional labels for deployment + extraLabels: {} + + # Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "" + + +enabled: true +## image.repository The repository to use for the airbyte keycloak-setup image. +## image.pullPolicy the pull policy to use for the airbyte keycloak-setup image +## image.tag The airbyte keycloak-setup image tag. Defaults to the chart's AppVersion +image: + repository: airbyte/keycloak-setup + pullPolicy: IfNotPresent + +## podAnnotations [object] Add extra annotations to the keycloak-setup pod +## +podAnnotations: {} + +## podLabels [object] Add extra labels to the keycloak-setup pod +## +podLabels: {} + +## containerSecurityContext Security context for the container +## Examples: +## containerSecurityContext: +## runAsNonRoot: true +## runAsUser: 1000 +## readOnlyRootFilesystem: true +containerSecurityContext: {} + +## nodeSelector [object] Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## tolerations [array] Tolerations for worker pod assignment. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## Keycloak Setup resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## We usually recommend not to specify default resources and to leave this as a conscious +## choice for the user. This also increases chances charts run on environments with little +## resources, such as Minikube. If you do want to specify resources, uncomment the following +## lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## keycloak-setup.resources.limits [object] The resources limits for the airbyte keycloak-setup image +## keycloak-setup.resources.requests [object] The requested resources for the airbyte keycloak-setup image +resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + +## affinity [object] Affinity and anti-affinity for keycloak-setup pod assignment. +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## extraEnv [array] Supply extra env variables to main container using full notation +## Example: (With default env vars and values taken from generated config map) +## extraEnv: +## - name: AIRBYTE_VERSION +## valueFrom: +## configMapKeyRef: +## name: airbyte-env +## key: AIRBYTE_VERSION +## - name: DATABASE_HOST +## valueFrom: +## configMapKeyRef: +## name: airbyte-env +## key: DATABASE_HOST +## - name: DATABASE_PORT +## valueFrom: +## configMapKeyRef: +## name: airbyte-env +## key: DATABASE_PORT +## - name: DATABASE_PASSWORD +## valueFrom: +## secretKeyRef: +## name: airbyte-secrets +## key: DATABASE_PASSWORD +## - name: DATABASE_URL +## valueFrom: +## configMapKeyRef: +## name: airbyte-env +## key: DATABASE_URL +## - name: DATABASE_USER +## valueFrom: +## secretKeyRef: +## name: airbyte-secrets +## key: DATABASE_USER +## +extraEnv: [] + +## secrets [object] Supply additional secrets to container +## Example: +## secrets: +## DATABASE_PASSWORD: strong-password +## DATABASE_USER: my-db-user +secrets: {} + +## extraContainer [array] Additional container for keycloak pod(s) +## Example: +# extraContainers: +# - name: otel_collector +# image: somerepo/someimage:sometag +# args: [ +# "--important-args" +# ] +# ports: +# - containerPort: 443 +# volumeMounts: +# - name: volumeMountCool +# mountPath: /some/path +# readOnly: true +extraContainers: [] + +## extraInitContainers [array] Additional init containers for server pod(s) +## Example: +# extraInitContainers: +# - name: sleepy +# image: alpine +# command: ['sleep', '60'] + +extraInitContainers: [] + +## extraVolumeMounts [array] Additional volumeMounts for server container(s). +## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumeMounts: +## - name: tmpdir +## mountPath: /tmp +## +extraVolumeMounts: [] + +## extraVolumes [array] Additional volumes for server pod(s). +## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumes: +## - name: tmpdir +## emptyDir: {} +## +extraVolumes: [] + +## env_vars [object] Supply extra env variables to main container using simplified notation +## Example: +# env_vars: +# AIRBYTE_VERSION: 0.40.4 + +# # Airbyte Internal Database, see https://docs.airbyte.io/operator-guides/configuring-airbyte-db +# DATABASE_HOST: airbyte-db-svc +# DATABASE_PORT: 5432 +# # translate manually DATABASE_URL: jdbc:postgresql://${DATABASE_HOST}:${DATABASE_PORT/${DATABASE_DB} +# DATABASE_URL: jdbc:postgresql://airbyte-db-svc:5432/airbyte +# DATABASE_PASSWORD: 12345 +# DATABASE_USER: airbyte +env_vars: {} + +## extraSelectorLabels [object] - use to specify own additional selector labels for deployment +extraSelectorLabels: {} +## extraLabels [object] - use to specify own additional labels for deployment +extraLabels: {} diff --git a/helm/airbyte-v1/charts/keycloak/.gitignore b/helm/airbyte-v1/charts/keycloak/.gitignore new file mode 100644 index 00000000..88e91e8a --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak/.gitignore @@ -0,0 +1,2 @@ +# Charts are downloaded at install time with `helm dep build`. +charts diff --git a/helm/airbyte-v1/charts/keycloak/Chart.lock b/helm/airbyte-v1/charts/keycloak/Chart.lock new file mode 100644 index 00000000..cdb6f491 --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2024-12-09T21:57:13.706413758Z" diff --git a/helm/airbyte-v1/charts/keycloak/Chart.yaml b/helm/airbyte-v1/charts/keycloak/Chart.yaml new file mode 100644 index 00000000..6be65627 --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: Helm chart to deploy airbyte-keycloak +name: keycloak +type: application +version: 1.3.0 diff --git a/helm/airbyte-v1/charts/keycloak/README.md b/helm/airbyte-v1/charts/keycloak/README.md new file mode 100644 index 00000000..5b86476d --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak/README.md @@ -0,0 +1,71 @@ +# keycloak + +![Version: 0.67.17](https://img.shields.io/badge/Version-0.67.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: dev](https://img.shields.io/badge/AppVersion-dev-informational?style=flat-square) + +Helm chart to deploy airbyte-keycloak + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 1.x.x | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| bypassInit | bool | `false` | | +| containerSecurityContext | object | `{}` | | +| enabled | bool | `true` | | +| env_vars | object | `{}` | | +| extraContainers | list | `[]` | | +| extraEnv | list | `[]` | | +| extraInitContainers | list | `[]` | | +| extraLabels | object | `{}` | | +| extraSelectorLabels | object | `{}` | | +| extraVolumeMounts | list | `[]` | | +| extraVolumes | list | `[]` | | +| global.database.secretName | string | `""` | | +| global.database.secretValue | string | `""` | | +| global.deploymentMode | string | `"oss"` | airbyte deployment mode | +| global.edition | string | `"community"` | | +| global.env_vars | object | `{}` | | +| global.extraContainers | list | `[]` | | +| global.extraLabels | object | `{}` | | +| global.extraSelectorLabels | object | `{}` | | +| global.secretName | string | `""` | | +| global.secrets | object | `{}` | | +| global.serviceAccountName | string | `"placeholderServiceAccount"` | | +| headlessService.annotations | object | `{}` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"airbyte/keycloak"` | | +| livenessProbe.enabled | bool | `true` | | +| livenessProbe.failureThreshold | int | `3` | | +| livenessProbe.initialDelaySeconds | int | `30` | | +| livenessProbe.periodSeconds | int | `10` | | +| livenessProbe.successThreshold | int | `1` | | +| livenessProbe.timeoutSeconds | int | `1` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| readinessProbe.enabled | bool | `true` | | +| readinessProbe.failureThreshold | int | `3` | | +| readinessProbe.initialDelaySeconds | int | `30` | | +| readinessProbe.periodSeconds | int | `10` | | +| readinessProbe.successThreshold | int | `1` | | +| readinessProbe.timeoutSeconds | int | `1` | | +| resources.limits | object | `{}` | | +| resources.requests | object | `{}` | | +| secrets | object | `{}` | | +| service.annotations | object | `{}` | | +| service.port | int | `8180` | | +| service.type | string | `"ClusterIP"` | | +| startupProbe.enabled | bool | `true` | | +| startupProbe.failureThreshold | int | `60` | | +| startupProbe.initialDelaySeconds | int | `30` | | +| startupProbe.periodSeconds | int | `5` | | +| startupProbe.successThreshold | int | `1` | | +| startupProbe.timeoutSeconds | int | `1` | | +| tolerations | list | `[]` | | + diff --git a/helm/airbyte-v1/charts/keycloak/templates/_helpers.tpl b/helm/airbyte-v1/charts/keycloak/templates/_helpers.tpl new file mode 100644 index 00000000..7be7bc1a --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak/templates/_helpers.tpl @@ -0,0 +1,51 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "airbyte.labels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "airbyte.selectorLabels" -}} +app.kubernetes.io/name: {{ include "airbyte.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/keycloak/templates/_images.tpl b/helm/airbyte-v1/charts/keycloak/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/keycloak/templates/service.yaml b/helm/airbyte-v1/charts/keycloak/templates/service.yaml new file mode 100644 index 00000000..3e7b5fea --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak/templates/service.yaml @@ -0,0 +1,60 @@ +# If Cloud or Pro/Enterprise, render the keycloak service template. +{{- if or (eq .Values.global.deploymentMode "cloud") (eq .Values.global.edition "pro") (eq .Values.global.edition "enterprise") }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{.Release.Name }}-airbyte-keycloak-svc + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + {{ if and (eq .Values.service.type "NodePort") (.Values.service.nodePort) }} + nodePort: {{ .Values.service.nodePort }} + {{- end }} + selector: + {{- include "airbyte.selectorLabels" . | nindent 4 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 4 }} + {{- end }} +--- +# This headless service sets ClusterIp: None so that it can be +# used for internal DNS resolution of all individual keycloak +# pods. Port 7800 is the default jgroups port that Keycloak +# expects to be open to enable Infinispan cache synchronization. +apiVersion: v1 +kind: Service +metadata: + name: {{.Release.Name }}-airbyte-keycloak-headless-svc + {{- with .Values.headlessService.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} +spec: + type: ClusterIP + clusterIP: None + ports: + - name: jgroups + port: 7800 + targetPort: 7800 + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "airbyte.selectorLabels" . | nindent 4 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 4 }} + {{- end }} +{{- end }} diff --git a/helm/airbyte-v1/charts/keycloak/templates/statefulset.yaml b/helm/airbyte-v1/charts/keycloak/templates/statefulset.yaml new file mode 100644 index 00000000..89769cff --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak/templates/statefulset.yaml @@ -0,0 +1,193 @@ +# if Cloud or Pro/Enterprise, render the keycloak StatefulSet template. +{{- if or (eq .Values.global.deploymentMode "cloud") (eq .Values.global.edition "pro") (eq .Values.global.edition "enterprise") }} +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "common.names.fullname" . }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} + {{- if .Values.extraLabels }} + {{ toYaml (mergeOverwrite .Values.extraLabels .Values.global.extraLabels) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + serviceName: {{.Release.Name }}-airbyte-keycloak-headless-svc + podManagementPolicy: OrderedReady # embedded infinispan does not handle parallel joins well, src https://github.com/keycloak/keycloak/issues/21108#issuecomment-1599010602 + updateStrategy: + type: RollingUpdate + selector: + matchLabels: + {{- include "airbyte.selectorLabels" . | nindent 6 }} + {{- if .Values.extraLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 4 }} + {{- end }} + template: + metadata: + labels: + {{- include "airbyte.selectorLabels" . | nindent 8 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 8 }} + {{- end }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.podAnnotations }} + annotations: + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ .Values.global.serviceAccountName }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + initContainers: + {{- if and (eq .Values.global.deploymentMode "oss") (ne .Values.bypassInit true)}} + # This init container will only executed if the deployment mode is "oss" and the bypassInit is not true. + - name: init-db + image: {{ include "imageUrl" (list .Values.initContainers.initDb.image $) }} + command: [ "sh", "-c" ] + args: + - > + PGPASSWORD=$DATABASE_PASSWORD psql -h $DATABASE_HOST -p $DATABASE_PORT -U $DATABASE_USER -d $DATABASE_DB -c "CREATE SCHEMA IF NOT EXISTS keycloak"; + env: + {{- include "airbyte.database.envs" . | nindent 12 }} + + securityContext: + {{- toYaml .Values.initContainerSecurityContext | nindent 14 }} + {{- end }} + {{- if .Values.extraInitContainers }} + {{- toYaml .Values.extraInitContainers | nindent 8 }} + {{- end }} + containers: + - name: airbyte-keycloak + image: {{ include "imageUrl" (list .Values.image $)}} + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- if eq .Values.global.deploymentMode "oss" }} + - name: KEYCLOAK_ADMIN_USER + valueFrom: + secretKeyRef: + name: {{ .Values.global.secretName | default (printf "%s-airbyte-secrets" .Release.Name) }} + key: KEYCLOAK_ADMIN_USER + - name: KEYCLOAK_ADMIN_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.global.secretName | default (printf "%s-airbyte-secrets" .Release.Name) }} + key: KEYCLOAK_ADMIN_PASSWORD + - name: KEYCLOAK_PORT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: KEYCLOAK_PORT + - name: JAVA_OPTS_APPEND + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: KEYCLOAK_JAVA_OPTS_APPEND + {{- include "airbyte.keycloak.database.envs" . | nindent 12 }} + {{- end }} # end if oss + + {{- if .Values.extraEnv }} + {{ .Values.extraEnv | toYaml | nindent 12 }} + {{- end }} + + # Values from secret + {{- if .Values.secrets }} + {{- range $k, $v := .Values.secrets }} + - name: {{ $k }} + valueFrom: + secretKeyRef: + name: keycloak-secrets + key: {{ $k }} + {{- end }} + {{- end }} + + # Values from env + {{- if .Values.env_vars }} + {{- range $k, $v := mergeOverwrite .Values.env_vars .Values.global.env_vars }} + - name: {{ $k }} + value: {{ $v | quote }} + {{- end }} + {{- end }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + - containerPort: 7800 + {{- if .Values.containerSecurityContext }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 12 }} + {{- end }} + volumeMounts: + - name: keycloak-storage + mountPath: /opt/keycloak/data/infinispan + {{- if .Values.extraVolumeMounts }} + {{ toYaml .Values.extraVolumeMounts | nindent 10 }} + {{- end }} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: /auth/health/live + port: {{ .Values.service.port }} + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: /auth/health/ready + port: {{ .Values.service.port }} + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: + httpGet: + path: /auth/health/started + port: {{ .Values.service.port }} + initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.startupProbe.periodSeconds }} + timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds }} + successThreshold: {{ .Values.startupProbe.successThreshold }} + failureThreshold: {{ .Values.startupProbe.failureThreshold }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 8 }} + {{- end }} + {{- if .Values.global.extraContainers }} + {{ toYaml .Values.global.extraContainers | nindent 8 }} + {{- end }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 10 }} + volumes: + {{- if .Values.extraVolumes }} + {{ toYaml .Values.extraVolumes | nindent 8 }} + {{- end }} + volumeClaimTemplates: + - metadata: + name: keycloak-storage + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: 1Gi +{{- end }} diff --git a/helm/airbyte-v1/charts/keycloak/values.yaml b/helm/airbyte-v1/charts/keycloak/values.yaml new file mode 100644 index 00000000..30de3c4b --- /dev/null +++ b/helm/airbyte-v1/charts/keycloak/values.yaml @@ -0,0 +1,245 @@ +## global.serviceAccountName Name of service account to be associated with service +## deploymentMode Determines deployment mode of airbyte +## secretName Overrides the secrate name with with credentials to S3 Bucket and logging +## database.secretName Name of database secret +## database.secretValue Value of database password key stored in secret +global: + # serviceAccountName -- Service Account name override + serviceAccountName: placeholderServiceAccount + edition: community + # -- airbyte deployment mode + deploymentMode: oss + secretName: "" + database: + secretName: "" + secretValue: "" + secrets: {} + env_vars: {} + extraContainers: [] + ## extraSelectorLabels [object] - use to specify own additional selector labels for deployment + extraSelectorLabels: {} + ## extraLabels [object] - use to specify own additional labels for deployment + extraLabels: {} + + # Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "" + + +enabled: true + +bypassInit: false +## image.repository The repository to use for the airbyte keycloak image. +## image.pullPolicy the pull policy to use for the airbyte keycloak image +## image.tag The airbyte keycloak image tag. Defaults to the chart's AppVersion +image: + repository: airbyte/keycloak + pullPolicy: IfNotPresent + +## podAnnotations [object] Add extra annotations to the keycloak pod +## +podAnnotations: {} + +## podLabels [object] Add extra labels to the keycloak pod +## +podLabels: {} + +## Configure extra options for the keycloak containers' liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## livenessProbe.enabled Enable livenessProbe on keycloak +## livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe +## livenessProbe.periodSeconds Period seconds for livenessProbe +## livenessProbe.timeoutSeconds Timeout seconds for livenessProbe +## livenessProbe.failureThreshold Failure threshold for livenessProbe +## livenessProbe.successThreshold Success threshold for livenessProbe +## +livenessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## readinessProbe.enabled Enable readinessProbe on keycloak +## readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe +## readinessProbe.periodSeconds Period seconds for readinessProbe +## readinessProbe.timeoutSeconds Timeout seconds for readinessProbe +## readinessProbe.failureThreshold Failure threshold for readinessProbe +## readinessProbe.successThreshold Success threshold for readinessProbe +## +readinessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +startupProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 5 + timeoutSeconds: 1 + failureThreshold: 60 + successThreshold: 1 + +## containerSecurityContext Security context for the container +## Examples: +## containerSecurityContext: +## runAsNonRoot: true +## runAsUser: 1000 +## readOnlyRootFilesystem: true +containerSecurityContext: {} + +## nodeSelector [object] Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## tolerations [array] Tolerations for worker pod assignment. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## service.type The service type to use for the API server +## service.port The service port to expose the API server on +service: + type: ClusterIP + port: 8180 + annotations: {} + +headlessService: + annotations: {} + +## Keycloak resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## We usually recommend not to specify default resources and to leave this as a conscious +## choice for the user. This also increases chances charts run on environments with little +## resources, such as Minikube. If you do want to specify resources, uncomment the following +## lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## keycloak.resources.limits [object] The resources limits for the keycloak image +## keycloak.resources.requests [object] The requested resources for the keycloak image +resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + +## affinity [object] Affinity and anti-affinity for keycloak pod assignment. +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## extraEnv [array] Supply extra env variables to main container using full notation +## Example: (With default env vars and values taken from generated config map) +## extraEnv: +## - name: AIRBYTE_VERSION +## valueFrom: +## configMapKeyRef: +## name: airbyte-env +## key: AIRBYTE_VERSION +## - name: DATABASE_HOST +## valueFrom: +## configMapKeyRef: +## name: airbyte-env +## key: DATABASE_HOST +## - name: DATABASE_PORT +## valueFrom: +## configMapKeyRef: +## name: airbyte-env +## key: DATABASE_PORT +## - name: DATABASE_PASSWORD +## valueFrom: +## secretKeyRef: +## name: airbyte-secrets +## key: DATABASE_PASSWORD +## - name: DATABASE_URL +## valueFrom: +## configMapKeyRef: +## name: airbyte-env +## key: DATABASE_URL +## - name: DATABASE_USER +## valueFrom: +## secretKeyRef: +## name: airbyte-secrets +## key: DATABASE_USER +## +extraEnv: [] + +## secrets [object] Supply additional secrets to container +## Example: +## secrets: +## DATABASE_PASSWORD: strong-password +## DATABASE_USER: my-db-user +secrets: {} + +## extraContainer [array] Additional container for keycloak pod(s) +## Example: +# extraContainers: +# - name: otel_collector +# image: somerepo/someimage:sometag +# args: [ +# "--important-args" +# ] +# ports: +# - containerPort: 443 +# volumeMounts: +# - name: volumeMountCool +# mountPath: /some/path +# readOnly: true +extraContainers: [] + +## extraInitContainers [array] Additional init containers for server pod(s) +## Example: +# extraInitContainers: +# - name: sleepy +# image: alpine +# command: ['sleep', '60'] + +extraInitContainers: [] + +## extraVolumeMounts [array] Additional volumeMounts for server container(s). +## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumeMounts: +## - name: tmpdir +## mountPath: /tmp +## +extraVolumeMounts: [] + +## extraVolumes [array] Additional volumes for server pod(s). +## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumes: +## - name: tmpdir +## emptyDir: {} +## +extraVolumes: [] + +## env_vars [object] Supply extra env variables to main container using simplified notation +## Example: +# env_vars: +# AIRBYTE_VERSION: 0.40.4 + +# # Airbyte Internal Database, see https://docs.airbyte.io/operator-guides/configuring-airbyte-db +# DATABASE_HOST: airbyte-db-svc +# DATABASE_PORT: 5432 +# # translate manually DATABASE_URL: jdbc:postgresql://${DATABASE_HOST}:${DATABASE_PORT/${DATABASE_DB} +# DATABASE_URL: jdbc:postgresql://airbyte-db-svc:5432/airbyte +# DATABASE_PASSWORD: 12345 +# DATABASE_USER: airbyte +env_vars: {} + +## extraSelectorLabels [object] - use to specify own additional selector labels for deployment +extraSelectorLabels: {} +## extraLabels [object] - use to specify own additional labels for deployment +extraLabels: {} + diff --git a/helm/airbyte-v1/charts/metrics/.helmignore b/helm/airbyte-v1/charts/metrics/.helmignore new file mode 100644 index 00000000..f885da3f --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/.helmignore @@ -0,0 +1,25 @@ +# 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/ + +ci.sh diff --git a/helm/airbyte-v1/charts/metrics/Chart.lock b/helm/airbyte-v1/charts/metrics/Chart.lock new file mode 100644 index 00000000..017faffa --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2022-08-31T12:09:18.473209+01:00" diff --git a/helm/airbyte-v1/charts/metrics/Chart.yaml b/helm/airbyte-v1/charts/metrics/Chart.yaml new file mode 100644 index 00000000..a5127075 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: Helm chart to deploy airbyte-metrics +name: metrics +type: application +version: 1.3.0 diff --git a/helm/airbyte-v1/charts/metrics/README.md b/helm/airbyte-v1/charts/metrics/README.md new file mode 100644 index 00000000..51fd055b --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/README.md @@ -0,0 +1,40 @@ +# metrics + +![Version: 0.67.17](https://img.shields.io/badge/Version-0.67.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: dev](https://img.shields.io/badge/AppVersion-dev-informational?style=flat-square) + +Helm chart to deploy airbyte-metrics + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 1.x.x | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| containerSecurityContext | object | `{}` | | +| enabled | bool | `true` | | +| env_vars | object | `{}` | | +| extraContainers | list | `[]` | | +| extraEnv | list | `[]` | | +| extraVolumeMounts | list | `[]` | | +| extraVolumes | list | `[]` | | +| global.database.secretName | string | `""` | | +| global.database.secretValue | string | `""` | | +| global.deploymentMode | string | `"oss"` | | +| global.extraContainers | list | `[]` | | +| global.serviceAccountName | string | `"placeholderServiceAccount"` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"airbyte/metrics-reporter"` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| replicaCount | int | `1` | | +| resources.limits | object | `{}` | | +| resources.requests | object | `{}` | | +| secrets | object | `{}` | | +| tolerations | list | `[]` | | + diff --git a/helm/airbyte-v1/charts/metrics/charts/common/.helmignore b/helm/airbyte-v1/charts/metrics/charts/common/.helmignore new file mode 100644 index 00000000..50af0317 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/.helmignore @@ -0,0 +1,22 @@ +# 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 +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/airbyte-v1/charts/metrics/charts/common/Chart.yaml b/helm/airbyte-v1/charts/metrics/charts/common/Chart.yaml new file mode 100644 index 00000000..39edbb3c --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/Chart.yaml @@ -0,0 +1,23 @@ +annotations: + category: Infrastructure +apiVersion: v2 +appVersion: 1.17.1 +description: A Library Helm Chart for grouping common logic between bitnami charts. + This chart is not deployable by itself. +home: https://github.com/bitnami/charts/tree/master/bitnami/common +icon: https://bitnami.com/downloads/logos/bitnami-mark.png +keywords: +- common +- helper +- template +- function +- bitnami +maintainers: +- name: Bitnami + url: https://github.com/bitnami/charts +name: common +sources: +- https://github.com/bitnami/charts +- https://www.bitnami.com/ +type: library +version: 1.17.1 diff --git a/helm/airbyte-v1/charts/metrics/charts/common/README.md b/helm/airbyte-v1/charts/metrics/charts/common/README.md new file mode 100644 index 00000000..a2ecd604 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/README.md @@ -0,0 +1,350 @@ +# Bitnami Common Library Chart + +A [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between bitnami charts. + +## TL;DR + +```yaml +dependencies: + - name: common + version: 1.x.x + repository: https://charts.bitnami.com/bitnami +``` + +```bash +$ helm dependency update +``` + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.names.fullname" . }} +data: + myvalue: "Hello World" +``` + +## Introduction + +This chart provides a common template helpers which can be used to develop new charts using [Helm](https://helm.sh) package manager. + +Bitnami charts can be used with [Kubeapps](https://kubeapps.dev/) for deployment and management of Helm Charts in clusters. + +## Prerequisites + +- Kubernetes 1.19+ +- Helm 3.2.0+ + +## Parameters + +The following table lists the helpers available in the library which are scoped in different sections. + +### Affinities + +| Helper identifier | Description | Expected Input | +|-------------------------------|------------------------------------------------------|------------------------------------------------| +| `common.affinities.nodes.soft` | Return a soft nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` | +| `common.affinities.nodes.hard` | Return a hard nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` | +| `common.affinities.pods.soft` | Return a soft podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` | +| `common.affinities.pods.hard` | Return a hard podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` | + +### Capabilities + +| Helper identifier | Description | Expected Input | +|------------------------------------------------|------------------------------------------------------------------------------------------------|-------------------| +| `common.capabilities.kubeVersion` | Return the target Kubernetes version (using client default if .Values.kubeVersion is not set). | `.` Chart context | +| `common.capabilities.cronjob.apiVersion` | Return the appropriate apiVersion for cronjob. | `.` Chart context | +| `common.capabilities.deployment.apiVersion` | Return the appropriate apiVersion for deployment. | `.` Chart context | +| `common.capabilities.statefulset.apiVersion` | Return the appropriate apiVersion for statefulset. | `.` Chart context | +| `common.capabilities.ingress.apiVersion` | Return the appropriate apiVersion for ingress. | `.` Chart context | +| `common.capabilities.rbac.apiVersion` | Return the appropriate apiVersion for RBAC resources. | `.` Chart context | +| `common.capabilities.crd.apiVersion` | Return the appropriate apiVersion for CRDs. | `.` Chart context | +| `common.capabilities.policy.apiVersion` | Return the appropriate apiVersion for podsecuritypolicy. | `.` Chart context | +| `common.capabilities.networkPolicy.apiVersion` | Return the appropriate apiVersion for networkpolicy. | `.` Chart context | +| `common.capabilities.apiService.apiVersion` | Return the appropriate apiVersion for APIService. | `.` Chart context | +| `common.capabilities.hpa.apiVersion` | Return the appropriate apiVersion for Horizontal Pod Autoscaler | `.` Chart context | +| `common.capabilities.supportsHelmVersion` | Returns true if the used Helm version is 3.3+ | `.` Chart context | + +### Errors + +| Helper identifier | Description | Expected Input | +|-----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| +| `common.errors.upgrade.passwords.empty` | It will ensure required passwords are given when we are upgrading a chart. If `validationErrors` is not empty it will throw an error and will stop the upgrade action. | `dict "validationErrors" (list $validationError00 $validationError01) "context" $` | + +### Images + +| Helper identifier | Description | Expected Input | +|-----------------------------|------------------------------------------------------|---------------------------------------------------------------------------------------------------------| +| `common.images.image` | Return the proper and full image name | `dict "imageRoot" .Values.path.to.the.image "global" $`, see [ImageRoot](#imageroot) for the structure. | +| `common.images.pullSecrets` | Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global` | +| `common.images.renderPullSecrets` | Return the proper Docker Image Registry Secret Names (evaluates values as templates) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $` | + +### Ingress + +| Helper identifier | Description | Expected Input | +|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.ingress.backend` | Generate a proper Ingress backend entry depending on the API version | `dict "serviceName" "foo" "servicePort" "bar"`, see the [Ingress deprecation notice](https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/) for the syntax differences | +| `common.ingress.supportsPathType` | Prints "true" if the pathType field is supported | `.` Chart context | +| `common.ingress.supportsIngressClassname` | Prints "true" if the ingressClassname field is supported | `.` Chart context | +| `common.ingress.certManagerRequest` | Prints "true" if required cert-manager annotations for TLS signed certificates are set in the Ingress annotations | `dict "annotations" .Values.path.to.the.ingress.annotations` | + +### Labels + +| Helper identifier | Description | Expected Input | +|-----------------------------|-----------------------------------------------------------------------------|-------------------| +| `common.labels.standard` | Return Kubernetes standard labels | `.` Chart context | +| `common.labels.matchLabels` | Labels to use on `deploy.spec.selector.matchLabels` and `svc.spec.selector` | `.` Chart context | + +### Names + +| Helper identifier | Description | Expected Input | +|-----------------------------------|-----------------------------------------------------------------------|-------------------| +| `common.names.name` | Expand the name of the chart or use `.Values.nameOverride` | `.` Chart context | +| `common.names.fullname` | Create a default fully qualified app name. | `.` Chart context | +| `common.names.namespace` | Allow the release namespace to be overridden | `.` Chart context | +| `common.names.fullname.namespace` | Create a fully qualified app name adding the installation's namespace | `.` Chart context | +| `common.names.chart` | Chart name plus version | `.` Chart context | + +### Secrets + +| Helper identifier | Description | Expected Input | +|---------------------------|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.secrets.name` | Generate the name of the secret. | `dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $` see [ExistingSecret](#existingsecret) for the structure. | +| `common.secrets.key` | Generate secret key. | `dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName"` see [ExistingSecret](#existingsecret) for the structure. | +| `common.passwords.manage` | Generate secret password or retrieve one if already created. | `dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $`, length, strong and chartNAme fields are optional. | +| `common.secrets.exists` | Returns whether a previous generated secret already exists. | `dict "secret" "secret-name" "context" $` | + +### Storage + +| Helper identifier | Description | Expected Input | +|-------------------------------|---------------------------------------|---------------------------------------------------------------------------------------------------------------------| +| `common.storage.class` | Return the proper Storage Class | `dict "persistence" .Values.path.to.the.persistence "global" $`, see [Persistence](#persistence) for the structure. | + +### TplValues + +| Helper identifier | Description | Expected Input | +|---------------------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.tplvalues.render` | Renders a value that contains template | `dict "value" .Values.path.to.the.Value "context" $`, value is the value should rendered as template, context frequently is the chart context `$` or `.` | + +### Utils + +| Helper identifier | Description | Expected Input | +|--------------------------------|------------------------------------------------------------------------------------------|------------------------------------------------------------------------| +| `common.utils.fieldToEnvVar` | Build environment variable name given a field. | `dict "field" "my-password"` | +| `common.utils.secret.getvalue` | Print instructions to get a secret value. | `dict "secret" "secret-name" "field" "secret-value-field" "context" $` | +| `common.utils.getValueFromKey` | Gets a value from `.Values` object given its key path | `dict "key" "path.to.key" "context" $` | +| `common.utils.getKeyFromList` | Returns first `.Values` key with a defined value or first of the list if all non-defined | `dict "keys" (list "path.to.key1" "path.to.key2") "context" $` | + +### Validations + +| Helper identifier | Description | Expected Input | +|--------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.validations.values.single.empty` | Validate a value must not be empty. | `dict "valueKey" "path.to.value" "secret" "secret.name" "field" "my-password" "subchart" "subchart" "context" $` secret, field and subchart are optional. In case they are given, the helper will generate a how to get instruction. See [ValidateValue](#validatevalue) | +| `common.validations.values.multiple.empty` | Validate a multiple values must not be empty. It returns a shared error for all the values. | `dict "required" (list $validateValueConf00 $validateValueConf01) "context" $`. See [ValidateValue](#validatevalue) | +| `common.validations.values.mariadb.passwords` | This helper will ensure required password for MariaDB are not empty. It returns a shared error for all the values. | `dict "secret" "mariadb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mariadb chart and the helper. | +| `common.validations.values.mysql.passwords` | This helper will ensure required password for MySQL are not empty. It returns a shared error for all the values. | `dict "secret" "mysql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mysql chart and the helper. | +| `common.validations.values.postgresql.passwords` | This helper will ensure required password for PostgreSQL are not empty. It returns a shared error for all the values. | `dict "secret" "postgresql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use postgresql chart and the helper. | +| `common.validations.values.redis.passwords` | This helper will ensure required password for Redis® are not empty. It returns a shared error for all the values. | `dict "secret" "redis-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use redis chart and the helper. | +| `common.validations.values.cassandra.passwords` | This helper will ensure required password for Cassandra are not empty. It returns a shared error for all the values. | `dict "secret" "cassandra-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use cassandra chart and the helper. | +| `common.validations.values.mongodb.passwords` | This helper will ensure required password for MongoDB® are not empty. It returns a shared error for all the values. | `dict "secret" "mongodb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mongodb chart and the helper. | + +### Warnings + +| Helper identifier | Description | Expected Input | +|------------------------------|----------------------------------|------------------------------------------------------------| +| `common.warnings.rollingTag` | Warning about using rolling tag. | `ImageRoot` see [ImageRoot](#imageroot) for the structure. | + +## Special input schemas + +### ImageRoot + +```yaml +registry: + type: string + description: Docker registry where the image is located + example: docker.io + +repository: + type: string + description: Repository and image name + example: bitnami/nginx + +tag: + type: string + description: image tag + example: 1.16.1-debian-10-r63 + +pullPolicy: + type: string + description: Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + +pullSecrets: + type: array + items: + type: string + description: Optionally specify an array of imagePullSecrets (evaluated as templates). + +debug: + type: boolean + description: Set to true if you would like to see extra information on logs + example: false + +## An instance would be: +# registry: docker.io +# repository: bitnami/nginx +# tag: 1.16.1-debian-10-r63 +# pullPolicy: IfNotPresent +# debug: false +``` + +### Persistence + +```yaml +enabled: + type: boolean + description: Whether enable persistence. + example: true + +storageClass: + type: string + description: Ghost data Persistent Volume Storage Class, If set to "-", storageClassName: "" which disables dynamic provisioning. + example: "-" + +accessMode: + type: string + description: Access mode for the Persistent Volume Storage. + example: ReadWriteOnce + +size: + type: string + description: Size the Persistent Volume Storage. + example: 8Gi + +path: + type: string + description: Path to be persisted. + example: /bitnami + +## An instance would be: +# enabled: true +# storageClass: "-" +# accessMode: ReadWriteOnce +# size: 8Gi +# path: /bitnami +``` + +### ExistingSecret + +```yaml +name: + type: string + description: Name of the existing secret. + example: mySecret +keyMapping: + description: Mapping between the expected key name and the name of the key in the existing secret. + type: object + +## An instance would be: +# name: mySecret +# keyMapping: +# password: myPasswordKey +``` + +#### Example of use + +When we store sensitive data for a deployment in a secret, some times we want to give to users the possibility of using theirs existing secrets. + +```yaml +# templates/secret.yaml +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.names.fullname" . }} + labels: + app: {{ include "common.names.fullname" . }} +type: Opaque +data: + password: {{ .Values.password | b64enc | quote }} + +# templates/dpl.yaml +--- +... + env: + - name: PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "common.secrets.name" (dict "existingSecret" .Values.existingSecret "context" $) }} + key: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "password") }} +... + +# values.yaml +--- +name: mySecret +keyMapping: + password: myPasswordKey +``` + +### ValidateValue + +#### NOTES.txt + +```console +{{- $validateValueConf00 := (dict "valueKey" "path.to.value00" "secret" "secretName" "field" "password-00") -}} +{{- $validateValueConf01 := (dict "valueKey" "path.to.value01" "secret" "secretName" "field" "password-01") -}} + +{{ include "common.validations.values.multiple.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }} +``` + +If we force those values to be empty we will see some alerts + +```console +$ helm install test mychart --set path.to.value00="",path.to.value01="" + 'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value: + + export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 -d) + + 'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value: + + export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 -d) +``` + +## Upgrading + +### To 1.0.0 + +[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL. + +**What changes were introduced in this major version?** + +- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field. +- Use `type: library`. [Here](https://v3.helm.sh/docs/faq/#library-chart-support) you can find more information. +- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts + +**Considerations when upgrading to this version** + +- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues +- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore +- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3 + +**Useful links** + +- https://docs.bitnami.com/tutorials/resolve-helm2-helm3-post-migration-issues/ +- https://helm.sh/docs/topics/v2_v3_migration/ +- https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/ + +## License + +Copyright © 2022 Bitnami + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/_affinities.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/_affinities.tpl new file mode 100644 index 00000000..2387be26 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/_affinities.tpl @@ -0,0 +1,102 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Return a soft nodeAffinity definition +{{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes.soft" -}} +preferredDuringSchedulingIgnoredDuringExecution: + - preference: + matchExpressions: + - key: {{ .key }} + operator: In + values: + {{- range .values }} + - {{ . | quote }} + {{- end }} + weight: 1 +{{- end -}} + +{{/* +Return a hard nodeAffinity definition +{{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes.hard" -}} +requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: {{ .key }} + operator: In + values: + {{- range .values }} + - {{ . | quote }} + {{- end }} +{{- end -}} + +{{/* +Return a nodeAffinity definition +{{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes" -}} + {{- if eq .type "soft" }} + {{- include "common.affinities.nodes.soft" . -}} + {{- else if eq .type "hard" }} + {{- include "common.affinities.nodes.hard" . -}} + {{- end -}} +{{- end -}} + +{{/* +Return a soft podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods.soft" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}} +*/}} +{{- define "common.affinities.pods.soft" -}} +{{- $component := default "" .component -}} +{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} +preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 10 }} + {{- if not (empty $component) }} + {{ printf "app.kubernetes.io/component: %s" $component }} + {{- end }} + {{- range $key, $value := $extraMatchLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + namespaces: + - {{ include "common.names.namespace" .context | quote }} + topologyKey: kubernetes.io/hostname + weight: 1 +{{- end -}} + +{{/* +Return a hard podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods.hard" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}} +*/}} +{{- define "common.affinities.pods.hard" -}} +{{- $component := default "" .component -}} +{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} +requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 8 }} + {{- if not (empty $component) }} + {{ printf "app.kubernetes.io/component: %s" $component }} + {{- end }} + {{- range $key, $value := $extraMatchLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + namespaces: + - {{ include "common.names.namespace" .context | quote }} + topologyKey: kubernetes.io/hostname +{{- end -}} + +{{/* +Return a podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.pods" -}} + {{- if eq .type "soft" }} + {{- include "common.affinities.pods.soft" . -}} + {{- else if eq .type "hard" }} + {{- include "common.affinities.pods.hard" . -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/_capabilities.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/_capabilities.tpl new file mode 100644 index 00000000..9d9b7600 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/_capabilities.tpl @@ -0,0 +1,154 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Return the target Kubernetes version +*/}} +{{- define "common.capabilities.kubeVersion" -}} +{{- if .Values.global }} + {{- if .Values.global.kubeVersion }} + {{- .Values.global.kubeVersion -}} + {{- else }} + {{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} + {{- end -}} +{{- else }} +{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for poddisruptionbudget. +*/}} +{{- define "common.capabilities.policy.apiVersion" -}} +{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "policy/v1beta1" -}} +{{- else -}} +{{- print "policy/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for networkpolicy. +*/}} +{{- define "common.capabilities.networkPolicy.apiVersion" -}} +{{- if semverCompare "<1.7-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for cronjob. +*/}} +{{- define "common.capabilities.cronjob.apiVersion" -}} +{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "batch/v1beta1" -}} +{{- else -}} +{{- print "batch/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for deployment. +*/}} +{{- define "common.capabilities.deployment.apiVersion" -}} +{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for statefulset. +*/}} +{{- define "common.capabilities.statefulset.apiVersion" -}} +{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apps/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for ingress. +*/}} +{{- define "common.capabilities.ingress.apiVersion" -}} +{{- if .Values.ingress -}} +{{- if .Values.ingress.apiVersion -}} +{{- .Values.ingress.apiVersion -}} +{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end }} +{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for RBAC resources. +*/}} +{{- define "common.capabilities.rbac.apiVersion" -}} +{{- if semverCompare "<1.17-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "rbac.authorization.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "rbac.authorization.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for CRDs. +*/}} +{{- define "common.capabilities.crd.apiVersion" -}} +{{- if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apiextensions.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "apiextensions.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for APIService. +*/}} +{{- define "common.capabilities.apiService.apiVersion" -}} +{{- if semverCompare "<1.10-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apiregistration.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "apiregistration.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for Horizontal Pod Autoscaler. +*/}} +{{- define "common.capabilities.hpa.apiVersion" -}} +{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .context) -}} +{{- if .beta2 -}} +{{- print "autoscaling/v2beta2" -}} +{{- else -}} +{{- print "autoscaling/v2beta1" -}} +{{- end -}} +{{- else -}} +{{- print "autoscaling/v2" -}} +{{- end -}} +{{- end -}} + +{{/* +Returns true if the used Helm version is 3.3+. +A way to check the used Helm version was not introduced until version 3.3.0 with .Capabilities.HelmVersion, which contains an additional "{}}" structure. +This check is introduced as a regexMatch instead of {{ if .Capabilities.HelmVersion }} because checking for the key HelmVersion in <3.3 results in a "interface not found" error. +**To be removed when the catalog's minimun Helm version is 3.3** +*/}} +{{- define "common.capabilities.supportsHelmVersion" -}} +{{- if regexMatch "{(v[0-9])*[^}]*}}$" (.Capabilities | toString ) }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/_errors.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/_errors.tpl new file mode 100644 index 00000000..a79cc2e3 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/_errors.tpl @@ -0,0 +1,23 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Through error when upgrading using empty passwords values that must not be empty. + +Usage: +{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}} +{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}} +{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }} + +Required password params: + - validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error. + - context - Context - Required. Parent context. +*/}} +{{- define "common.errors.upgrade.passwords.empty" -}} + {{- $validationErrors := join "" .validationErrors -}} + {{- if and $validationErrors .context.Release.IsUpgrade -}} + {{- $errorString := "\nPASSWORDS ERROR: You must provide your current passwords when upgrading the release." -}} + {{- $errorString = print $errorString "\n Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims." -}} + {{- $errorString = print $errorString "\n Further information can be obtained at https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases" -}} + {{- $errorString = print $errorString "\n%s" -}} + {{- printf $errorString $validationErrors | fail -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/_images.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/_images.tpl new file mode 100644 index 00000000..42ffbc72 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/_images.tpl @@ -0,0 +1,75 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Return the proper image name +{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }} +*/}} +{{- define "common.images.image" -}} +{{- $registryName := .imageRoot.registry -}} +{{- $repositoryName := .imageRoot.repository -}} +{{- $tag := .imageRoot.tag | toString -}} +{{- if .global }} + {{- if .global.imageRegistry }} + {{- $registryName = .global.imageRegistry -}} + {{- end -}} +{{- end -}} +{{- if $registryName }} +{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- else -}} +{{- printf "%s:%s" $repositoryName $tag -}} +{{- end -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) +{{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }} +*/}} +{{- define "common.images.pullSecrets" -}} + {{- $pullSecrets := list }} + + {{- if .global }} + {{- range .global.imagePullSecrets -}} + {{- $pullSecrets = append $pullSecrets . -}} + {{- end -}} + {{- end -}} + + {{- range .images -}} + {{- range .pullSecrets -}} + {{- $pullSecrets = append $pullSecrets . -}} + {{- end -}} + {{- end -}} + + {{- if (not (empty $pullSecrets)) }} +imagePullSecrets: + {{- range $pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names evaluating values as templates +{{ include "common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }} +*/}} +{{- define "common.images.renderPullSecrets" -}} + {{- $pullSecrets := list }} + {{- $context := .context }} + + {{- if $context.Values.global }} + {{- range $context.Values.global.imagePullSecrets -}} + {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} + {{- end -}} + {{- end -}} + + {{- range .images -}} + {{- range .pullSecrets -}} + {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} + {{- end -}} + {{- end -}} + + {{- if (not (empty $pullSecrets)) }} +imagePullSecrets: + {{- range $pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/_ingress.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/_ingress.tpl new file mode 100644 index 00000000..8caf73a6 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/_ingress.tpl @@ -0,0 +1,68 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Generate backend entry that is compatible with all Kubernetes API versions. + +Usage: +{{ include "common.ingress.backend" (dict "serviceName" "backendName" "servicePort" "backendPort" "context" $) }} + +Params: + - serviceName - String. Name of an existing service backend + - servicePort - String/Int. Port name (or number) of the service. It will be translated to different yaml depending if it is a string or an integer. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "common.ingress.backend" -}} +{{- $apiVersion := (include "common.capabilities.ingress.apiVersion" .context) -}} +{{- if or (eq $apiVersion "extensions/v1beta1") (eq $apiVersion "networking.k8s.io/v1beta1") -}} +serviceName: {{ .serviceName }} +servicePort: {{ .servicePort }} +{{- else -}} +service: + name: {{ .serviceName }} + port: + {{- if typeIs "string" .servicePort }} + name: {{ .servicePort }} + {{- else if or (typeIs "int" .servicePort) (typeIs "float64" .servicePort) }} + number: {{ .servicePort | int }} + {{- end }} +{{- end -}} +{{- end -}} + +{{/* +Print "true" if the API pathType field is supported +Usage: +{{ include "common.ingress.supportsPathType" . }} +*/}} +{{- define "common.ingress.supportsPathType" -}} +{{- if (semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .)) -}} +{{- print "false" -}} +{{- else -}} +{{- print "true" -}} +{{- end -}} +{{- end -}} + +{{/* +Returns true if the ingressClassname field is supported +Usage: +{{ include "common.ingress.supportsIngressClassname" . }} +*/}} +{{- define "common.ingress.supportsIngressClassname" -}} +{{- if semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "false" -}} +{{- else -}} +{{- print "true" -}} +{{- end -}} +{{- end -}} + +{{/* +Return true if cert-manager required annotations for TLS signed +certificates are set in the Ingress annotations +Ref: https://cert-manager.io/docs/usage/ingress/#supported-annotations +Usage: +{{ include "common.ingress.certManagerRequest" ( dict "annotations" .Values.path.to.the.ingress.annotations ) }} +*/}} +{{- define "common.ingress.certManagerRequest" -}} +{{ if or (hasKey .annotations "cert-manager.io/cluster-issuer") (hasKey .annotations "cert-manager.io/issuer") }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/_labels.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/_labels.tpl new file mode 100644 index 00000000..252066c7 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/_labels.tpl @@ -0,0 +1,18 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Kubernetes standard labels +*/}} +{{- define "common.labels.standard" -}} +app.kubernetes.io/name: {{ include "common.names.name" . }} +helm.sh/chart: {{ include "common.names.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector +*/}} +{{- define "common.labels.matchLabels" -}} +app.kubernetes.io/name: {{ include "common.names.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/_names.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/_names.tpl new file mode 100644 index 00000000..1bdac8b7 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/_names.tpl @@ -0,0 +1,70 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "common.names.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "common.names.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "common.names.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create a default fully qualified dependency name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +Usage: +{{ include "common.names.dependency.fullname" (dict "chartName" "dependency-chart-name" "chartValues" .Values.dependency-chart "context" $) }} +*/}} +{{- define "common.names.dependency.fullname" -}} +{{- if .chartValues.fullnameOverride -}} +{{- .chartValues.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .chartName .chartValues.nameOverride -}} +{{- if contains $name .context.Release.Name -}} +{{- .context.Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .context.Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Allow the release namespace to be overridden for multi-namespace deployments in combined charts. +*/}} +{{- define "common.names.namespace" -}} +{{- if .Values.namespaceOverride -}} +{{- .Values.namespaceOverride -}} +{{- else -}} +{{- .Release.Namespace -}} +{{- end -}} +{{- end -}} + +{{/* +Create a fully qualified app name adding the installation's namespace. +*/}} +{{- define "common.names.fullname.namespace" -}} +{{- printf "%s-%s" (include "common.names.fullname" .) (include "common.names.namespace" .) | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/_secrets.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/_secrets.tpl new file mode 100644 index 00000000..a53fb44f --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/_secrets.tpl @@ -0,0 +1,140 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Generate secret name. + +Usage: +{{ include "common.secrets.name" (dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $) }} + +Params: + - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user + to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility. + +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret + - defaultNameSuffix - String - Optional. It is used only if we have several secrets in the same deployment. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "common.secrets.name" -}} +{{- $name := (include "common.names.fullname" .context) -}} + +{{- if .defaultNameSuffix -}} +{{- $name = printf "%s-%s" $name .defaultNameSuffix | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- with .existingSecret -}} +{{- if not (typeIs "string" .) -}} +{{- with .name -}} +{{- $name = . -}} +{{- end -}} +{{- else -}} +{{- $name = . -}} +{{- end -}} +{{- end -}} + +{{- printf "%s" $name -}} +{{- end -}} + +{{/* +Generate secret key. + +Usage: +{{ include "common.secrets.key" (dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName") }} + +Params: + - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user + to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility. + +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret + - key - String - Required. Name of the key in the secret. +*/}} +{{- define "common.secrets.key" -}} +{{- $key := .key -}} + +{{- if .existingSecret -}} + {{- if not (typeIs "string" .existingSecret) -}} + {{- if .existingSecret.keyMapping -}} + {{- $key = index .existingSecret.keyMapping $.key -}} + {{- end -}} + {{- end }} +{{- end -}} + +{{- printf "%s" $key -}} +{{- end -}} + +{{/* +Generate secret password or retrieve one if already created. + +Usage: +{{ include "common.secrets.passwords.manage" (dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $) }} + +Params: + - secret - String - Required - Name of the 'Secret' resource where the password is stored. + - key - String - Required - Name of the key in the secret. + - providedValues - List - Required - The path to the validating value in the values.yaml, e.g: "mysql.password". Will pick first parameter with a defined value. + - length - int - Optional - Length of the generated random password. + - strong - Boolean - Optional - Whether to add symbols to the generated random password. + - chartName - String - Optional - Name of the chart used when said chart is deployed as a subchart. + - context - Context - Required - Parent context. + +The order in which this function returns a secret password: + 1. Already existing 'Secret' resource + (If a 'Secret' resource is found under the name provided to the 'secret' parameter to this function and that 'Secret' resource contains a key with the name passed as the 'key' parameter to this function then the value of this existing secret password will be returned) + 2. Password provided via the values.yaml + (If one of the keys passed to the 'providedValues' parameter to this function is a valid path to a key in the values.yaml and has a value, the value of the first key with a value will be returned) + 3. Randomly generated secret password + (A new random secret password with the length specified in the 'length' parameter will be generated and returned) + +*/}} +{{- define "common.secrets.passwords.manage" -}} + +{{- $password := "" }} +{{- $subchart := "" }} +{{- $chartName := default "" .chartName }} +{{- $passwordLength := default 10 .length }} +{{- $providedPasswordKey := include "common.utils.getKeyFromList" (dict "keys" .providedValues "context" $.context) }} +{{- $providedPasswordValue := include "common.utils.getValueFromKey" (dict "key" $providedPasswordKey "context" $.context) }} +{{- $secretData := (lookup "v1" "Secret" $.context.Release.Namespace .secret).data }} +{{- if $secretData }} + {{- if hasKey $secretData .key }} + {{- $password = index $secretData .key }} + {{- else }} + {{- printf "\nPASSWORDS ERROR: The secret \"%s\" does not contain the key \"%s\"\n" .secret .key | fail -}} + {{- end -}} +{{- else if $providedPasswordValue }} + {{- $password = $providedPasswordValue | toString | b64enc | quote }} +{{- else }} + + {{- if .context.Values.enabled }} + {{- $subchart = $chartName }} + {{- end -}} + + {{- $requiredPassword := dict "valueKey" $providedPasswordKey "secret" .secret "field" .key "subchart" $subchart "context" $.context -}} + {{- $requiredPasswordError := include "common.validations.values.single.empty" $requiredPassword -}} + {{- $passwordValidationErrors := list $requiredPasswordError -}} + {{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordValidationErrors "context" $.context) -}} + + {{- if .strong }} + {{- $subStr := list (lower (randAlpha 1)) (randNumeric 1) (upper (randAlpha 1)) | join "_" }} + {{- $password = randAscii $passwordLength }} + {{- $password = regexReplaceAllLiteral "\\W" $password "@" | substr 5 $passwordLength }} + {{- $password = printf "%s%s" $subStr $password | toString | shuffle | b64enc | quote }} + {{- else }} + {{- $password = randAlphaNum $passwordLength | b64enc | quote }} + {{- end }} +{{- end -}} +{{- printf "%s" $password -}} +{{- end -}} + +{{/* +Returns whether a previous generated secret already exists + +Usage: +{{ include "common.secrets.exists" (dict "secret" "secret-name" "context" $) }} + +Params: + - secret - String - Required - Name of the 'Secret' resource where the password is stored. + - context - Context - Required - Parent context. +*/}} +{{- define "common.secrets.exists" -}} +{{- $secret := (lookup "v1" "Secret" $.context.Release.Namespace .secret) }} +{{- if $secret }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/_storage.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/_storage.tpl new file mode 100644 index 00000000..60e2a844 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/_storage.tpl @@ -0,0 +1,23 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Return the proper Storage Class +{{ include "common.storage.class" ( dict "persistence" .Values.path.to.the.persistence "global" $) }} +*/}} +{{- define "common.storage.class" -}} + +{{- $storageClass := .persistence.storageClass -}} +{{- if .global -}} + {{- if .global.storageClass -}} + {{- $storageClass = .global.storageClass -}} + {{- end -}} +{{- end -}} + +{{- if $storageClass -}} + {{- if (eq "-" $storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" $storageClass -}} + {{- end -}} +{{- end -}} + +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/_tplvalues.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/_tplvalues.tpl new file mode 100644 index 00000000..2db16685 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/_tplvalues.tpl @@ -0,0 +1,13 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Renders a value that contains template. +Usage: +{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }} +*/}} +{{- define "common.tplvalues.render" -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{- else }} + {{- tpl (.value | toYaml) .context }} + {{- end }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/_utils.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/_utils.tpl new file mode 100644 index 00000000..8c22b2a3 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/_utils.tpl @@ -0,0 +1,62 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Print instructions to get a secret value. +Usage: +{{ include "common.utils.secret.getvalue" (dict "secret" "secret-name" "field" "secret-value-field" "context" $) }} +*/}} +{{- define "common.utils.secret.getvalue" -}} +{{- $varname := include "common.utils.fieldToEnvVar" . -}} +export {{ $varname }}=$(kubectl get secret --namespace {{ .context.Release.Namespace | quote }} {{ .secret }} -o jsonpath="{.data.{{ .field }}}" | base64 -d) +{{- end -}} + +{{/* +Build env var name given a field +Usage: +{{ include "common.utils.fieldToEnvVar" dict "field" "my-password" }} +*/}} +{{- define "common.utils.fieldToEnvVar" -}} + {{- $fieldNameSplit := splitList "-" .field -}} + {{- $upperCaseFieldNameSplit := list -}} + + {{- range $fieldNameSplit -}} + {{- $upperCaseFieldNameSplit = append $upperCaseFieldNameSplit ( upper . ) -}} + {{- end -}} + + {{ join "_" $upperCaseFieldNameSplit }} +{{- end -}} + +{{/* +Gets a value from .Values given +Usage: +{{ include "common.utils.getValueFromKey" (dict "key" "path.to.key" "context" $) }} +*/}} +{{- define "common.utils.getValueFromKey" -}} +{{- $splitKey := splitList "." .key -}} +{{- $value := "" -}} +{{- $latestObj := $.context.Values -}} +{{- range $splitKey -}} + {{- if not $latestObj -}} + {{- printf "please review the entire path of '%s' exists in values" $.key | fail -}} + {{- end -}} + {{- $value = ( index $latestObj . ) -}} + {{- $latestObj = $value -}} +{{- end -}} +{{- printf "%v" (default "" $value) -}} +{{- end -}} + +{{/* +Returns first .Values key with a defined value or first of the list if all non-defined +Usage: +{{ include "common.utils.getKeyFromList" (dict "keys" (list "path.to.key1" "path.to.key2") "context" $) }} +*/}} +{{- define "common.utils.getKeyFromList" -}} +{{- $key := first .keys -}} +{{- $reverseKeys := reverse .keys }} +{{- range $reverseKeys }} + {{- $value := include "common.utils.getValueFromKey" (dict "key" . "context" $.context ) }} + {{- if $value -}} + {{- $key = . }} + {{- end -}} +{{- end -}} +{{- printf "%s" $key -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/_warnings.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/_warnings.tpl new file mode 100644 index 00000000..ae10fa41 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/_warnings.tpl @@ -0,0 +1,14 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Warning about using rolling tag. +Usage: +{{ include "common.warnings.rollingTag" .Values.path.to.the.imageRoot }} +*/}} +{{- define "common.warnings.rollingTag" -}} + +{{- if and (contains "bitnami/" .repository) (not (.tag | toString | regexFind "-r\\d+$|sha256:")) }} +WARNING: Rolling tag detected ({{ .repository }}:{{ .tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment. ++info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/ +{{- end }} + +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_cassandra.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_cassandra.tpl new file mode 100644 index 00000000..ded1ae3b --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_cassandra.tpl @@ -0,0 +1,72 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate Cassandra required passwords are not empty. + +Usage: +{{ include "common.validations.values.cassandra.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where Cassandra values are stored, e.g: "cassandra-passwords-secret" + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.cassandra.passwords" -}} + {{- $existingSecret := include "common.cassandra.values.existingSecret" . -}} + {{- $enabled := include "common.cassandra.values.enabled" . -}} + {{- $dbUserPrefix := include "common.cassandra.values.key.dbUser" . -}} + {{- $valueKeyPassword := printf "%s.password" $dbUserPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "cassandra-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.cassandra.values.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.cassandra.values.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.cassandra.dbUser.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.dbUser.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled cassandra. + +Usage: +{{ include "common.cassandra.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.cassandra.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.cassandra.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key dbUser + +Usage: +{{ include "common.cassandra.values.key.dbUser" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.cassandra.values.key.dbUser" -}} + {{- if .subchart -}} + cassandra.dbUser + {{- else -}} + dbUser + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_mariadb.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_mariadb.tpl new file mode 100644 index 00000000..b6906ff7 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_mariadb.tpl @@ -0,0 +1,103 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MariaDB required passwords are not empty. + +Usage: +{{ include "common.validations.values.mariadb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MariaDB values are stored, e.g: "mysql-passwords-secret" + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mariadb.passwords" -}} + {{- $existingSecret := include "common.mariadb.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mariadb.values.enabled" . -}} + {{- $architecture := include "common.mariadb.values.architecture" . -}} + {{- $authPrefix := include "common.mariadb.values.key.auth" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mariadb-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- if not (empty $valueUsername) -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mariadb-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replication") -}} + {{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mariadb-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mariadb.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mariadb.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mariadb. + +Usage: +{{ include "common.mariadb.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mariadb.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mariadb.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mariadb.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mariadb.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mariadb.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.key.auth" -}} + {{- if .subchart -}} + mariadb.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_mongodb.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_mongodb.tpl new file mode 100644 index 00000000..f820ec10 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_mongodb.tpl @@ -0,0 +1,108 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MongoDB® required passwords are not empty. + +Usage: +{{ include "common.validations.values.mongodb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MongoDB® values are stored, e.g: "mongodb-passwords-secret" + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mongodb.passwords" -}} + {{- $existingSecret := include "common.mongodb.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mongodb.values.enabled" . -}} + {{- $authPrefix := include "common.mongodb.values.key.auth" . -}} + {{- $architecture := include "common.mongodb.values.architecture" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyDatabase := printf "%s.database" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicaSetKey := printf "%s.replicaSetKey" $authPrefix -}} + {{- $valueKeyAuthEnabled := printf "%s.enabled" $authPrefix -}} + + {{- $authEnabled := include "common.utils.getValueFromKey" (dict "key" $valueKeyAuthEnabled "context" .context) -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") (eq $authEnabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mongodb-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- $valueDatabase := include "common.utils.getValueFromKey" (dict "key" $valueKeyDatabase "context" .context) }} + {{- if and $valueUsername $valueDatabase -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mongodb-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replicaset") -}} + {{- $requiredReplicaSetKey := dict "valueKey" $valueKeyReplicaSetKey "secret" .secret "field" "mongodb-replica-set-key" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicaSetKey -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mongodb.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDb is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mongodb.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mongodb. + +Usage: +{{ include "common.mongodb.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mongodb.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mongodb.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mongodb.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.key.auth" -}} + {{- if .subchart -}} + mongodb.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mongodb.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mongodb.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_mysql.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_mysql.tpl new file mode 100644 index 00000000..74472a06 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_mysql.tpl @@ -0,0 +1,103 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MySQL required passwords are not empty. + +Usage: +{{ include "common.validations.values.mysql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MySQL values are stored, e.g: "mysql-passwords-secret" + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mysql.passwords" -}} + {{- $existingSecret := include "common.mysql.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mysql.values.enabled" . -}} + {{- $architecture := include "common.mysql.values.architecture" . -}} + {{- $authPrefix := include "common.mysql.values.key.auth" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mysql-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- if not (empty $valueUsername) -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mysql-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replication") -}} + {{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mysql-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mysql.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mysql.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mysql. + +Usage: +{{ include "common.mysql.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mysql.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mysql.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mysql.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mysql.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mysql.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.key.auth" -}} + {{- if .subchart -}} + mysql.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_postgresql.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_postgresql.tpl new file mode 100644 index 00000000..164ec0d0 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_postgresql.tpl @@ -0,0 +1,129 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate PostgreSQL required passwords are not empty. + +Usage: +{{ include "common.validations.values.postgresql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where postgresql values are stored, e.g: "postgresql-passwords-secret" + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.postgresql.passwords" -}} + {{- $existingSecret := include "common.postgresql.values.existingSecret" . -}} + {{- $enabled := include "common.postgresql.values.enabled" . -}} + {{- $valueKeyPostgresqlPassword := include "common.postgresql.values.key.postgressPassword" . -}} + {{- $valueKeyPostgresqlReplicationEnabled := include "common.postgresql.values.key.replicationPassword" . -}} + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + {{- $requiredPostgresqlPassword := dict "valueKey" $valueKeyPostgresqlPassword "secret" .secret "field" "postgresql-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlPassword -}} + + {{- $enabledReplication := include "common.postgresql.values.enabled.replication" . -}} + {{- if (eq $enabledReplication "true") -}} + {{- $requiredPostgresqlReplicationPassword := dict "valueKey" $valueKeyPostgresqlReplicationEnabled "secret" .secret "field" "postgresql-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to decide whether evaluate global values. + +Usage: +{{ include "common.postgresql.values.use.global" (dict "key" "key-of-global" "context" $) }} +Params: + - key - String - Required. Field to be evaluated within global, e.g: "existingSecret" +*/}} +{{- define "common.postgresql.values.use.global" -}} + {{- if .context.Values.global -}} + {{- if .context.Values.global.postgresql -}} + {{- index .context.Values.global.postgresql .key | quote -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.postgresql.values.existingSecret" (dict "context" $) }} +*/}} +{{- define "common.postgresql.values.existingSecret" -}} + {{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "existingSecret" "context" .context) -}} + + {{- if .subchart -}} + {{- default (.context.Values.postgresql.existingSecret | quote) $globalValue -}} + {{- else -}} + {{- default (.context.Values.existingSecret | quote) $globalValue -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled postgresql. + +Usage: +{{ include "common.postgresql.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.postgresql.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.postgresql.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key postgressPassword. + +Usage: +{{ include "common.postgresql.values.key.postgressPassword" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.key.postgressPassword" -}} + {{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "postgresqlUsername" "context" .context) -}} + + {{- if not $globalValue -}} + {{- if .subchart -}} + postgresql.postgresqlPassword + {{- else -}} + postgresqlPassword + {{- end -}} + {{- else -}} + global.postgresql.postgresqlPassword + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled.replication. + +Usage: +{{ include "common.postgresql.values.enabled.replication" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.enabled.replication" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.postgresql.replication.enabled -}} + {{- else -}} + {{- printf "%v" .context.Values.replication.enabled -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key replication.password. + +Usage: +{{ include "common.postgresql.values.key.replicationPassword" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.key.replicationPassword" -}} + {{- if .subchart -}} + postgresql.replication.password + {{- else -}} + replication.password + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_redis.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_redis.tpl new file mode 100644 index 00000000..dcccfc1a --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_redis.tpl @@ -0,0 +1,76 @@ + +{{/* vim: set filetype=mustache: */}} +{{/* +Validate Redis® required passwords are not empty. + +Usage: +{{ include "common.validations.values.redis.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where redis values are stored, e.g: "redis-passwords-secret" + - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.redis.passwords" -}} + {{- $enabled := include "common.redis.values.enabled" . -}} + {{- $valueKeyPrefix := include "common.redis.values.keys.prefix" . -}} + {{- $standarizedVersion := include "common.redis.values.standarized.version" . }} + + {{- $existingSecret := ternary (printf "%s%s" $valueKeyPrefix "auth.existingSecret") (printf "%s%s" $valueKeyPrefix "existingSecret") (eq $standarizedVersion "true") }} + {{- $existingSecretValue := include "common.utils.getValueFromKey" (dict "key" $existingSecret "context" .context) }} + + {{- $valueKeyRedisPassword := ternary (printf "%s%s" $valueKeyPrefix "auth.password") (printf "%s%s" $valueKeyPrefix "password") (eq $standarizedVersion "true") }} + {{- $valueKeyRedisUseAuth := ternary (printf "%s%s" $valueKeyPrefix "auth.enabled") (printf "%s%s" $valueKeyPrefix "usePassword") (eq $standarizedVersion "true") }} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $useAuth := include "common.utils.getValueFromKey" (dict "key" $valueKeyRedisUseAuth "context" .context) -}} + {{- if eq $useAuth "true" -}} + {{- $requiredRedisPassword := dict "valueKey" $valueKeyRedisPassword "secret" .secret "field" "redis-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRedisPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled redis. + +Usage: +{{ include "common.redis.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.redis.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.redis.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right prefix path for the values + +Usage: +{{ include "common.redis.values.key.prefix" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false +*/}} +{{- define "common.redis.values.keys.prefix" -}} + {{- if .subchart -}}redis.{{- else -}}{{- end -}} +{{- end -}} + +{{/* +Checks whether the redis chart's includes the standarizations (version >= 14) + +Usage: +{{ include "common.redis.values.standarized.version" (dict "context" $) }} +*/}} +{{- define "common.redis.values.standarized.version" -}} + + {{- $standarizedAuth := printf "%s%s" (include "common.redis.values.keys.prefix" .) "auth" -}} + {{- $standarizedAuthValues := include "common.utils.getValueFromKey" (dict "key" $standarizedAuth "context" .context) }} + + {{- if $standarizedAuthValues -}} + {{- true -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_validations.tpl b/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_validations.tpl new file mode 100644 index 00000000..9a814cf4 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/templates/validations/_validations.tpl @@ -0,0 +1,46 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate values must not be empty. + +Usage: +{{- $validateValueConf00 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-00") -}} +{{- $validateValueConf01 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-01") -}} +{{ include "common.validations.values.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }} + +Validate value params: + - valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password" + - secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret" + - field - String - Optional. Name of the field in the secret data, e.g: "mysql-password" +*/}} +{{- define "common.validations.values.multiple.empty" -}} + {{- range .required -}} + {{- include "common.validations.values.single.empty" (dict "valueKey" .valueKey "secret" .secret "field" .field "context" $.context) -}} + {{- end -}} +{{- end -}} + +{{/* +Validate a value must not be empty. + +Usage: +{{ include "common.validations.value.empty" (dict "valueKey" "mariadb.password" "secret" "secretName" "field" "my-password" "subchart" "subchart" "context" $) }} + +Validate value params: + - valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password" + - secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret" + - field - String - Optional. Name of the field in the secret data, e.g: "mysql-password" + - subchart - String - Optional - Name of the subchart that the validated password is part of. +*/}} +{{- define "common.validations.values.single.empty" -}} + {{- $value := include "common.utils.getValueFromKey" (dict "key" .valueKey "context" .context) }} + {{- $subchart := ternary "" (printf "%s." .subchart) (empty .subchart) }} + + {{- if not $value -}} + {{- $varname := "my-value" -}} + {{- $getCurrentValue := "" -}} + {{- if and .secret .field -}} + {{- $varname = include "common.utils.fieldToEnvVar" . -}} + {{- $getCurrentValue = printf " To get the current value:\n\n %s\n" (include "common.utils.secret.getvalue" .) -}} + {{- end -}} + {{- printf "\n '%s' must not be empty, please add '--set %s%s=$%s' to the command.%s" .valueKey $subchart .valueKey $varname $getCurrentValue -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/metrics/charts/common/values.yaml b/helm/airbyte-v1/charts/metrics/charts/common/values.yaml new file mode 100644 index 00000000..f2df68e5 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/charts/common/values.yaml @@ -0,0 +1,5 @@ +## bitnami/common +## It is required by CI/CD tools and processes. +## @skip exampleValue +## +exampleValue: common-chart diff --git a/helm/airbyte-v1/charts/metrics/templates/_helpers.tpl b/helm/airbyte-v1/charts/metrics/templates/_helpers.tpl new file mode 100644 index 00000000..9f3ccdc6 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/templates/_helpers.tpl @@ -0,0 +1,39 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Define db secret +*/}} + +{{- define "database.secret.name" -}} +{{- printf "%s-postgresql" .Release.Name }} +{{- end }} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/metrics/templates/_images.tpl b/helm/airbyte-v1/charts/metrics/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/metrics/templates/deployment.yaml b/helm/airbyte-v1/charts/metrics/templates/deployment.yaml new file mode 100644 index 00000000..d9bf336c --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/templates/deployment.yaml @@ -0,0 +1,124 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "common.names.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "airbyte.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + helm.sh/chart: {{ include "airbyte.chart" . }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.airbyte.io/fullname: {{ include "airbyte.fullname" . }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + airbyte: metrics + strategy: + type: Recreate # Needed due to volume claims + template: + metadata: + labels: + airbyte: metrics + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.podAnnotations }} + annotations: + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ .Values.global.serviceAccountName }} + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + containers: + - name: airbyte-metrics-container + image: {{ include "imageUrl" (list .Values.image $) }} + imagePullPolicy: "{{ .Values.image.pullPolicy }}" + env: + {{- if eq .Values.global.deploymentMode "oss" }} + - name: AIRBYTE_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: AIRBYTE_VERSION + - name: CONFIGS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: CONFIGS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + - name: METRIC_CLIENT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: METRIC_CLIENT + - name: OTEL_COLLECTOR_ENDPOINT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: OTEL_COLLECTOR_ENDPOINT + + {{- include "airbyte.database.envs" . | nindent 8 }} + + {{- end }} + # Values from secret + {{- if .Values.secrets }} + {{- range $k, $v := .Values.secrets }} + - name: {{ $k }} + valueFrom: + secretKeyRef: + name: metrics-secrets + key: {{ $k }} + {{- end }} + {{- end }} + + # Values from env + {{- if or .Values.env_vars .Values.global.env_vars }} + {{- range $k, $v := mergeOverwrite .Values.env_vars .Values.global.env_vars }} + - name: {{ $k }} + value: {{ $v | quote }} + {{- end }} + {{- end }} + + # Values from extraEnv for more compability(if you want to use external secret source or other stuff) + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 8 }} + {{- end }} + + {{- if .Values.resources }} + resources: + {{- toYaml .Values.resources | nindent 10 }} + {{- end }} + {{- if .Values.containerSecurityContext }} + securityContext: + {{- toYaml .Values.containerSecurityContext | nindent 10 }} + {{- end }} + {{- if .Values.extraVolumeMounts }} + volumeMounts: + {{ toYaml .Values.extraVolumeMounts | nindent 10 }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 6 }} + {{- end }} + {{- if .Values.global.extraContainers }} + {{ toYaml .Values.global.extraContainers | nindent 6 }} + {{- end }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + {{- if .Values.extraVolumes }} + {{ toYaml .Values.extraVolumes | nindent 6 }} + {{- end }} diff --git a/helm/airbyte-v1/charts/metrics/values.yaml b/helm/airbyte-v1/charts/metrics/values.yaml new file mode 100644 index 00000000..6ccaa691 --- /dev/null +++ b/helm/airbyte-v1/charts/metrics/values.yaml @@ -0,0 +1,110 @@ + +global: + # imagePullSecrets: + # - name: "" + serviceAccountName: placeholderServiceAccount + deploymentMode: oss + extraContainers: [] + database: + secretName: "" + secretValue: "" + + # Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "" + +enabled: true +## metrics.replicaCount Number of metrics-reporter replicas +replicaCount: 1 + +## metrics.image.repository The repository to use for the airbyte metrics-reporter image. +## metrics.image.pullPolicy the pull policy to use for the airbyte metrics-reporter image +## metrics.image.tag The airbyte metrics-reporter image tag. Defaults to the chart's AppVersion +image: + repository: airbyte/metrics-reporter + pullPolicy: IfNotPresent + +## metrics.podAnnotations [object] Add extra annotations to the metrics-reporter pod +## +podAnnotations: {} + +## metrics.podLabels [object] Add extra labels to the metrics-reporter pod +## +podLabels: {} + +## metrics.containerSecurityContext Security context for the container +## Examples: +## containerSecurityContext: +## runAsNonRoot: true +## runAsUser: 1000 +## readOnlyRootFilesystem: true +containerSecurityContext: {} + +## metrics-reporter app resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## We usually recommend not to specify default resources and to leave this as a conscious +## choice for the user. This also increases chances charts run on environments with little +## resources, such as Minikube. If you do want to specify resources, uncomment the following +## lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## metrics.resources.limits [object] The resources limits for the metrics-reporter container +## metrics.resources.requests [object] The requested resources for the metrics-reporter container +resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + +## metrics.nodeSelector [object] Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## metrics.tolerations [array] Tolerations for metrics-reporter pod assignment. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## metrics.affinity [object] Affinity and anti-affinity for metrics-reporter pod assignment. +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## metrics.extraEnv [array] Additional env vars for metrics-reporter pod(s). +## Example: +## +## extraEnv: +## - name: SAMPLE_ENV_VAR +## value: "key=sample-value" +extraEnv: [] + +## metrics.extraVolumeMounts [array] Additional volumeMounts for metrics-reporter container(s). +## Examples (when using `metrics.containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumeMounts: +## - name: tmpdir +## mountPath: /tmp +## +extraVolumeMounts: [] + +## metrics.extraVolumes [array] Additional volumes for metrics-reporter pod(s). +## Examples (when using `metrics.containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumes: +## - name: tmpdir +## emptyDir: {} +## +extraVolumes: [] + +extraContainers: [] + +secrets: {} + +env_vars: {} diff --git a/helm/airbyte-v1/charts/pod-sweeper/.gitignore b/helm/airbyte-v1/charts/pod-sweeper/.gitignore new file mode 100644 index 00000000..88e91e8a --- /dev/null +++ b/helm/airbyte-v1/charts/pod-sweeper/.gitignore @@ -0,0 +1,2 @@ +# Charts are downloaded at install time with `helm dep build`. +charts diff --git a/helm/airbyte-v1/charts/pod-sweeper/Chart.lock b/helm/airbyte-v1/charts/pod-sweeper/Chart.lock new file mode 100644 index 00000000..5fdb23f1 --- /dev/null +++ b/helm/airbyte-v1/charts/pod-sweeper/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2022-10-17T18:35:27.057672332Z" diff --git a/helm/airbyte-v1/charts/pod-sweeper/Chart.yaml b/helm/airbyte-v1/charts/pod-sweeper/Chart.yaml new file mode 100644 index 00000000..bc63323e --- /dev/null +++ b/helm/airbyte-v1/charts/pod-sweeper/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: Helm chart to deploy airbyte-pod-sweeper +name: pod-sweeper +type: application +version: 1.3.0 diff --git a/helm/airbyte-v1/charts/pod-sweeper/README.md b/helm/airbyte-v1/charts/pod-sweeper/README.md new file mode 100644 index 00000000..cc34eedd --- /dev/null +++ b/helm/airbyte-v1/charts/pod-sweeper/README.md @@ -0,0 +1,71 @@ +# pod-sweeper + +![Version: 0.67.17](https://img.shields.io/badge/Version-0.67.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: dev](https://img.shields.io/badge/AppVersion-dev-informational?style=flat-square) + +Helm chart to deploy airbyte-pod-sweeper + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 1.x.x | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| containerSecurityContext | object | `{}` | | +| enabled | bool | `true` | | +| extraVolumeMounts | list | `[]` | | +| extraVolumes | list | `[]` | | +| global.database.secretName | string | `""` | | +| global.database.secretValue | string | `""` | | +| global.jobs.kube.annotations | object | `{}` | | +| global.jobs.kube.main_container_image_pull_secret | string | `""` | | +| global.jobs.kube.nodeSelector | object | `{}` | | +| global.jobs.kube.tolerations | list | `[]` | | +| global.jobs.resources.limits | object | `{}` | | +| global.jobs.resources.requests | object | `{}` | | +| global.logs.accessKey.existingSecret | string | `""` | | +| global.logs.accessKey.existingSecretKey | string | `""` | | +| global.logs.accessKey.password | string | `"minio"` | | +| global.logs.gcs.bucket | string | `""` | | +| global.logs.gcs.credentials | string | `""` | | +| global.logs.gcs.credentialsJson | string | `""` | | +| global.logs.minio.enabled | bool | `true` | | +| global.logs.s3.bucket | string | `"airbyte-dev-logs"` | | +| global.logs.s3.bucketRegion | string | `""` | | +| global.logs.s3.enabled | bool | `false` | | +| global.logs.secretKey.existingSecret | string | `""` | | +| global.logs.secretKey.existingSecretKey | string | `""` | | +| global.logs.secretKey.password | string | `"minio123"` | | +| global.secretName | string | `""` | | +| global.serviceAccountName | string | `"airbyte-admin"` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"bitnami/kubectl"` | | +| image.tag | string | `"latest"` | | +| livenessProbe.enabled | bool | `true` | | +| livenessProbe.failureThreshold | int | `3` | | +| livenessProbe.initialDelaySeconds | int | `5` | | +| livenessProbe.periodSeconds | int | `30` | | +| livenessProbe.successThreshold | int | `1` | | +| livenessProbe.timeoutSeconds | int | `1` | | +| namespace | string | `""` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| readinessProbe.enabled | bool | `true` | | +| readinessProbe.failureThreshold | int | `3` | | +| readinessProbe.initialDelaySeconds | int | `5` | | +| readinessProbe.periodSeconds | int | `30` | | +| readinessProbe.successThreshold | int | `1` | | +| readinessProbe.timeoutSeconds | int | `1` | | +| replicaCount | int | `1` | | +| resources.limits | object | `{}` | | +| resources.requests | object | `{}` | | +| timeToDeletePods.running | string | `""` | | +| timeToDeletePods.succeeded | int | `120` | | +| timeToDeletePods.unsuccessful | int | `1440` | | +| tolerations | list | `[]` | | + diff --git a/helm/airbyte-v1/charts/pod-sweeper/templates/_helpers.tpl b/helm/airbyte-v1/charts/pod-sweeper/templates/_helpers.tpl new file mode 100644 index 00000000..847ec7b4 --- /dev/null +++ b/helm/airbyte-v1/charts/pod-sweeper/templates/_helpers.tpl @@ -0,0 +1,59 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "airbyte.labels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "airbyte.selectorLabels" -}} +app.kubernetes.io/name: {{ include "airbyte.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Define db secret +*/}} + +{{- define "database.secret.name" -}} +{{- printf "%s-postgresql" .Release.Name }} +{{- end }} diff --git a/helm/airbyte-v1/charts/pod-sweeper/templates/_images.tpl b/helm/airbyte-v1/charts/pod-sweeper/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/charts/pod-sweeper/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/pod-sweeper/templates/configmap.yaml b/helm/airbyte-v1/charts/pod-sweeper/templates/configmap.yaml new file mode 100644 index 00000000..96ce9350 --- /dev/null +++ b/helm/airbyte-v1/charts/pod-sweeper/templates/configmap.yaml @@ -0,0 +1,73 @@ +--- + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.names.fullname" . }}-sweep-pod-script + namespace: {{ .Values.namespace | default .Release.Namespace }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} + +data: + sweep-pod.sh: | + #!/bin/bash + get_job_pods () { + kubectl -n ${KUBE_NAMESPACE} -L airbyte -l airbyte=job-pod \ + get pods \ + -o=jsonpath='{range .items[*]} {.metadata.name} {.status.phase} {.status.conditions[0].lastTransitionTime} {.status.startTime}{"\n"}{end}' + } + delete_pod() { + printf "From status '%s' since '%s', " $2 $3 + echo "$1" | grep -v "STATUS" | awk '{print $1}' | xargs --no-run-if-empty kubectl -n ${KUBE_NAMESPACE} delete pod + } + while : + do + echo "Starting pod sweeper cycle:" + + if [ -n "${RUNNING_TTL_MINUTES}" ]; then + # Time window for running pods + RUNNING_DATE_STR=`date -d "now - ${RUNNING_TTL_MINUTES} minutes" --utc -Ins` + RUNNING_DATE=`date -d $RUNNING_DATE_STR +%s` + echo "Will sweep running pods from before ${RUNNING_DATE_STR}" + fi + + if [ -n "${SUCCEEDED_TTL_MINUTES}" ]; then + # Shorter time window for succeeded pods + SUCCESS_DATE_STR=`date -d "now - ${SUCCEEDED_TTL_MINUTES} minutes" --utc -Ins` + SUCCESS_DATE=`date -d $SUCCESS_DATE_STR +%s` + echo "Will sweep succeeded pods from before ${SUCCESS_DATE_STR}" + fi + + if [ -n "${UNSUCCESSFUL_TTL_MINUTES}" ]; then + # Longer time window for unsuccessful pods (to debug) + NON_SUCCESS_DATE_STR=`date -d "now - ${UNSUCCESSFUL_TTL_MINUTES} minutes" --utc -Ins` + NON_SUCCESS_DATE=`date -d $NON_SUCCESS_DATE_STR +%s` + echo "Will sweep unsuccessful pods from before ${NON_SUCCESS_DATE_STR}" + fi + ( + IFS=$'\n' + for POD in `get_job_pods`; do + IFS=' ' + POD_NAME=`echo $POD | cut -d " " -f 1` + POD_STATUS=`echo $POD | cut -d " " -f 2` + POD_DATE_STR=`echo $POD | cut -d " " -f 3` + POD_START_DATE_STR=`echo $POD | cut -d " " -f 4` + POD_DATE=`date -d ${POD_DATE_STR:-$POD_START_DATE_STR} '+%s'` + if [ -n "${RUNNING_TTL_MINUTES}" ] && [ "$POD_STATUS" = "Running" ]; then + if [ "$POD_DATE" -lt "$RUNNING_DATE" ]; then + delete_pod "$POD_NAME" "$POD_STATUS" "$POD_DATE_STR" + fi + elif [ -n "${SUCCEEDED_TTL_MINUTES}" ] && [ "$POD_STATUS" = "Succeeded" ]; then + if [ "$POD_DATE" -lt "$SUCCESS_DATE" ]; then + delete_pod "$POD_NAME" "$POD_STATUS" "$POD_DATE_STR" + fi + elif [ -n "${UNSUCCESSFUL_TTL_MINUTES}" ] && [ "$POD_STATUS" != "Running" ] && [ "$POD_STATUS" != "Succeeded" ]; then + if [ "$POD_DATE" -lt "$NON_SUCCESS_DATE" ]; then + delete_pod "$POD_NAME" "$POD_STATUS" "$POD_DATE_STR" + fi + fi + done + ) + echo "Completed pod sweeper cycle. Sleeping for 60 seconds..." + sleep 60 + done diff --git a/helm/airbyte-v1/charts/pod-sweeper/templates/deployment.yaml b/helm/airbyte-v1/charts/pod-sweeper/templates/deployment.yaml new file mode 100644 index 00000000..374b9a4f --- /dev/null +++ b/helm/airbyte-v1/charts/pod-sweeper/templates/deployment.yaml @@ -0,0 +1,105 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "common.names.fullname" . }} + namespace: {{ .Values.namespace | default .Release.Namespace }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} + namespace: {{ .Values.namespace | default .Release.Namespace }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "airbyte.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "airbyte.selectorLabels" . | nindent 8 }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + annotations: + checksum/sweep-pod-script: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + {{- if .Values.podAnnotations }} + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ .Values.global.serviceAccountName }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + containers: + - name: airbyte-pod-sweeper + image: {{ include "imageUrl" (list .Values.image $) }} + imagePullPolicy: "{{ .Values.image.pullPolicy }}" + env: + - name: KUBE_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: RUNNING_TTL_MINUTES + value: "{{ .Values.timeToDeletePods.running }}" + - name: SUCCEEDED_TTL_MINUTES + value: "{{ .Values.timeToDeletePods.succeeded }}" + - name: UNSUCCESSFUL_TTL_MINUTES + value: "{{ .Values.timeToDeletePods.unsuccessful }}" + {{- if .Values.containerSecurityContext }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 10 }} + {{- end }} + volumeMounts: + - mountPath: /script/sweep-pod.sh + subPath: sweep-pod.sh + name: sweep-pod-script + - mountPath: /.kube + name: kube-config + command: ["/bin/bash", "-c", /script/sweep-pod.sh] + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 10 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + exec: + command: + - /bin/sh + - -ec + - grep -aq sweep-pod.sh /proc/1/cmdline + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + exec: + command: + - /bin/sh + - -ec + - grep -aq sweep-pod.sh /proc/1/cmdline + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + - name: kube-config + emptyDir: {} + - name: sweep-pod-script + configMap: + name: {{ include "common.names.fullname" . }}-sweep-pod-script + defaultMode: 0755 diff --git a/helm/airbyte-v1/charts/pod-sweeper/values.yaml b/helm/airbyte-v1/charts/pod-sweeper/values.yaml new file mode 100644 index 00000000..fa4bb8a6 --- /dev/null +++ b/helm/airbyte-v1/charts/pod-sweeper/values.yaml @@ -0,0 +1,120 @@ +## global.serviceAccountName Name of service account to be associated with service +global: + serviceAccountName: &service-account-name "airbyte-admin" + # Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "" + +enabled: true +## podSweeper.image.repository The image repository to use for the pod sweeper +## podSweeper.image.pullPolicy The pull policy for the pod sweeper image +## podSweeper.image.tag The pod sweeper image tag to use +image: + repository: bitnami/kubectl + pullPolicy: IfNotPresent + tag: latest + +## podSweeper.podAnnotations [object] Add extra annotations to the podSweeper pod +## +podAnnotations: {} + +## podSweeper.podLabels [object] Add extra labels to the podSweeper pod +## +podLabels: {} + +## podSweeper.containerSecurityContext Security context for the container +## Examples: +## containerSecurityContext: +## runAsNonRoot: true +## runAsUser: 1000 +## readOnlyRootFilesystem: true +containerSecurityContext: {} + +## Configure extra options for the podSweeper containers' liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## podSweeper.livenessProbe.enabled Enable livenessProbe on the podSweeper +## podSweeper.livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe +## podSweeper.livenessProbe.periodSeconds Period seconds for livenessProbe +## podSweeper.livenessProbe.timeoutSeconds Timeout seconds for livenessProbe +## podSweeper.livenessProbe.failureThreshold Failure threshold for livenessProbe +## podSweeper.livenessProbe.successThreshold Success threshold for livenessProbe +## +livenessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 30 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## podSweeper.readinessProbe.enabled Enable readinessProbe on the podSweeper +## podSweeper.readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe +## podSweeper.readinessProbe.periodSeconds Period seconds for readinessProbe +## podSweeper.readinessProbe.timeoutSeconds Timeout seconds for readinessProbe +## podSweeper.readinessProbe.failureThreshold Failure threshold for readinessProbe +## podSweeper.readinessProbe.successThreshold Success threshold for readinessProbe +## +readinessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 30 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## Pod Sweeper app resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## We usually recommend not to specify default resources and to leave this as a conscious +## choice for the user. This also increases chances charts run on environments with little +## resources, such as Minikube. If you do want to specify resources, uncomment the following +## lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## podSweeper.resources.limits [object] The resources limits for the podSweeper container +## podSweeper.resources.requests [object] The requested resources for the podSweeper container +resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + +## podSweeper.nodeSelector [object] Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## podSweeper.tolerations [array] Tolerations for podSweeper pod assignment. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## podSweeper.affinity [object] Affinity and anti-affinity for podSweeper pod assignment. +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## Pod TTLs in minutes +## pod-sweeper will skip over pods with any status types with no TTL set (empty string) +## Pod Status docs: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-phase +## +## podSweeper.timeToDeletePods.running Time to remove pods on running status (minutes). +## podSweeper.timeToDeletePods.succeeded Time to remove pods on succeeded status (minutes). +## podSweeper.timeToDeletePods.unsuccessful Time to remove pods on neither running nor succeeded status (minutes). +timeToDeletePods: + running: "" + succeeded: 10 + ## 2 hours - generally long enough for someone trying to reproduce an error to debug. + unsuccessful: 120 + +replicaCount: 1 + +## namespace [string] namespace to deploy pod-sweeper at +namespace: "" diff --git a/helm/airbyte-v1/charts/server/.gitignore b/helm/airbyte-v1/charts/server/.gitignore new file mode 100644 index 00000000..88e91e8a --- /dev/null +++ b/helm/airbyte-v1/charts/server/.gitignore @@ -0,0 +1,2 @@ +# Charts are downloaded at install time with `helm dep build`. +charts diff --git a/helm/airbyte-v1/charts/server/Chart.lock b/helm/airbyte-v1/charts/server/Chart.lock new file mode 100644 index 00000000..746fb41b --- /dev/null +++ b/helm/airbyte-v1/charts/server/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2022-10-17T18:35:15.123937677Z" diff --git a/helm/airbyte-v1/charts/server/Chart.yaml b/helm/airbyte-v1/charts/server/Chart.yaml new file mode 100644 index 00000000..f3dbb6e0 --- /dev/null +++ b/helm/airbyte-v1/charts/server/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: Helm chart to deploy airbyte-server +name: server +type: application +version: 1.3.0 diff --git a/helm/airbyte-v1/charts/server/README.md b/helm/airbyte-v1/charts/server/README.md new file mode 100644 index 00000000..b31933fb --- /dev/null +++ b/helm/airbyte-v1/charts/server/README.md @@ -0,0 +1,68 @@ +# server + +![Version: 0.67.17](https://img.shields.io/badge/Version-0.67.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: dev](https://img.shields.io/badge/AppVersion-dev-informational?style=flat-square) + +Helm chart to deploy airbyte-server + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 1.x.x | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| containerSecurityContext | object | `{}` | | +| debug.enabled | bool | `false` | | +| debug.remoteDebugPort | int | `5005` | | +| deploymentStrategyType | string | `"Recreate"` | | +| enabled | bool | `true` | | +| env_vars | object | `{}` | | +| extraContainers | list | `[]` | | +| extraEnv | list | `[]` | | +| extraInitContainers | list | `[]` | | +| extraLabels | object | `{}` | | +| extraSelectorLabels | object | `{}` | | +| extraVolumeMounts | list | `[]` | | +| extraVolumes | list | `[]` | | +| global.configMapName | string | `""` | | +| global.credVolumeOverride | string | `""` | | +| global.database.secretName | string | `""` | | +| global.database.secretValue | string | `""` | | +| global.deploymentMode | string | `"oss"` | | +| global.edition | string | `"community"` | | +| global.extraContainers | list | `[]` | | +| global.extraLabels | object | `{}` | | +| global.extraSelectorLabels | object | `{}` | | +| global.secretName | string | `""` | | +| global.serviceAccountName | string | `"placeholderServiceAccount"` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"airbyte/server"` | | +| livenessProbe.enabled | bool | `true` | | +| livenessProbe.failureThreshold | int | `3` | | +| livenessProbe.initialDelaySeconds | int | `60` | | +| livenessProbe.periodSeconds | int | `10` | | +| livenessProbe.successThreshold | int | `1` | | +| livenessProbe.timeoutSeconds | int | `1` | | +| log.level | string | `"INFO"` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| readinessProbe.enabled | bool | `true` | | +| readinessProbe.failureThreshold | int | `3` | | +| readinessProbe.initialDelaySeconds | int | `30` | | +| readinessProbe.periodSeconds | int | `10` | | +| readinessProbe.successThreshold | int | `1` | | +| readinessProbe.timeoutSeconds | int | `1` | | +| replicaCount | int | `1` | | +| resources.limits | object | `{}` | | +| resources.requests | object | `{}` | | +| secrets | object | `{}` | | +| service.annotations | object | `{}` | | +| service.port | int | `8001` | | +| service.type | string | `"ClusterIP"` | | +| tolerations | list | `[]` | | + diff --git a/helm/airbyte-v1/charts/server/templates/_helpers.tpl b/helm/airbyte-v1/charts/server/templates/_helpers.tpl new file mode 100644 index 00000000..b8ac92f8 --- /dev/null +++ b/helm/airbyte-v1/charts/server/templates/_helpers.tpl @@ -0,0 +1,242 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "airbyte.labels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "airbyte.selectorLabels" -}} +app.kubernetes.io/name: {{ include "airbyte.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Define db secret +*/}} + +{{- define "database.secret.name" -}} +{{- printf "%s-postgresql" .Release.Name }} +{{- end }} + +## DEFAULT HELM VALUES +# Secret Manager Defaults +{{/* +Define secret persistence +*/}} +{{- define "airbyte.secretPersistence" -}} +{{- if (((.Values.global).secretsManager).type) }} + {{- printf "%s" (snakecase .Values.global.secretsManager.type) }} +{{- else }} + {{- printf "" }} +{{- end }} +{{- end }} + +{{/* +Get secret store name or default +*/}} +{{- define "airbyte.secretStoreName" -}} +{{- $secretStoreName := . -}} +{{- if $secretStoreName -}} + {{- printf "%s" $secretStoreName -}} +{{- else -}} + {{- printf "airbyte-config-secrets" -}} +{{- end -}} +{{- end -}} + +{{/* +Get awsSecretManager access key id secret key or default +*/}} +{{- define "airbyte.awsSecretManagerAccessKeyIdSecretKey" -}} +{{- $awsSecretManagerAccessKeyIdSecretKey := . -}} +{{- if $awsSecretManagerAccessKeyIdSecretKey -}} + {{- printf "%s" $awsSecretManagerAccessKeyIdSecretKey -}} +{{- else -}} + {{- printf "aws-secret-manager-access-key-id" -}} +{{- end -}} +{{- end -}} + +{{/* +Get awsSecretManager secret access key secret key or default +*/}} +{{- define "airbyte.awsSecretManagerSecretAccessKeySecretKey" -}} +{{- $awsSecretManagerSecretAccessKeySecretKey := . -}} +{{- if $awsSecretManagerSecretAccessKeySecretKey -}} + {{- printf "%s" $awsSecretManagerSecretAccessKeySecretKey -}} +{{- else -}} + {{- printf "aws-secret-manager-secret-access-key" -}} +{{- end -}} +{{- end -}} + +{{/* +Get googleSecretManager credentials secret key or default +*/}} +{{- define "airbyte.googleSecretManagerCredentialsSecretKey" -}} +{{- $googleSecretManagerCredentialsSecretKey := . -}} +{{- if $googleSecretManagerCredentialsSecretKey -}} + {{- printf "%s" $googleSecretManagerCredentialsSecretKey -}} +{{- else -}} + {{- printf "google-secret-manager-credentials" -}} +{{- end -}} +{{- end -}} + +{{/* +Get vault auth token secret key or default +*/}} +{{- define "airbyte.vaultAuthTokenSecretKey" -}} +{{- $vaultAuthTokenSecretKey := . -}} +{{- if $vaultAuthTokenSecretKey -}} + {{- printf "%s" $vaultAuthTokenSecretKey -}} +{{- else -}} + {{- printf "vault-auth-token" -}} +{{- end -}} +{{- end -}} + + +# Storage Defaults +{{/* +Get storage type or default +*/}} +{{- define "airbyte.storageType" -}} +{{- $storageType := . -}} +{{- if $storageType -}} + {{- printf "%s" $storageType -}} +{{- else -}} + {{- printf "local" -}} +{{- end -}} +{{- end -}} + +{{/* +Get storage bucket log or default +*/}} +{{- define "airbyte.storageBucketLog" -}} +{{- $storageBucketLog := . -}} +{{- if $storageBucketLog -}} + {{- printf "%s" $storageBucketLog -}} +{{- else -}} + {{- printf "airbyte-storage" -}} +{{- end -}} +{{- end -}} + +{{/* +Get storage bucket state or default +*/}} +{{- define "airbyte.storageBucketState" -}} +{{- $storageBucketState := . -}} +{{- if $storageBucketState -}} + {{- printf "%s" $storageBucketState -}} +{{- else -}} + {{- printf "airbyte-storage" -}} +{{- end -}} +{{- end -}} + +{{/* +Get storage bucket workload output or default +*/}} +{{- define "airbyte.storageBucketWorkloadOutput" -}} +{{- $storageBucketWorkloadOutput := . -}} +{{- if $storageBucketWorkloadOutput -}} + {{- printf "%s" $storageBucketWorkloadOutput -}} +{{- else -}} + {{- printf "airbyte-storage" -}} +{{- end -}} +{{- end -}} + +{{/* +Get s3 access key id secret key or default +*/}} +{{- define "airbyte.s3AccessKeyIdSecretKey" -}} +{{- $s3AccessKeyIdSecretKey := . -}} +{{- if $s3AccessKeyIdSecretKey -}} + {{- printf "%s" $s3AccessKeyIdSecretKey -}} +{{- else -}} + {{- printf "s3-access-key-id" -}} +{{- end -}} +{{- end -}} + +{{/* +Get s3 secret access key secret key or default +*/}} +{{- define "airbyte.s3SecretAccessKeySecretKey" -}} +{{- $s3SecretAccessKeySecretKey := . -}} +{{- if $s3SecretAccessKeySecretKey -}} + {{- printf "%s" $s3SecretAccessKeySecretKey -}} +{{- else -}} + {{- printf "s3-secret-access-key" -}} +{{- end -}} +{{- end -}} + +{{/* +Get minio access key id secret key or default +*/}} +{{- define "airbyte.minioAccessKeyIdSecretKey" -}} +{{- $minioAccessKeyIdSecretKey := . -}} +{{- if $minioAccessKeyIdSecretKey -}} + {{- printf "%s" $minioAccessKeyIdSecretKey -}} +{{- else -}} + {{- printf "minio-access-key-id" -}} +{{- end -}} +{{- end -}} + +{{/* +Get minio secret access key secret key or default +*/}} +{{- define "airbyte.minioSecretAccessKeySecretKey" -}} +{{- $minioSecretAccessKeySecretKey := . -}} +{{- if $minioSecretAccessKeySecretKey -}} + {{- printf "%s" $minioSecretAccessKeySecretKey -}} +{{- else -}} + {{- printf "minio-secret-access-key" -}} +{{- end -}} +{{- end -}} + +{{/* +Get gcs credentials secret key or default +*/}} +{{- define "airbyte.gcsCredentialsSecretKey" -}} +{{- $gcsCredentialsSecretKey := . -}} +{{- if $gcsCredentialsSecretKey -}} + {{- printf "%s" $gcsCredentialsSecretKey -}} +{{- else -}} + {{- printf "gcs-credentials" -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/server/templates/_images.tpl b/helm/airbyte-v1/charts/server/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/charts/server/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/server/templates/deployment.yaml b/helm/airbyte-v1/charts/server/templates/deployment.yaml new file mode 100644 index 00000000..f9a1b72e --- /dev/null +++ b/helm/airbyte-v1/charts/server/templates/deployment.yaml @@ -0,0 +1,463 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "common.names.fullname" . }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} + {{- if .Values.extraLabels }} + {{ toYaml (mergeOverwrite .Values.extraLabels .Values.global.extraLabels) | nindent 4 }} + {{- end }} +spec: + minReadySeconds: 30 + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "airbyte.selectorLabels" . | nindent 6 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 6 }} + {{- end }} + strategy: + type: {{ .Values.deploymentStrategyType }} # Needed due to volume claims + template: + metadata: + labels: + {{- include "airbyte.selectorLabels" . | nindent 8 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 8 }} + {{- end }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.podAnnotations }} + annotations: + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ .Values.global.serviceAccountName }} + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.extraInitContainers }} + initContainers: + {{- toYaml .Values.extraInitContainers | nindent 6 }} + {{- end }} + containers: + - name: airbyte-server-container + image: {{ include "imageUrl" (list .Values.image $) }} + imagePullPolicy: "{{ .Values.image.pullPolicy }}" + env: + {{- if .Values.debug.enabled }} + - name: JAVA_TOOL_OPTIONS + value: "-Xdebug -agentlib:jdwp=transport=dt_socket,address=0.0.0.0:{{ .Values.debug.remoteDebugPort }},server=y,suspend=n" + {{- end}} + {{- if or (eq .Values.global.edition "pro") (eq .Values.global.edition "enterprise") }} + - name: API_AUTHORIZATION_ENABLED + value: "true" + {{- else if and (eq .Values.global.deploymentMode "oss") .Values.global.auth.enabled }} + # Self-Managed Enterprise should always have API_AUTHORIZATION_ENABLED set to true, even + # if global.auth.enabled is not set to true. This can be simplified in the future, once + # globa.auth.enabled is changed to always default to true across all editions of Airbyte. + - name: API_AUTHORIZATION_ENABLED + value: "true" + {{- end }} + {{- if eq .Values.global.deploymentMode "oss" }} + {{- include "airbyte.logging.envs" . | nindent 8 }} + - name: AIRBYTE_API_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: AIRBYTE_API_HOST + - name: AIRBYTE_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: AIRBYTE_VERSION + - name: AIRBYTE_EDITION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: AIRBYTE_EDITION + - name: AIRBYTE_URL + valueFrom: + configMapKeyRef: + name: {{ .Values.global.configMapName | default (printf "%s-airbyte-env" .Release.Name) }} + key: AIRBYTE_URL + - name: CONFIG_ROOT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: CONFIG_ROOT + # - name: BLOTOUT_AUTH_ENDPOINT + # valueFrom: + # configMapKeyRef: + # name: {{ .Release.Name }}-airbyte-env + # key: BLOTOUT_AUTH_ENDPOINT + # - name: BLOTOUT_BASE_URL + # valueFrom: + # configMapKeyRef: + # name: {{ .Release.Name }}-airbyte-env + # key: BLOTOUT_BASE_URL + - name: MICROMETER_METRICS_ENABLED + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MICROMETER_METRICS_ENABLED + - name: MICROMETER_METRICS_STATSD_FLAVOR + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MICROMETER_METRICS_STATSD_FLAVOR + - name: MICRONAUT_ENVIRONMENTS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: SERVER_MICRONAUT_ENVIRONMENTS + - name: SEGMENT_WRITE_KEY + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: SEGMENT_WRITE_KEY + - name: STATSD_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STATSD_HOST + - name: STATSD_PORT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STATSD_PORT + - name: TRACKING_STRATEGY + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TRACKING_STRATEGY + - name: WORKER_ENVIRONMENT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WORKER_ENVIRONMENT + - name: WORKSPACE_ROOT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WORKSPACE_ROOT + - name: WEBAPP_URL + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WEBAPP_URL + - name: TEMPORAL_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TEMPORAL_HOST + - name: JOB_MAIN_CONTAINER_CPU_REQUEST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_MAIN_CONTAINER_CPU_REQUEST + - name: JOB_MAIN_CONTAINER_CPU_LIMIT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_MAIN_CONTAINER_CPU_LIMIT + - name: JOB_MAIN_CONTAINER_MEMORY_REQUEST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_MAIN_CONTAINER_MEMORY_REQUEST + - name: JOB_MAIN_CONTAINER_MEMORY_LIMIT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_MAIN_CONTAINER_MEMORY_LIMIT + - name: CONFIGS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: CONFIGS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + - name: JOBS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOBS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + - name: KEYCLOAK_INTERNAL_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: KEYCLOAK_INTERNAL_HOST + {{- if or (eq .Values.global.edition "pro") (eq .Values.global.edition "enterprise") }} + - name: KEYCLOAK_ADMIN_USER + valueFrom: + secretKeyRef: + name: {{ .Values.global.secretName | default (printf "%s-airbyte-secrets" .Release.Name) }} + key: KEYCLOAK_ADMIN_USER + - name: KEYCLOAK_ADMIN_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.global.secretName | default (printf "%s-airbyte-secrets" .Release.Name) }} + key: KEYCLOAK_ADMIN_PASSWORD + {{- end }} + - name: CONNECTOR_BUILDER_SERVER_API_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: CONNECTOR_BUILDER_SERVER_API_HOST + - name: AIRBYTE_API_AUTH_HEADER_NAME + value: "X-Airbyte-Auth" + - name: AIRBYTE_API_AUTH_HEADER_VALUE + value: "Internal server" + - name: ENTERPRISE_SOURCE_STUBS_URL + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: ENTERPRISE_SOURCE_STUBS_URL + + {{- if and (eq .Values.global.edition "community") .Values.global.auth.enabled }} + # Values for Airbyte auth configurations, secrets, and credentials in Community edition + - name: AB_INSTANCE_ADMIN_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.global.auth.secretName | default "airbyte-auth-secrets" | quote }} + key: {{ .Values.global.auth.instanceAdmin.passwordSecretKey | default "instance-admin-password" | quote }} + - name: AB_INSTANCE_ADMIN_CLIENT_ID + valueFrom: + secretKeyRef: + name: {{ .Values.global.auth.secretName | default "airbyte-auth-secrets" | quote }} + key: {{ .Values.global.auth.instanceAdmin.clientIdSecretKey | default "instance-admin-client-id" | quote }} + - name: AB_INSTANCE_ADMIN_CLIENT_SECRET + valueFrom: + secretKeyRef: + name: {{ .Values.global.auth.secretName | default "airbyte-auth-secrets" | quote }} + key: {{ .Values.global.auth.instanceAdmin.clientSecretSecretKey | default "instance-admin-client-secret" | quote }} + - name: AB_JWT_SIGNATURE_SECRET + valueFrom: + secretKeyRef: + name: {{ .Values.global.auth.secretName | default "airbyte-auth-secrets" | quote }} + key: {{ .Values.global.auth.jwtSignatureSecretKey | default "jwt-signature-secret" | quote }} + - name: AB_COOKIE_SECURE + value: {{ .Values.global.auth.cookieSecureSetting | default "true" | quote }} + - name: AB_COOKIE_SAME_SITE + value: {{ .Values.global.auth.cookieSameSiteSetting | default "Strict" | quote }} + {{- end }} + + # Secrets Manager + - name: SECRET_PERSISTENCE + value: {{ include "airbyte.secretPersistence" . }} + # Values for AwsSecretsManager + {{- if eq ((((.Values.global).secretsManager).awsSecretManager).authenticationType) "credentials" }} + - name: AWS_SECRET_MANAGER_ACCESS_KEY_ID + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.awsSecretManagerAccessKeyIdSecretKey" .Values.global.secretsManager.awsSecretManager.accessKeyIdSecretKey }} + - name: AWS_SECRET_MANAGER_SECRET_ACCESS_KEY + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.awsSecretManagerSecretAccessKeySecretKey" .Values.global.secretsManager.awsSecretManager.secretAccessKeySecretKey }} + {{- end }} + {{- if ((((.Values.global).secretsManager).awsSecretManager).region) }} + - name: AWS_SECRET_MANAGER_REGION + value: {{ (((.Values.global).secretsManager).awsSecretManager).region }} + {{- end }} + {{- if ((((.Values.global).secretsManager).awsSecretManager).tags) }} + - name: AWS_SECRET_MANAGER_SECRET_TAGS + value: {{ include "airbyte.tagsToString" .Values.global.secretsManager.awsSecretManager.tags }} + {{- end }} + {{- if ((((.Values.global).secretsManager).awsSecretManager).kms) }} + - name: AWS_KMS_KEY_ARN + value: {{ ((((.Values.global).secretsManager).awsSecretManager).kms) | default "" }} + {{- end }} + + # Values for Azure Key Vault + {{- if (((.Values.global).secretsManager).azureKeyVault) }} + + - name: AB_AZURE_KEY_VAULT_VAULT_URL + value: {{ (((.Values.global).secretsManager).azureKeyVault).vaultUrl }} + + - name: AB_AZURE_KEY_VAULT_TENANT_ID + value: {{ (((.Values.global).secretsManager).azureKeyVault).tenantId }} + + - name: AB_AZURE_KEY_VAULT_CLIENT_ID + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.azureKeyVaultClientIdSecretKey" .Values.global.secretsManager.azureKeyVault.clientIdSecretKey }} + - name: AB_AZURE_KEY_VAULT_CLIENT_SECRET + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.azureKeyVaultClientSecretSecretKey" .Values.global.secretsManager.azureKeyVault.clientSecretSecretKey }} + + {{- end }} + + {{- if ((((.Values.global).secretsManager).azureKeyVault).tags) }} + - name: AB_AZURE_KEY_VAULT_TAGS + value: {{ include "airbyte.tagsToString" .Values.global.secretsManager.azureKeyVault.tags }} + {{- end }} + + # Values for googleSecretManager secrets + {{- if (((.Values.global).secretsManager).googleSecretManager) }} + - name: SECRET_STORE_GCP_PROJECT_ID + value: {{ .Values.global.secretsManager.googleSecretManager.projectId }} + - name: SECRET_STORE_GCP_CREDENTIALS + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.googleSecretManagerCredentialsSecretKey" .Values.global.secretsManager.googleSecretManager.credentialsSecretKey }} + {{- end }} + + # Values for vault secrets + {{- if (((.Values.global).secretsManager).vault) }} + - name: VAULT_ADDRESS + value: {{ (((.Values.global).secretsManager).vault).address }} + - name: VAULT_PREFIX + value: {{ (((.Values.global).secretsManager).vault).prefix }} + - name: VAULT_AUTH_TOKEN + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.vaultAuthTokenSecretKey" .Values.global.secretsManager.vault.authTokenSecretKey }} + {{- end }} + + # Storage + {{- include "airbyte.storage.envs" . | nindent 8 }} + + {{- include "airbyte.database.envs" . | nindent 8 }} + {{- include "airbyte.enterprise.instanceAdmin" . | nindent 8 }} + {{- include "airbyte.enterprise.identityProvider" . | nindent 8 }} + {{- include "airbyte.enterprise.license" . | nindent 8 }} + + {{- end }} + + # Values from secret + {{- if .Values.secrets }} + {{- range $k, $v := .Values.secrets }} + - name: {{ $k }} + valueFrom: + secretKeyRef: + name: server-secrets + key: {{ $k }} + {{- end }} + {{- end }} + + # Values from env + {{- if or .Values.env_vars .Values.global.env_vars }} + {{- range $k, $v := mergeOverwrite .Values.env_vars .Values.global.env_vars }} + - name: {{ $k }} + value: {{ $v | quote }} + {{- end }} + {{- end }} + + # Values from extraEnv for more compability(if you want to use external secret source or other stuff) + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 8 }} + {{- end }} + + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: /api/v1/health + port: http + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: /api/v1/health + port: http + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} + ports: + - name: http + containerPort: 8001 + protocol: TCP + {{- if .Values.debug.enabled }} + - name: debug + containerPort: {{ .Values.debug.remoteDebugPort }} + protocol: TCP + {{- end}} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 10 }} + {{- end }} + {{- if .Values.containerSecurityContext }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 10 }} + {{- end }} + volumeMounts: + {{- if eq (lower .Values.global.storage.type) "local" }} + - name: airbyte-storage + mountPath: /storage + {{- end }} + {{- if eq .Values.global.deploymentMode "oss" }} + {{- if eq (lower (default "" .Values.global.storage.type)) "gcs" }} + - name: gcs-log-creds-volume + mountPath: /secrets/gcs-log-creds + readOnly: true + {{- end }} + {{- if .Values.global.airbyteYml }} + - name: airbyte-yml-volume + mountPath: /app/configs/airbyte.yml + subPath: fileContents + readOnly: true + {{- end }} + {{- end }} + + {{- if .Values.extraVolumeMounts }} + {{ toYaml .Values.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.global.extraVolumeMounts }} + {{ toYaml .Values.global.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 6 }} + {{- end }} + {{- if .Values.global.extraContainers }} + {{ toYaml .Values.global.extraContainers | nindent 6 }} + {{- end }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + {{- if eq (lower .Values.global.storage.type) "local" }} + - name: airbyte-storage + persistentVolumeClaim: + claimName: airbyte-storage-pvc + {{- end }} + + {{- if eq .Values.global.deploymentMode "oss" }} + {{- if eq (lower (default "" .Values.global.storage.type)) "gcs" }} + - name: gcs-log-creds-volume + secret: + secretName: {{ ternary (printf "%s-gcs-log-creds" ( .Release.Name )) .Values.global.storage.storageSecretName (not ((.Values.global.storage).storageSecretName)) }} + {{- end }} + + {{- if .Values.global.airbyteYml }} + - name: airbyte-yml-volume + secret: + secretName: {{ .Release.Name }}-airbyte-yml + {{- end }} + {{- end }} + {{- if .Values.extraVolumes }} +{{ toYaml .Values.extraVolumes | nindent 6 }} + {{- end }} diff --git a/helm/airbyte-v1/charts/server/templates/secrets.yaml b/helm/airbyte-v1/charts/server/templates/secrets.yaml new file mode 100644 index 00000000..f0101d7a --- /dev/null +++ b/helm/airbyte-v1/charts/server/templates/secrets.yaml @@ -0,0 +1,17 @@ +# Create secrets only for the local deployment +{{- if .Values.secrets }} +apiVersion: v1 +kind: Secret +metadata: + name: server-secrets + labels: + {{- include "airbyte.labels" . | nindent 4 }} + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-1" +type: Opaque +data: + {{- range $k, $v := mergeOverwrite .Values.secrets .Values.global.secrets }} + {{ $k }}: {{ if $v }}{{ $v | b64enc }} {{else}}""{{end}} + {{- end }} +{{- end }} diff --git a/helm/airbyte-v1/charts/server/templates/service.yaml b/helm/airbyte-v1/charts/server/templates/service.yaml new file mode 100644 index 00000000..d2d8d9b9 --- /dev/null +++ b/helm/airbyte-v1/charts/server/templates/service.yaml @@ -0,0 +1,23 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: {{.Release.Name }}-airbyte-server-svc + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "airbyte.selectorLabels" . | nindent 4 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 4 }} + {{- end }} diff --git a/helm/airbyte-v1/charts/server/values.yaml b/helm/airbyte-v1/charts/server/values.yaml new file mode 100644 index 00000000..4798c10b --- /dev/null +++ b/helm/airbyte-v1/charts/server/values.yaml @@ -0,0 +1,220 @@ + +global: + serviceAccountName: placeholderServiceAccount + edition: community + deploymentMode: oss + configMapName: "" + secretName: "" + credVolumeOverride: "" + extraContainers: [] + ## extraSelectorLabels [object] - use to specify own additional selector labels for deployment + extraSelectorLabels: {} + ## extraLabels [object] - use to specify own additional labels for deployment + extraLabels: {} + database: + secretName: "" + secretValue: "" + + storage: + type: minio + + # Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "" + +enabled: true +## replicaCount Number of server replicas +replicaCount: 1 + +## image.repository The repository to use for the airbyte server image. +## image.pullPolicy the pull policy to use for the airbyte server image +## image.tag The airbyte server image tag. Defaults to the chart's AppVersion +image: + repository: airbyte/server + pullPolicy: IfNotPresent + +## podAnnotations [object] Add extra annotations to the server pod +## +podAnnotations: {} + +## podLabels [object] Add extra labels to the server pod +## +podLabels: {} + +## containerSecurityContext Security context for the container +## Examples: +## containerSecurityContext: +## runAsNonRoot: true +## runAsUser: 1000 +## readOnlyRootFilesystem: true +containerSecurityContext: {} + +## Configure extra options for the server containers' liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## livenessProbe.enabled Enable livenessProbe on the server +## livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe +## livenessProbe.periodSeconds Period seconds for livenessProbe +## livenessProbe.timeoutSeconds Timeout seconds for livenessProbe +## livenessProbe.failureThreshold Failure threshold for livenessProbe +## livenessProbe.successThreshold Success threshold for livenessProbe +## +livenessProbe: + enabled: true + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## readinessProbe.enabled Enable readinessProbe on the server +## readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe +## readinessProbe.periodSeconds Period seconds for readinessProbe +## readinessProbe.timeoutSeconds Timeout seconds for readinessProbe +## readinessProbe.failureThreshold Failure threshold for readinessProbe +## readinessProbe.successThreshold Success threshold for readinessProbe +## +readinessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## Server app resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## We usually recommend not to specify default resources and to leave this as a conscious +## choice for the user. This also increases chances charts run on environments with little +## resources, such as Minikube. If you do want to specify resources, uncomment the following +## lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## resources.limits [object] The resources limits for the server container +## resources.requests [object] The requested resources for the server container +resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + +## service.type The service type to use for the API server +## service.port The service port to expose the API server on +service: + type: ClusterIP + port: 8001 + annotations: {} + +## nodeSelector [object] Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## tolerations [array] Tolerations for server pod assignment. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## affinity [object] Affinity and anti-affinity for server pod assignment. +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## log.level The log level to log at +log: + level: "INFO" + +## extraVolumeMounts [array] Additional volumeMounts for server container(s). +## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumeMounts: +## - name: tmpdir +## mountPath: /tmp +## +extraVolumeMounts: [] + +## extraVolumes [array] Additional volumes for server pod(s). +## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumes: +## - name: tmpdir +## emptyDir: {} +## +extraVolumes: [] + +## extraContainer [array] Additional container for server pod(s) +## Example: +# extraContainers: +# - name: otel_collector +# image: somerepo/someimage:sometag +# args: [ +# "--important-args" +# ] +# ports: +# - containerPort: 443 +# volumeMounts: +# - name: volumeMountCool +# mountPath: /some/path +# readOnly: true +extraContainers: [] + +## extraInitContainers [array] Additional init containers for server pod(s) +## Example: +# extraInitContainers: +# - name: sleepy +# image: alpine +# command: ['sleep', '60'] + +extraInitContainers: [] + +## extraEnv [array] Supply extra env variables to main container using full notation +## Example: (With default env vars and values taken from generated config map) +# extraEnv: +# - name: AIRBYTE_VERSION +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: AIRBYTE_VERSION +## +extraEnv: [] +## secrets [object] Supply additional secrets to container +## Example: +## secrets: +## DATABASE_PASSWORD: strong-password +## DATABASE_USER: my-db-user +secrets: {} + +## env_vars [object] Supply extra env variables to main container using simplified notation +## Example: +# env_vars: +# AIRBYTE_VERSION: 0.40.4 + +# # Airbyte Internal Database, see https://docs.airbyte.io/operator-guides/configuring-airbyte-db +# DATABASE_HOST: airbyte-db-svc +# DATABASE_PORT: 5432 +# DATABASE_DB: airbyte +# # translate manually DATABASE_URL:jdbc:postgresql://${DATABASE_HOST}:${DATABASE_PORT/${DATABASE_DB} +# DATABASE_URL: jdbc:postgresql://airbyte-db-svc:5432/airbyte +# JOBS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION: 0.29.15.001 +# CONFIGS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION: 0.35.15.001 +env_vars: {} + + +## extraSelectorLabels [object] - use to specify own additional selector labels for deployment +extraSelectorLabels: {} +## extraLabels [object] - use to specify own additional labels for deployment +extraLabels: {} + + +## deploymentStrategyType [string] - deployment strategy type for airbyte-server deployment. +## Defaults to Recreate since the pod is using pvc +deploymentStrategyType: RollingUpdate + +debug: + enabled: false + remoteDebugPort: 5005 diff --git a/helm/airbyte-v1/charts/temporal-ui/Chart.lock b/helm/airbyte-v1/charts/temporal-ui/Chart.lock new file mode 100644 index 00000000..19b1aca9 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2024-12-09T21:57:43.35443455Z" diff --git a/helm/airbyte-v1/charts/temporal-ui/Chart.yaml b/helm/airbyte-v1/charts/temporal-ui/Chart.yaml new file mode 100644 index 00000000..9e6cdc0b --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: Helm chart to deploy airbyte-temporal-ui +name: temporal-ui +type: application +version: 1.3.0 diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/.helmignore b/helm/airbyte-v1/charts/temporal-ui/charts/common/.helmignore new file mode 100644 index 00000000..50af0317 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/.helmignore @@ -0,0 +1,22 @@ +# 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 +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/Chart.yaml b/helm/airbyte-v1/charts/temporal-ui/charts/common/Chart.yaml new file mode 100644 index 00000000..39edbb3c --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/Chart.yaml @@ -0,0 +1,23 @@ +annotations: + category: Infrastructure +apiVersion: v2 +appVersion: 1.17.1 +description: A Library Helm Chart for grouping common logic between bitnami charts. + This chart is not deployable by itself. +home: https://github.com/bitnami/charts/tree/master/bitnami/common +icon: https://bitnami.com/downloads/logos/bitnami-mark.png +keywords: +- common +- helper +- template +- function +- bitnami +maintainers: +- name: Bitnami + url: https://github.com/bitnami/charts +name: common +sources: +- https://github.com/bitnami/charts +- https://www.bitnami.com/ +type: library +version: 1.17.1 diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/README.md b/helm/airbyte-v1/charts/temporal-ui/charts/common/README.md new file mode 100644 index 00000000..a2ecd604 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/README.md @@ -0,0 +1,350 @@ +# Bitnami Common Library Chart + +A [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between bitnami charts. + +## TL;DR + +```yaml +dependencies: + - name: common + version: 1.x.x + repository: https://charts.bitnami.com/bitnami +``` + +```bash +$ helm dependency update +``` + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.names.fullname" . }} +data: + myvalue: "Hello World" +``` + +## Introduction + +This chart provides a common template helpers which can be used to develop new charts using [Helm](https://helm.sh) package manager. + +Bitnami charts can be used with [Kubeapps](https://kubeapps.dev/) for deployment and management of Helm Charts in clusters. + +## Prerequisites + +- Kubernetes 1.19+ +- Helm 3.2.0+ + +## Parameters + +The following table lists the helpers available in the library which are scoped in different sections. + +### Affinities + +| Helper identifier | Description | Expected Input | +|-------------------------------|------------------------------------------------------|------------------------------------------------| +| `common.affinities.nodes.soft` | Return a soft nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` | +| `common.affinities.nodes.hard` | Return a hard nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` | +| `common.affinities.pods.soft` | Return a soft podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` | +| `common.affinities.pods.hard` | Return a hard podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` | + +### Capabilities + +| Helper identifier | Description | Expected Input | +|------------------------------------------------|------------------------------------------------------------------------------------------------|-------------------| +| `common.capabilities.kubeVersion` | Return the target Kubernetes version (using client default if .Values.kubeVersion is not set). | `.` Chart context | +| `common.capabilities.cronjob.apiVersion` | Return the appropriate apiVersion for cronjob. | `.` Chart context | +| `common.capabilities.deployment.apiVersion` | Return the appropriate apiVersion for deployment. | `.` Chart context | +| `common.capabilities.statefulset.apiVersion` | Return the appropriate apiVersion for statefulset. | `.` Chart context | +| `common.capabilities.ingress.apiVersion` | Return the appropriate apiVersion for ingress. | `.` Chart context | +| `common.capabilities.rbac.apiVersion` | Return the appropriate apiVersion for RBAC resources. | `.` Chart context | +| `common.capabilities.crd.apiVersion` | Return the appropriate apiVersion for CRDs. | `.` Chart context | +| `common.capabilities.policy.apiVersion` | Return the appropriate apiVersion for podsecuritypolicy. | `.` Chart context | +| `common.capabilities.networkPolicy.apiVersion` | Return the appropriate apiVersion for networkpolicy. | `.` Chart context | +| `common.capabilities.apiService.apiVersion` | Return the appropriate apiVersion for APIService. | `.` Chart context | +| `common.capabilities.hpa.apiVersion` | Return the appropriate apiVersion for Horizontal Pod Autoscaler | `.` Chart context | +| `common.capabilities.supportsHelmVersion` | Returns true if the used Helm version is 3.3+ | `.` Chart context | + +### Errors + +| Helper identifier | Description | Expected Input | +|-----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| +| `common.errors.upgrade.passwords.empty` | It will ensure required passwords are given when we are upgrading a chart. If `validationErrors` is not empty it will throw an error and will stop the upgrade action. | `dict "validationErrors" (list $validationError00 $validationError01) "context" $` | + +### Images + +| Helper identifier | Description | Expected Input | +|-----------------------------|------------------------------------------------------|---------------------------------------------------------------------------------------------------------| +| `common.images.image` | Return the proper and full image name | `dict "imageRoot" .Values.path.to.the.image "global" $`, see [ImageRoot](#imageroot) for the structure. | +| `common.images.pullSecrets` | Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global` | +| `common.images.renderPullSecrets` | Return the proper Docker Image Registry Secret Names (evaluates values as templates) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $` | + +### Ingress + +| Helper identifier | Description | Expected Input | +|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.ingress.backend` | Generate a proper Ingress backend entry depending on the API version | `dict "serviceName" "foo" "servicePort" "bar"`, see the [Ingress deprecation notice](https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/) for the syntax differences | +| `common.ingress.supportsPathType` | Prints "true" if the pathType field is supported | `.` Chart context | +| `common.ingress.supportsIngressClassname` | Prints "true" if the ingressClassname field is supported | `.` Chart context | +| `common.ingress.certManagerRequest` | Prints "true" if required cert-manager annotations for TLS signed certificates are set in the Ingress annotations | `dict "annotations" .Values.path.to.the.ingress.annotations` | + +### Labels + +| Helper identifier | Description | Expected Input | +|-----------------------------|-----------------------------------------------------------------------------|-------------------| +| `common.labels.standard` | Return Kubernetes standard labels | `.` Chart context | +| `common.labels.matchLabels` | Labels to use on `deploy.spec.selector.matchLabels` and `svc.spec.selector` | `.` Chart context | + +### Names + +| Helper identifier | Description | Expected Input | +|-----------------------------------|-----------------------------------------------------------------------|-------------------| +| `common.names.name` | Expand the name of the chart or use `.Values.nameOverride` | `.` Chart context | +| `common.names.fullname` | Create a default fully qualified app name. | `.` Chart context | +| `common.names.namespace` | Allow the release namespace to be overridden | `.` Chart context | +| `common.names.fullname.namespace` | Create a fully qualified app name adding the installation's namespace | `.` Chart context | +| `common.names.chart` | Chart name plus version | `.` Chart context | + +### Secrets + +| Helper identifier | Description | Expected Input | +|---------------------------|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.secrets.name` | Generate the name of the secret. | `dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $` see [ExistingSecret](#existingsecret) for the structure. | +| `common.secrets.key` | Generate secret key. | `dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName"` see [ExistingSecret](#existingsecret) for the structure. | +| `common.passwords.manage` | Generate secret password or retrieve one if already created. | `dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $`, length, strong and chartNAme fields are optional. | +| `common.secrets.exists` | Returns whether a previous generated secret already exists. | `dict "secret" "secret-name" "context" $` | + +### Storage + +| Helper identifier | Description | Expected Input | +|-------------------------------|---------------------------------------|---------------------------------------------------------------------------------------------------------------------| +| `common.storage.class` | Return the proper Storage Class | `dict "persistence" .Values.path.to.the.persistence "global" $`, see [Persistence](#persistence) for the structure. | + +### TplValues + +| Helper identifier | Description | Expected Input | +|---------------------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.tplvalues.render` | Renders a value that contains template | `dict "value" .Values.path.to.the.Value "context" $`, value is the value should rendered as template, context frequently is the chart context `$` or `.` | + +### Utils + +| Helper identifier | Description | Expected Input | +|--------------------------------|------------------------------------------------------------------------------------------|------------------------------------------------------------------------| +| `common.utils.fieldToEnvVar` | Build environment variable name given a field. | `dict "field" "my-password"` | +| `common.utils.secret.getvalue` | Print instructions to get a secret value. | `dict "secret" "secret-name" "field" "secret-value-field" "context" $` | +| `common.utils.getValueFromKey` | Gets a value from `.Values` object given its key path | `dict "key" "path.to.key" "context" $` | +| `common.utils.getKeyFromList` | Returns first `.Values` key with a defined value or first of the list if all non-defined | `dict "keys" (list "path.to.key1" "path.to.key2") "context" $` | + +### Validations + +| Helper identifier | Description | Expected Input | +|--------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.validations.values.single.empty` | Validate a value must not be empty. | `dict "valueKey" "path.to.value" "secret" "secret.name" "field" "my-password" "subchart" "subchart" "context" $` secret, field and subchart are optional. In case they are given, the helper will generate a how to get instruction. See [ValidateValue](#validatevalue) | +| `common.validations.values.multiple.empty` | Validate a multiple values must not be empty. It returns a shared error for all the values. | `dict "required" (list $validateValueConf00 $validateValueConf01) "context" $`. See [ValidateValue](#validatevalue) | +| `common.validations.values.mariadb.passwords` | This helper will ensure required password for MariaDB are not empty. It returns a shared error for all the values. | `dict "secret" "mariadb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mariadb chart and the helper. | +| `common.validations.values.mysql.passwords` | This helper will ensure required password for MySQL are not empty. It returns a shared error for all the values. | `dict "secret" "mysql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mysql chart and the helper. | +| `common.validations.values.postgresql.passwords` | This helper will ensure required password for PostgreSQL are not empty. It returns a shared error for all the values. | `dict "secret" "postgresql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use postgresql chart and the helper. | +| `common.validations.values.redis.passwords` | This helper will ensure required password for Redis® are not empty. It returns a shared error for all the values. | `dict "secret" "redis-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use redis chart and the helper. | +| `common.validations.values.cassandra.passwords` | This helper will ensure required password for Cassandra are not empty. It returns a shared error for all the values. | `dict "secret" "cassandra-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use cassandra chart and the helper. | +| `common.validations.values.mongodb.passwords` | This helper will ensure required password for MongoDB® are not empty. It returns a shared error for all the values. | `dict "secret" "mongodb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mongodb chart and the helper. | + +### Warnings + +| Helper identifier | Description | Expected Input | +|------------------------------|----------------------------------|------------------------------------------------------------| +| `common.warnings.rollingTag` | Warning about using rolling tag. | `ImageRoot` see [ImageRoot](#imageroot) for the structure. | + +## Special input schemas + +### ImageRoot + +```yaml +registry: + type: string + description: Docker registry where the image is located + example: docker.io + +repository: + type: string + description: Repository and image name + example: bitnami/nginx + +tag: + type: string + description: image tag + example: 1.16.1-debian-10-r63 + +pullPolicy: + type: string + description: Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + +pullSecrets: + type: array + items: + type: string + description: Optionally specify an array of imagePullSecrets (evaluated as templates). + +debug: + type: boolean + description: Set to true if you would like to see extra information on logs + example: false + +## An instance would be: +# registry: docker.io +# repository: bitnami/nginx +# tag: 1.16.1-debian-10-r63 +# pullPolicy: IfNotPresent +# debug: false +``` + +### Persistence + +```yaml +enabled: + type: boolean + description: Whether enable persistence. + example: true + +storageClass: + type: string + description: Ghost data Persistent Volume Storage Class, If set to "-", storageClassName: "" which disables dynamic provisioning. + example: "-" + +accessMode: + type: string + description: Access mode for the Persistent Volume Storage. + example: ReadWriteOnce + +size: + type: string + description: Size the Persistent Volume Storage. + example: 8Gi + +path: + type: string + description: Path to be persisted. + example: /bitnami + +## An instance would be: +# enabled: true +# storageClass: "-" +# accessMode: ReadWriteOnce +# size: 8Gi +# path: /bitnami +``` + +### ExistingSecret + +```yaml +name: + type: string + description: Name of the existing secret. + example: mySecret +keyMapping: + description: Mapping between the expected key name and the name of the key in the existing secret. + type: object + +## An instance would be: +# name: mySecret +# keyMapping: +# password: myPasswordKey +``` + +#### Example of use + +When we store sensitive data for a deployment in a secret, some times we want to give to users the possibility of using theirs existing secrets. + +```yaml +# templates/secret.yaml +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.names.fullname" . }} + labels: + app: {{ include "common.names.fullname" . }} +type: Opaque +data: + password: {{ .Values.password | b64enc | quote }} + +# templates/dpl.yaml +--- +... + env: + - name: PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "common.secrets.name" (dict "existingSecret" .Values.existingSecret "context" $) }} + key: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "password") }} +... + +# values.yaml +--- +name: mySecret +keyMapping: + password: myPasswordKey +``` + +### ValidateValue + +#### NOTES.txt + +```console +{{- $validateValueConf00 := (dict "valueKey" "path.to.value00" "secret" "secretName" "field" "password-00") -}} +{{- $validateValueConf01 := (dict "valueKey" "path.to.value01" "secret" "secretName" "field" "password-01") -}} + +{{ include "common.validations.values.multiple.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }} +``` + +If we force those values to be empty we will see some alerts + +```console +$ helm install test mychart --set path.to.value00="",path.to.value01="" + 'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value: + + export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 -d) + + 'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value: + + export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 -d) +``` + +## Upgrading + +### To 1.0.0 + +[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL. + +**What changes were introduced in this major version?** + +- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field. +- Use `type: library`. [Here](https://v3.helm.sh/docs/faq/#library-chart-support) you can find more information. +- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts + +**Considerations when upgrading to this version** + +- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues +- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore +- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3 + +**Useful links** + +- https://docs.bitnami.com/tutorials/resolve-helm2-helm3-post-migration-issues/ +- https://helm.sh/docs/topics/v2_v3_migration/ +- https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/ + +## License + +Copyright © 2022 Bitnami + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_affinities.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_affinities.tpl new file mode 100644 index 00000000..2387be26 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_affinities.tpl @@ -0,0 +1,102 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Return a soft nodeAffinity definition +{{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes.soft" -}} +preferredDuringSchedulingIgnoredDuringExecution: + - preference: + matchExpressions: + - key: {{ .key }} + operator: In + values: + {{- range .values }} + - {{ . | quote }} + {{- end }} + weight: 1 +{{- end -}} + +{{/* +Return a hard nodeAffinity definition +{{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes.hard" -}} +requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: {{ .key }} + operator: In + values: + {{- range .values }} + - {{ . | quote }} + {{- end }} +{{- end -}} + +{{/* +Return a nodeAffinity definition +{{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes" -}} + {{- if eq .type "soft" }} + {{- include "common.affinities.nodes.soft" . -}} + {{- else if eq .type "hard" }} + {{- include "common.affinities.nodes.hard" . -}} + {{- end -}} +{{- end -}} + +{{/* +Return a soft podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods.soft" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}} +*/}} +{{- define "common.affinities.pods.soft" -}} +{{- $component := default "" .component -}} +{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} +preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 10 }} + {{- if not (empty $component) }} + {{ printf "app.kubernetes.io/component: %s" $component }} + {{- end }} + {{- range $key, $value := $extraMatchLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + namespaces: + - {{ include "common.names.namespace" .context | quote }} + topologyKey: kubernetes.io/hostname + weight: 1 +{{- end -}} + +{{/* +Return a hard podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods.hard" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}} +*/}} +{{- define "common.affinities.pods.hard" -}} +{{- $component := default "" .component -}} +{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} +requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 8 }} + {{- if not (empty $component) }} + {{ printf "app.kubernetes.io/component: %s" $component }} + {{- end }} + {{- range $key, $value := $extraMatchLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + namespaces: + - {{ include "common.names.namespace" .context | quote }} + topologyKey: kubernetes.io/hostname +{{- end -}} + +{{/* +Return a podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.pods" -}} + {{- if eq .type "soft" }} + {{- include "common.affinities.pods.soft" . -}} + {{- else if eq .type "hard" }} + {{- include "common.affinities.pods.hard" . -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_capabilities.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_capabilities.tpl new file mode 100644 index 00000000..9d9b7600 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_capabilities.tpl @@ -0,0 +1,154 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Return the target Kubernetes version +*/}} +{{- define "common.capabilities.kubeVersion" -}} +{{- if .Values.global }} + {{- if .Values.global.kubeVersion }} + {{- .Values.global.kubeVersion -}} + {{- else }} + {{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} + {{- end -}} +{{- else }} +{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for poddisruptionbudget. +*/}} +{{- define "common.capabilities.policy.apiVersion" -}} +{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "policy/v1beta1" -}} +{{- else -}} +{{- print "policy/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for networkpolicy. +*/}} +{{- define "common.capabilities.networkPolicy.apiVersion" -}} +{{- if semverCompare "<1.7-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for cronjob. +*/}} +{{- define "common.capabilities.cronjob.apiVersion" -}} +{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "batch/v1beta1" -}} +{{- else -}} +{{- print "batch/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for deployment. +*/}} +{{- define "common.capabilities.deployment.apiVersion" -}} +{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for statefulset. +*/}} +{{- define "common.capabilities.statefulset.apiVersion" -}} +{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apps/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for ingress. +*/}} +{{- define "common.capabilities.ingress.apiVersion" -}} +{{- if .Values.ingress -}} +{{- if .Values.ingress.apiVersion -}} +{{- .Values.ingress.apiVersion -}} +{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end }} +{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for RBAC resources. +*/}} +{{- define "common.capabilities.rbac.apiVersion" -}} +{{- if semverCompare "<1.17-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "rbac.authorization.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "rbac.authorization.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for CRDs. +*/}} +{{- define "common.capabilities.crd.apiVersion" -}} +{{- if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apiextensions.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "apiextensions.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for APIService. +*/}} +{{- define "common.capabilities.apiService.apiVersion" -}} +{{- if semverCompare "<1.10-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apiregistration.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "apiregistration.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for Horizontal Pod Autoscaler. +*/}} +{{- define "common.capabilities.hpa.apiVersion" -}} +{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .context) -}} +{{- if .beta2 -}} +{{- print "autoscaling/v2beta2" -}} +{{- else -}} +{{- print "autoscaling/v2beta1" -}} +{{- end -}} +{{- else -}} +{{- print "autoscaling/v2" -}} +{{- end -}} +{{- end -}} + +{{/* +Returns true if the used Helm version is 3.3+. +A way to check the used Helm version was not introduced until version 3.3.0 with .Capabilities.HelmVersion, which contains an additional "{}}" structure. +This check is introduced as a regexMatch instead of {{ if .Capabilities.HelmVersion }} because checking for the key HelmVersion in <3.3 results in a "interface not found" error. +**To be removed when the catalog's minimun Helm version is 3.3** +*/}} +{{- define "common.capabilities.supportsHelmVersion" -}} +{{- if regexMatch "{(v[0-9])*[^}]*}}$" (.Capabilities | toString ) }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_errors.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_errors.tpl new file mode 100644 index 00000000..a79cc2e3 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_errors.tpl @@ -0,0 +1,23 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Through error when upgrading using empty passwords values that must not be empty. + +Usage: +{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}} +{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}} +{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }} + +Required password params: + - validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error. + - context - Context - Required. Parent context. +*/}} +{{- define "common.errors.upgrade.passwords.empty" -}} + {{- $validationErrors := join "" .validationErrors -}} + {{- if and $validationErrors .context.Release.IsUpgrade -}} + {{- $errorString := "\nPASSWORDS ERROR: You must provide your current passwords when upgrading the release." -}} + {{- $errorString = print $errorString "\n Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims." -}} + {{- $errorString = print $errorString "\n Further information can be obtained at https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases" -}} + {{- $errorString = print $errorString "\n%s" -}} + {{- printf $errorString $validationErrors | fail -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_images.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_images.tpl new file mode 100644 index 00000000..42ffbc72 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_images.tpl @@ -0,0 +1,75 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Return the proper image name +{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }} +*/}} +{{- define "common.images.image" -}} +{{- $registryName := .imageRoot.registry -}} +{{- $repositoryName := .imageRoot.repository -}} +{{- $tag := .imageRoot.tag | toString -}} +{{- if .global }} + {{- if .global.imageRegistry }} + {{- $registryName = .global.imageRegistry -}} + {{- end -}} +{{- end -}} +{{- if $registryName }} +{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- else -}} +{{- printf "%s:%s" $repositoryName $tag -}} +{{- end -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) +{{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }} +*/}} +{{- define "common.images.pullSecrets" -}} + {{- $pullSecrets := list }} + + {{- if .global }} + {{- range .global.imagePullSecrets -}} + {{- $pullSecrets = append $pullSecrets . -}} + {{- end -}} + {{- end -}} + + {{- range .images -}} + {{- range .pullSecrets -}} + {{- $pullSecrets = append $pullSecrets . -}} + {{- end -}} + {{- end -}} + + {{- if (not (empty $pullSecrets)) }} +imagePullSecrets: + {{- range $pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names evaluating values as templates +{{ include "common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }} +*/}} +{{- define "common.images.renderPullSecrets" -}} + {{- $pullSecrets := list }} + {{- $context := .context }} + + {{- if $context.Values.global }} + {{- range $context.Values.global.imagePullSecrets -}} + {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} + {{- end -}} + {{- end -}} + + {{- range .images -}} + {{- range .pullSecrets -}} + {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} + {{- end -}} + {{- end -}} + + {{- if (not (empty $pullSecrets)) }} +imagePullSecrets: + {{- range $pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_ingress.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_ingress.tpl new file mode 100644 index 00000000..8caf73a6 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_ingress.tpl @@ -0,0 +1,68 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Generate backend entry that is compatible with all Kubernetes API versions. + +Usage: +{{ include "common.ingress.backend" (dict "serviceName" "backendName" "servicePort" "backendPort" "context" $) }} + +Params: + - serviceName - String. Name of an existing service backend + - servicePort - String/Int. Port name (or number) of the service. It will be translated to different yaml depending if it is a string or an integer. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "common.ingress.backend" -}} +{{- $apiVersion := (include "common.capabilities.ingress.apiVersion" .context) -}} +{{- if or (eq $apiVersion "extensions/v1beta1") (eq $apiVersion "networking.k8s.io/v1beta1") -}} +serviceName: {{ .serviceName }} +servicePort: {{ .servicePort }} +{{- else -}} +service: + name: {{ .serviceName }} + port: + {{- if typeIs "string" .servicePort }} + name: {{ .servicePort }} + {{- else if or (typeIs "int" .servicePort) (typeIs "float64" .servicePort) }} + number: {{ .servicePort | int }} + {{- end }} +{{- end -}} +{{- end -}} + +{{/* +Print "true" if the API pathType field is supported +Usage: +{{ include "common.ingress.supportsPathType" . }} +*/}} +{{- define "common.ingress.supportsPathType" -}} +{{- if (semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .)) -}} +{{- print "false" -}} +{{- else -}} +{{- print "true" -}} +{{- end -}} +{{- end -}} + +{{/* +Returns true if the ingressClassname field is supported +Usage: +{{ include "common.ingress.supportsIngressClassname" . }} +*/}} +{{- define "common.ingress.supportsIngressClassname" -}} +{{- if semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "false" -}} +{{- else -}} +{{- print "true" -}} +{{- end -}} +{{- end -}} + +{{/* +Return true if cert-manager required annotations for TLS signed +certificates are set in the Ingress annotations +Ref: https://cert-manager.io/docs/usage/ingress/#supported-annotations +Usage: +{{ include "common.ingress.certManagerRequest" ( dict "annotations" .Values.path.to.the.ingress.annotations ) }} +*/}} +{{- define "common.ingress.certManagerRequest" -}} +{{ if or (hasKey .annotations "cert-manager.io/cluster-issuer") (hasKey .annotations "cert-manager.io/issuer") }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_labels.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_labels.tpl new file mode 100644 index 00000000..252066c7 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_labels.tpl @@ -0,0 +1,18 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Kubernetes standard labels +*/}} +{{- define "common.labels.standard" -}} +app.kubernetes.io/name: {{ include "common.names.name" . }} +helm.sh/chart: {{ include "common.names.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector +*/}} +{{- define "common.labels.matchLabels" -}} +app.kubernetes.io/name: {{ include "common.names.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_names.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_names.tpl new file mode 100644 index 00000000..1bdac8b7 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_names.tpl @@ -0,0 +1,70 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "common.names.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "common.names.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "common.names.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create a default fully qualified dependency name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +Usage: +{{ include "common.names.dependency.fullname" (dict "chartName" "dependency-chart-name" "chartValues" .Values.dependency-chart "context" $) }} +*/}} +{{- define "common.names.dependency.fullname" -}} +{{- if .chartValues.fullnameOverride -}} +{{- .chartValues.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .chartName .chartValues.nameOverride -}} +{{- if contains $name .context.Release.Name -}} +{{- .context.Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .context.Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Allow the release namespace to be overridden for multi-namespace deployments in combined charts. +*/}} +{{- define "common.names.namespace" -}} +{{- if .Values.namespaceOverride -}} +{{- .Values.namespaceOverride -}} +{{- else -}} +{{- .Release.Namespace -}} +{{- end -}} +{{- end -}} + +{{/* +Create a fully qualified app name adding the installation's namespace. +*/}} +{{- define "common.names.fullname.namespace" -}} +{{- printf "%s-%s" (include "common.names.fullname" .) (include "common.names.namespace" .) | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_secrets.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_secrets.tpl new file mode 100644 index 00000000..a53fb44f --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_secrets.tpl @@ -0,0 +1,140 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Generate secret name. + +Usage: +{{ include "common.secrets.name" (dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $) }} + +Params: + - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user + to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility. + +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret + - defaultNameSuffix - String - Optional. It is used only if we have several secrets in the same deployment. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "common.secrets.name" -}} +{{- $name := (include "common.names.fullname" .context) -}} + +{{- if .defaultNameSuffix -}} +{{- $name = printf "%s-%s" $name .defaultNameSuffix | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- with .existingSecret -}} +{{- if not (typeIs "string" .) -}} +{{- with .name -}} +{{- $name = . -}} +{{- end -}} +{{- else -}} +{{- $name = . -}} +{{- end -}} +{{- end -}} + +{{- printf "%s" $name -}} +{{- end -}} + +{{/* +Generate secret key. + +Usage: +{{ include "common.secrets.key" (dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName") }} + +Params: + - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user + to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility. + +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret + - key - String - Required. Name of the key in the secret. +*/}} +{{- define "common.secrets.key" -}} +{{- $key := .key -}} + +{{- if .existingSecret -}} + {{- if not (typeIs "string" .existingSecret) -}} + {{- if .existingSecret.keyMapping -}} + {{- $key = index .existingSecret.keyMapping $.key -}} + {{- end -}} + {{- end }} +{{- end -}} + +{{- printf "%s" $key -}} +{{- end -}} + +{{/* +Generate secret password or retrieve one if already created. + +Usage: +{{ include "common.secrets.passwords.manage" (dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $) }} + +Params: + - secret - String - Required - Name of the 'Secret' resource where the password is stored. + - key - String - Required - Name of the key in the secret. + - providedValues - List - Required - The path to the validating value in the values.yaml, e.g: "mysql.password". Will pick first parameter with a defined value. + - length - int - Optional - Length of the generated random password. + - strong - Boolean - Optional - Whether to add symbols to the generated random password. + - chartName - String - Optional - Name of the chart used when said chart is deployed as a subchart. + - context - Context - Required - Parent context. + +The order in which this function returns a secret password: + 1. Already existing 'Secret' resource + (If a 'Secret' resource is found under the name provided to the 'secret' parameter to this function and that 'Secret' resource contains a key with the name passed as the 'key' parameter to this function then the value of this existing secret password will be returned) + 2. Password provided via the values.yaml + (If one of the keys passed to the 'providedValues' parameter to this function is a valid path to a key in the values.yaml and has a value, the value of the first key with a value will be returned) + 3. Randomly generated secret password + (A new random secret password with the length specified in the 'length' parameter will be generated and returned) + +*/}} +{{- define "common.secrets.passwords.manage" -}} + +{{- $password := "" }} +{{- $subchart := "" }} +{{- $chartName := default "" .chartName }} +{{- $passwordLength := default 10 .length }} +{{- $providedPasswordKey := include "common.utils.getKeyFromList" (dict "keys" .providedValues "context" $.context) }} +{{- $providedPasswordValue := include "common.utils.getValueFromKey" (dict "key" $providedPasswordKey "context" $.context) }} +{{- $secretData := (lookup "v1" "Secret" $.context.Release.Namespace .secret).data }} +{{- if $secretData }} + {{- if hasKey $secretData .key }} + {{- $password = index $secretData .key }} + {{- else }} + {{- printf "\nPASSWORDS ERROR: The secret \"%s\" does not contain the key \"%s\"\n" .secret .key | fail -}} + {{- end -}} +{{- else if $providedPasswordValue }} + {{- $password = $providedPasswordValue | toString | b64enc | quote }} +{{- else }} + + {{- if .context.Values.enabled }} + {{- $subchart = $chartName }} + {{- end -}} + + {{- $requiredPassword := dict "valueKey" $providedPasswordKey "secret" .secret "field" .key "subchart" $subchart "context" $.context -}} + {{- $requiredPasswordError := include "common.validations.values.single.empty" $requiredPassword -}} + {{- $passwordValidationErrors := list $requiredPasswordError -}} + {{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordValidationErrors "context" $.context) -}} + + {{- if .strong }} + {{- $subStr := list (lower (randAlpha 1)) (randNumeric 1) (upper (randAlpha 1)) | join "_" }} + {{- $password = randAscii $passwordLength }} + {{- $password = regexReplaceAllLiteral "\\W" $password "@" | substr 5 $passwordLength }} + {{- $password = printf "%s%s" $subStr $password | toString | shuffle | b64enc | quote }} + {{- else }} + {{- $password = randAlphaNum $passwordLength | b64enc | quote }} + {{- end }} +{{- end -}} +{{- printf "%s" $password -}} +{{- end -}} + +{{/* +Returns whether a previous generated secret already exists + +Usage: +{{ include "common.secrets.exists" (dict "secret" "secret-name" "context" $) }} + +Params: + - secret - String - Required - Name of the 'Secret' resource where the password is stored. + - context - Context - Required - Parent context. +*/}} +{{- define "common.secrets.exists" -}} +{{- $secret := (lookup "v1" "Secret" $.context.Release.Namespace .secret) }} +{{- if $secret }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_storage.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_storage.tpl new file mode 100644 index 00000000..60e2a844 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_storage.tpl @@ -0,0 +1,23 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Return the proper Storage Class +{{ include "common.storage.class" ( dict "persistence" .Values.path.to.the.persistence "global" $) }} +*/}} +{{- define "common.storage.class" -}} + +{{- $storageClass := .persistence.storageClass -}} +{{- if .global -}} + {{- if .global.storageClass -}} + {{- $storageClass = .global.storageClass -}} + {{- end -}} +{{- end -}} + +{{- if $storageClass -}} + {{- if (eq "-" $storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" $storageClass -}} + {{- end -}} +{{- end -}} + +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_tplvalues.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_tplvalues.tpl new file mode 100644 index 00000000..2db16685 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_tplvalues.tpl @@ -0,0 +1,13 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Renders a value that contains template. +Usage: +{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }} +*/}} +{{- define "common.tplvalues.render" -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{- else }} + {{- tpl (.value | toYaml) .context }} + {{- end }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_utils.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_utils.tpl new file mode 100644 index 00000000..8c22b2a3 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_utils.tpl @@ -0,0 +1,62 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Print instructions to get a secret value. +Usage: +{{ include "common.utils.secret.getvalue" (dict "secret" "secret-name" "field" "secret-value-field" "context" $) }} +*/}} +{{- define "common.utils.secret.getvalue" -}} +{{- $varname := include "common.utils.fieldToEnvVar" . -}} +export {{ $varname }}=$(kubectl get secret --namespace {{ .context.Release.Namespace | quote }} {{ .secret }} -o jsonpath="{.data.{{ .field }}}" | base64 -d) +{{- end -}} + +{{/* +Build env var name given a field +Usage: +{{ include "common.utils.fieldToEnvVar" dict "field" "my-password" }} +*/}} +{{- define "common.utils.fieldToEnvVar" -}} + {{- $fieldNameSplit := splitList "-" .field -}} + {{- $upperCaseFieldNameSplit := list -}} + + {{- range $fieldNameSplit -}} + {{- $upperCaseFieldNameSplit = append $upperCaseFieldNameSplit ( upper . ) -}} + {{- end -}} + + {{ join "_" $upperCaseFieldNameSplit }} +{{- end -}} + +{{/* +Gets a value from .Values given +Usage: +{{ include "common.utils.getValueFromKey" (dict "key" "path.to.key" "context" $) }} +*/}} +{{- define "common.utils.getValueFromKey" -}} +{{- $splitKey := splitList "." .key -}} +{{- $value := "" -}} +{{- $latestObj := $.context.Values -}} +{{- range $splitKey -}} + {{- if not $latestObj -}} + {{- printf "please review the entire path of '%s' exists in values" $.key | fail -}} + {{- end -}} + {{- $value = ( index $latestObj . ) -}} + {{- $latestObj = $value -}} +{{- end -}} +{{- printf "%v" (default "" $value) -}} +{{- end -}} + +{{/* +Returns first .Values key with a defined value or first of the list if all non-defined +Usage: +{{ include "common.utils.getKeyFromList" (dict "keys" (list "path.to.key1" "path.to.key2") "context" $) }} +*/}} +{{- define "common.utils.getKeyFromList" -}} +{{- $key := first .keys -}} +{{- $reverseKeys := reverse .keys }} +{{- range $reverseKeys }} + {{- $value := include "common.utils.getValueFromKey" (dict "key" . "context" $.context ) }} + {{- if $value -}} + {{- $key = . }} + {{- end -}} +{{- end -}} +{{- printf "%s" $key -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_warnings.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_warnings.tpl new file mode 100644 index 00000000..ae10fa41 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/_warnings.tpl @@ -0,0 +1,14 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Warning about using rolling tag. +Usage: +{{ include "common.warnings.rollingTag" .Values.path.to.the.imageRoot }} +*/}} +{{- define "common.warnings.rollingTag" -}} + +{{- if and (contains "bitnami/" .repository) (not (.tag | toString | regexFind "-r\\d+$|sha256:")) }} +WARNING: Rolling tag detected ({{ .repository }}:{{ .tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment. ++info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/ +{{- end }} + +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_cassandra.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_cassandra.tpl new file mode 100644 index 00000000..ded1ae3b --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_cassandra.tpl @@ -0,0 +1,72 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate Cassandra required passwords are not empty. + +Usage: +{{ include "common.validations.values.cassandra.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where Cassandra values are stored, e.g: "cassandra-passwords-secret" + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.cassandra.passwords" -}} + {{- $existingSecret := include "common.cassandra.values.existingSecret" . -}} + {{- $enabled := include "common.cassandra.values.enabled" . -}} + {{- $dbUserPrefix := include "common.cassandra.values.key.dbUser" . -}} + {{- $valueKeyPassword := printf "%s.password" $dbUserPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "cassandra-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.cassandra.values.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.cassandra.values.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.cassandra.dbUser.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.dbUser.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled cassandra. + +Usage: +{{ include "common.cassandra.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.cassandra.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.cassandra.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key dbUser + +Usage: +{{ include "common.cassandra.values.key.dbUser" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.cassandra.values.key.dbUser" -}} + {{- if .subchart -}} + cassandra.dbUser + {{- else -}} + dbUser + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_mariadb.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_mariadb.tpl new file mode 100644 index 00000000..b6906ff7 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_mariadb.tpl @@ -0,0 +1,103 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MariaDB required passwords are not empty. + +Usage: +{{ include "common.validations.values.mariadb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MariaDB values are stored, e.g: "mysql-passwords-secret" + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mariadb.passwords" -}} + {{- $existingSecret := include "common.mariadb.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mariadb.values.enabled" . -}} + {{- $architecture := include "common.mariadb.values.architecture" . -}} + {{- $authPrefix := include "common.mariadb.values.key.auth" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mariadb-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- if not (empty $valueUsername) -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mariadb-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replication") -}} + {{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mariadb-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mariadb.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mariadb.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mariadb. + +Usage: +{{ include "common.mariadb.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mariadb.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mariadb.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mariadb.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mariadb.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mariadb.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.key.auth" -}} + {{- if .subchart -}} + mariadb.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_mongodb.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_mongodb.tpl new file mode 100644 index 00000000..f820ec10 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_mongodb.tpl @@ -0,0 +1,108 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MongoDB® required passwords are not empty. + +Usage: +{{ include "common.validations.values.mongodb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MongoDB® values are stored, e.g: "mongodb-passwords-secret" + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mongodb.passwords" -}} + {{- $existingSecret := include "common.mongodb.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mongodb.values.enabled" . -}} + {{- $authPrefix := include "common.mongodb.values.key.auth" . -}} + {{- $architecture := include "common.mongodb.values.architecture" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyDatabase := printf "%s.database" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicaSetKey := printf "%s.replicaSetKey" $authPrefix -}} + {{- $valueKeyAuthEnabled := printf "%s.enabled" $authPrefix -}} + + {{- $authEnabled := include "common.utils.getValueFromKey" (dict "key" $valueKeyAuthEnabled "context" .context) -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") (eq $authEnabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mongodb-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- $valueDatabase := include "common.utils.getValueFromKey" (dict "key" $valueKeyDatabase "context" .context) }} + {{- if and $valueUsername $valueDatabase -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mongodb-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replicaset") -}} + {{- $requiredReplicaSetKey := dict "valueKey" $valueKeyReplicaSetKey "secret" .secret "field" "mongodb-replica-set-key" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicaSetKey -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mongodb.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDb is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mongodb.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mongodb. + +Usage: +{{ include "common.mongodb.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mongodb.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mongodb.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mongodb.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.key.auth" -}} + {{- if .subchart -}} + mongodb.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mongodb.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mongodb.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_mysql.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_mysql.tpl new file mode 100644 index 00000000..74472a06 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_mysql.tpl @@ -0,0 +1,103 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MySQL required passwords are not empty. + +Usage: +{{ include "common.validations.values.mysql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MySQL values are stored, e.g: "mysql-passwords-secret" + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mysql.passwords" -}} + {{- $existingSecret := include "common.mysql.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mysql.values.enabled" . -}} + {{- $architecture := include "common.mysql.values.architecture" . -}} + {{- $authPrefix := include "common.mysql.values.key.auth" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mysql-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- if not (empty $valueUsername) -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mysql-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replication") -}} + {{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mysql-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mysql.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mysql.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mysql. + +Usage: +{{ include "common.mysql.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mysql.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mysql.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mysql.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mysql.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mysql.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.key.auth" -}} + {{- if .subchart -}} + mysql.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_postgresql.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_postgresql.tpl new file mode 100644 index 00000000..164ec0d0 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_postgresql.tpl @@ -0,0 +1,129 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate PostgreSQL required passwords are not empty. + +Usage: +{{ include "common.validations.values.postgresql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where postgresql values are stored, e.g: "postgresql-passwords-secret" + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.postgresql.passwords" -}} + {{- $existingSecret := include "common.postgresql.values.existingSecret" . -}} + {{- $enabled := include "common.postgresql.values.enabled" . -}} + {{- $valueKeyPostgresqlPassword := include "common.postgresql.values.key.postgressPassword" . -}} + {{- $valueKeyPostgresqlReplicationEnabled := include "common.postgresql.values.key.replicationPassword" . -}} + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + {{- $requiredPostgresqlPassword := dict "valueKey" $valueKeyPostgresqlPassword "secret" .secret "field" "postgresql-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlPassword -}} + + {{- $enabledReplication := include "common.postgresql.values.enabled.replication" . -}} + {{- if (eq $enabledReplication "true") -}} + {{- $requiredPostgresqlReplicationPassword := dict "valueKey" $valueKeyPostgresqlReplicationEnabled "secret" .secret "field" "postgresql-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to decide whether evaluate global values. + +Usage: +{{ include "common.postgresql.values.use.global" (dict "key" "key-of-global" "context" $) }} +Params: + - key - String - Required. Field to be evaluated within global, e.g: "existingSecret" +*/}} +{{- define "common.postgresql.values.use.global" -}} + {{- if .context.Values.global -}} + {{- if .context.Values.global.postgresql -}} + {{- index .context.Values.global.postgresql .key | quote -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.postgresql.values.existingSecret" (dict "context" $) }} +*/}} +{{- define "common.postgresql.values.existingSecret" -}} + {{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "existingSecret" "context" .context) -}} + + {{- if .subchart -}} + {{- default (.context.Values.postgresql.existingSecret | quote) $globalValue -}} + {{- else -}} + {{- default (.context.Values.existingSecret | quote) $globalValue -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled postgresql. + +Usage: +{{ include "common.postgresql.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.postgresql.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.postgresql.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key postgressPassword. + +Usage: +{{ include "common.postgresql.values.key.postgressPassword" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.key.postgressPassword" -}} + {{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "postgresqlUsername" "context" .context) -}} + + {{- if not $globalValue -}} + {{- if .subchart -}} + postgresql.postgresqlPassword + {{- else -}} + postgresqlPassword + {{- end -}} + {{- else -}} + global.postgresql.postgresqlPassword + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled.replication. + +Usage: +{{ include "common.postgresql.values.enabled.replication" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.enabled.replication" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.postgresql.replication.enabled -}} + {{- else -}} + {{- printf "%v" .context.Values.replication.enabled -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key replication.password. + +Usage: +{{ include "common.postgresql.values.key.replicationPassword" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.key.replicationPassword" -}} + {{- if .subchart -}} + postgresql.replication.password + {{- else -}} + replication.password + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_redis.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_redis.tpl new file mode 100644 index 00000000..dcccfc1a --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_redis.tpl @@ -0,0 +1,76 @@ + +{{/* vim: set filetype=mustache: */}} +{{/* +Validate Redis® required passwords are not empty. + +Usage: +{{ include "common.validations.values.redis.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where redis values are stored, e.g: "redis-passwords-secret" + - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.redis.passwords" -}} + {{- $enabled := include "common.redis.values.enabled" . -}} + {{- $valueKeyPrefix := include "common.redis.values.keys.prefix" . -}} + {{- $standarizedVersion := include "common.redis.values.standarized.version" . }} + + {{- $existingSecret := ternary (printf "%s%s" $valueKeyPrefix "auth.existingSecret") (printf "%s%s" $valueKeyPrefix "existingSecret") (eq $standarizedVersion "true") }} + {{- $existingSecretValue := include "common.utils.getValueFromKey" (dict "key" $existingSecret "context" .context) }} + + {{- $valueKeyRedisPassword := ternary (printf "%s%s" $valueKeyPrefix "auth.password") (printf "%s%s" $valueKeyPrefix "password") (eq $standarizedVersion "true") }} + {{- $valueKeyRedisUseAuth := ternary (printf "%s%s" $valueKeyPrefix "auth.enabled") (printf "%s%s" $valueKeyPrefix "usePassword") (eq $standarizedVersion "true") }} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $useAuth := include "common.utils.getValueFromKey" (dict "key" $valueKeyRedisUseAuth "context" .context) -}} + {{- if eq $useAuth "true" -}} + {{- $requiredRedisPassword := dict "valueKey" $valueKeyRedisPassword "secret" .secret "field" "redis-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRedisPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled redis. + +Usage: +{{ include "common.redis.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.redis.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.redis.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right prefix path for the values + +Usage: +{{ include "common.redis.values.key.prefix" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false +*/}} +{{- define "common.redis.values.keys.prefix" -}} + {{- if .subchart -}}redis.{{- else -}}{{- end -}} +{{- end -}} + +{{/* +Checks whether the redis chart's includes the standarizations (version >= 14) + +Usage: +{{ include "common.redis.values.standarized.version" (dict "context" $) }} +*/}} +{{- define "common.redis.values.standarized.version" -}} + + {{- $standarizedAuth := printf "%s%s" (include "common.redis.values.keys.prefix" .) "auth" -}} + {{- $standarizedAuthValues := include "common.utils.getValueFromKey" (dict "key" $standarizedAuth "context" .context) }} + + {{- if $standarizedAuthValues -}} + {{- true -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_validations.tpl b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_validations.tpl new file mode 100644 index 00000000..9a814cf4 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/templates/validations/_validations.tpl @@ -0,0 +1,46 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate values must not be empty. + +Usage: +{{- $validateValueConf00 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-00") -}} +{{- $validateValueConf01 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-01") -}} +{{ include "common.validations.values.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }} + +Validate value params: + - valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password" + - secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret" + - field - String - Optional. Name of the field in the secret data, e.g: "mysql-password" +*/}} +{{- define "common.validations.values.multiple.empty" -}} + {{- range .required -}} + {{- include "common.validations.values.single.empty" (dict "valueKey" .valueKey "secret" .secret "field" .field "context" $.context) -}} + {{- end -}} +{{- end -}} + +{{/* +Validate a value must not be empty. + +Usage: +{{ include "common.validations.value.empty" (dict "valueKey" "mariadb.password" "secret" "secretName" "field" "my-password" "subchart" "subchart" "context" $) }} + +Validate value params: + - valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password" + - secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret" + - field - String - Optional. Name of the field in the secret data, e.g: "mysql-password" + - subchart - String - Optional - Name of the subchart that the validated password is part of. +*/}} +{{- define "common.validations.values.single.empty" -}} + {{- $value := include "common.utils.getValueFromKey" (dict "key" .valueKey "context" .context) }} + {{- $subchart := ternary "" (printf "%s." .subchart) (empty .subchart) }} + + {{- if not $value -}} + {{- $varname := "my-value" -}} + {{- $getCurrentValue := "" -}} + {{- if and .secret .field -}} + {{- $varname = include "common.utils.fieldToEnvVar" . -}} + {{- $getCurrentValue = printf " To get the current value:\n\n %s\n" (include "common.utils.secret.getvalue" .) -}} + {{- end -}} + {{- printf "\n '%s' must not be empty, please add '--set %s%s=$%s' to the command.%s" .valueKey $subchart .valueKey $varname $getCurrentValue -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/temporal-ui/charts/common/values.yaml b/helm/airbyte-v1/charts/temporal-ui/charts/common/values.yaml new file mode 100644 index 00000000..f2df68e5 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/charts/common/values.yaml @@ -0,0 +1,5 @@ +## bitnami/common +## It is required by CI/CD tools and processes. +## @skip exampleValue +## +exampleValue: common-chart diff --git a/helm/airbyte-v1/charts/temporal-ui/templates/_helpers.tpl b/helm/airbyte-v1/charts/temporal-ui/templates/_helpers.tpl new file mode 100644 index 00000000..7be7bc1a --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/templates/_helpers.tpl @@ -0,0 +1,51 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "airbyte.labels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "airbyte.selectorLabels" -}} +app.kubernetes.io/name: {{ include "airbyte.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/temporal-ui/templates/_images.tpl b/helm/airbyte-v1/charts/temporal-ui/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/temporal-ui/templates/deployment.yaml b/helm/airbyte-v1/charts/temporal-ui/templates/deployment.yaml new file mode 100644 index 00000000..06a07ea5 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/templates/deployment.yaml @@ -0,0 +1,124 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "common.names.fullname" . }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "airbyte.selectorLabels" . | nindent 6 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 6 }} + {{- end }} + template: + metadata: + labels: + {{- include "airbyte.selectorLabels" . | nindent 8 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 8 }} + {{- end }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.podAnnotations }} + annotations: + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ .Values.global.serviceAccountName }} + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.extraInitContainers }} + initContainers: + {{- toYaml .Values.extraInitContainers | nindent 6 }} + {{- end }} + containers: + - name: airbyte-temporal-ui + image: {{ include "imageUrl" (list .Values.image $) }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + # Values from env + {{- if or .Values.env_vars .Values.global.env_vars }} + {{- range $k, $v := mergeOverwrite .Values.env_vars .Values.global.env_vars }} + - name: {{ $k }} + value: {{ $v | quote }} + {{- end }} + {{- end }} + + # Values from extraEnv for more compability(if you want to use external secret source or other stuff) + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 8 }} + {{- end }} + + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: /v1/health + port: http + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: /v1/health + port: http + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} + + ports: + - name: http + containerPort: 8080 + protocol: TCP + {{- if .Values.debug.enabled }} + - name: debug + containerPort: {{ .Values.debug.remoteDebugPort }} + protocol: TCP + {{- end}} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 10 }} + {{- end }} + {{- if .Values.containerSecurityContext }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 10 }} + {{- end }} + volumeMounts: + {{- if .Values.extraVolumeMounts }} + {{ toYaml .Values.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.global.extraVolumeMounts }} + {{ toYaml .Values.global.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 6 }} + {{- end }} + {{- if .Values.global.extraContainers }} + {{ toYaml .Values.global.extraContainers | nindent 6 }} + {{- end }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + {{- if .Values.extraVolumes }} + {{ toYaml .Values.extraVolumes | nindent 6 }} + {{- end }} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/temporal-ui/templates/service.yaml b/helm/airbyte-v1/charts/temporal-ui/templates/service.yaml new file mode 100644 index 00000000..93d2c3eb --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/templates/service.yaml @@ -0,0 +1,20 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: {{.Release.Name }}-airbyte-temporal-ui-svc + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "airbyte.selectorLabels" . | nindent 4 }} diff --git a/helm/airbyte-v1/charts/temporal-ui/values.yaml b/helm/airbyte-v1/charts/temporal-ui/values.yaml new file mode 100644 index 00000000..9430941d --- /dev/null +++ b/helm/airbyte-v1/charts/temporal-ui/values.yaml @@ -0,0 +1,194 @@ +global: + serviceAccountName: placeholderServiceAccount + deploymentMode: oss + deploymentStrategyType: RollingUpdate + configMapName: "" + secretName: "" + credVolumeOverride: "" + extraContainers: [] + ## extraSelectorLabels [object] - use to specify own additional selector labels for deployment + extraSelectorLabels: {} + ## extraLabels [object] - use to specify own additional labels for deployment + extraLabels: {} + database: + secretName: "" + secretValue: "" + + # Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "" + +enabled: false +## replicaCount Number of server replicas +replicaCount: 1 + +## image.repository The repository to use for the airbyte server image. +## image.pullPolicy the pull policy to use for the airbyte server image +## image.tag The airbyte server image tag. Defaults to the chart's AppVersion +image: + repository: temporalio/ui + pullPolicy: IfNotPresent + tag: 2.30.1 + +## podAnnotations [object] Add extra annotations to the server pod +## +podAnnotations: {} + +## containerSecurityContext Security context for the container +## Examples: +## containerSecurityContext: +## runAsNonRoot: true +## runAsUser: 1000 +## readOnlyRootFilesystem: true +containerSecurityContext: {} + +## Configure extra options for the server containers' liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## livenessProbe.enabled Enable livenessProbe on the server +## livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe +## livenessProbe.periodSeconds Period seconds for livenessProbe +## livenessProbe.timeoutSeconds Timeout seconds for livenessProbe +## livenessProbe.failureThreshold Failure threshold for livenessProbe +## livenessProbe.successThreshold Success threshold for livenessProbe +## +livenessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## readinessProbe.enabled Enable readinessProbe on the server +## readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe +## readinessProbe.periodSeconds Period seconds for readinessProbe +## readinessProbe.timeoutSeconds Timeout seconds for readinessProbe +## readinessProbe.failureThreshold Failure threshold for readinessProbe +## readinessProbe.successThreshold Success threshold for readinessProbe +## +readinessProbe: + enabled: true + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## Server app resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## We usually recommend not to specify default resources and to leave this as a conscious +## choice for the user. This also increases chances charts run on environments with little +## resources, such as Minikube. If you do want to specify resources, uncomment the following +## lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## resources.limits [object] The resources limits for the server container +## resources.requests [object] The requested resources for the server container +resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + +## service.type The service type to use for the API server +## service.port The service port to expose the API server on +service: + type: NodePort + port: 80 + annotations: {} + +## nodeSelector [object] Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## tolerations [array] Tolerations for server pod assignment. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## affinity [object] Affinity and anti-affinity for server pod assignment. +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## log.level The log level to log at +log: + level: "INFO" + +## extraVolumeMounts [array] Additional volumeMounts for server container(s). +## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumeMounts: +## - name: tmpdir +## mountPath: /tmp +## +extraVolumeMounts: [] + +## extraVolumes [array] Additional volumes for server pod(s). +## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumes: +## - name: tmpdir +## emptyDir: {} +## +extraVolumes: [] + +## extraContainer [array] Additional container for server pod(s) +## Example: +# extraContainers: +# - name: otel_collector +# image: somerepo/someimage:sometag +# args: [ +# "--important-args" +# ] +# ports: +# - containerPort: 443 +# volumeMounts: +# - name: volumeMountCool +# mountPath: /some/path +# readOnly: true +extraContainers: [] + +## extraInitContainers [array] Additional init containers for server pod(s) +## Example: +# extraInitContainers: +# - name: sleepy +# image: alpine +# command: ['sleep', '60'] + +extraInitContainers: [] + +## extraEnv [array] Supply extra env variables to main container using full notation +## Example: (With default env vars and values taken from generated config map) +# extraEnv: +# - name: AIRBYTE_VERSION +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: AIRBYTE_VERSION +## +extraEnv: [] +## secrets [object] Supply additional secrets to container +## Example: +## secrets: +## DATABASE_PASSWORD: strong-password +## DATABASE_USER: my-db-user +secrets: {} + +## env_vars [object] Supply extra env variables to main container using simplified notation +## Example: +# env_vars: +# AIRBYTE_VERSION: 0.40.4 +env_vars: + TEMPORAL_ADDRESS: ab-temporal:7233 + +debug: + enabled: false + remoteDebugPort: 5005 diff --git a/helm/airbyte-v1/charts/temporal/.gitignore b/helm/airbyte-v1/charts/temporal/.gitignore new file mode 100644 index 00000000..88e91e8a --- /dev/null +++ b/helm/airbyte-v1/charts/temporal/.gitignore @@ -0,0 +1,2 @@ +# Charts are downloaded at install time with `helm dep build`. +charts diff --git a/helm/airbyte-v1/charts/temporal/Chart.lock b/helm/airbyte-v1/charts/temporal/Chart.lock new file mode 100644 index 00000000..4deb970e --- /dev/null +++ b/helm/airbyte-v1/charts/temporal/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2022-10-17T18:35:19.234598793Z" diff --git a/helm/airbyte-v1/charts/temporal/Chart.yaml b/helm/airbyte-v1/charts/temporal/Chart.yaml new file mode 100644 index 00000000..f0d84631 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: Helm chart to deploy airbyte-temporal +name: temporal +type: application +version: 1.3.0 diff --git a/helm/airbyte-v1/charts/temporal/README.md b/helm/airbyte-v1/charts/temporal/README.md new file mode 100644 index 00000000..036ddee1 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal/README.md @@ -0,0 +1,62 @@ +# temporal + +![Version: 0.67.17](https://img.shields.io/badge/Version-0.67.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: dev](https://img.shields.io/badge/AppVersion-dev-informational?style=flat-square) + +Helm chart to deploy airbyte-temporal + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 1.x.x | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| containerSecurityContext | object | `{}` | | +| enabled | bool | `true` | | +| env_vars | object | `{}` | | +| extraContainers | list | `[]` | | +| extraEnv | list | `[]` | | +| extraInitContainers | list | `[]` | | +| extraLabels | object | `{}` | | +| extraSelectorLabels | object | `{}` | | +| extraVolumeMounts | list | `[]` | | +| extraVolumes | list | `[]` | | +| global.configMapName | string | `""` | | +| global.database.secretName | string | `""` | | +| global.database.secretValue | string | `""` | | +| global.deploymentMode | string | `"oss"` | | +| global.extraContainers | list | `[]` | | +| global.extraLabels | object | `{}` | | +| global.extraSelectorLabels | object | `{}` | | +| global.secretName | string | `""` | | +| global.serviceAccountName | string | `"placeholderServiceAccount"` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"temporalio/auto-setup"` | | +| image.tag | string | `"1.23.0"` | | +| livenessProbe.enabled | bool | `true` | | +| livenessProbe.failureThreshold | int | `3` | | +| livenessProbe.initialDelaySeconds | int | `5` | | +| livenessProbe.periodSeconds | int | `30` | | +| livenessProbe.successThreshold | int | `1` | | +| livenessProbe.timeoutSeconds | int | `1` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| readinessProbe.enabled | bool | `true` | | +| readinessProbe.failureThreshold | int | `3` | | +| readinessProbe.initialDelaySeconds | int | `5` | | +| readinessProbe.periodSeconds | int | `30` | | +| readinessProbe.successThreshold | int | `1` | | +| readinessProbe.timeoutSeconds | int | `1` | | +| replicaCount | int | `1` | | +| resources.limits | object | `{}` | | +| resources.requests | object | `{}` | | +| secrets | object | `{}` | | +| service.port | int | `7233` | | +| service.type | string | `"ClusterIP"` | | +| tolerations | list | `[]` | | + diff --git a/helm/airbyte-v1/charts/temporal/templates/_helpers.tpl b/helm/airbyte-v1/charts/temporal/templates/_helpers.tpl new file mode 100644 index 00000000..847ec7b4 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal/templates/_helpers.tpl @@ -0,0 +1,59 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "airbyte.labels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "airbyte.selectorLabels" -}} +app.kubernetes.io/name: {{ include "airbyte.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Define db secret +*/}} + +{{- define "database.secret.name" -}} +{{- printf "%s-postgresql" .Release.Name }} +{{- end }} diff --git a/helm/airbyte-v1/charts/temporal/templates/_images.tpl b/helm/airbyte-v1/charts/temporal/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/temporal/templates/configmap.yaml b/helm/airbyte-v1/charts/temporal/templates/configmap.yaml new file mode 100644 index 00000000..5f4b89fe --- /dev/null +++ b/helm/airbyte-v1/charts/temporal/templates/configmap.yaml @@ -0,0 +1,54 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.names.fullname" . }}-dynamicconfig + labels: + {{- include "airbyte.labels" . | nindent 4 }} +data: + "development.yaml": | + # when modifying, remember to update the docker-compose version of this file in temporal/dynamicconfig/development.yaml + frontend.enableClientVersionCheck: + - value: true + constraints: {} + history.persistenceMaxQPS: + - value: 3000 + constraints: {} + frontend.persistenceMaxQPS: + - value: 3000 + constraints: {} + frontend.historyMgrNumConns: + - value: 30 + constraints: {} + frontend.throttledLogRPS: + - value: 20 + constraints: {} + frontend.enableUpdateWorkflowExecution: + - value: true + frontend.enableUpdateWorkflowExecutionAsyncAccepted: + - value: true + history.historyMgrNumConns: + - value: 50 + constraints: {} + system.advancedVisibilityWritingMode: + - value: "off" + constraints: {} + history.defaultActivityRetryPolicy: + - value: + InitialIntervalInSeconds: 1 + MaximumIntervalCoefficient: 100.0 + BackoffCoefficient: 2.0 + MaximumAttempts: 0 + history.defaultWorkflowRetryPolicy: + - value: + InitialIntervalInSeconds: 1 + MaximumIntervalCoefficient: 100.0 + BackoffCoefficient: 2.0 + MaximumAttempts: 0 + # Limit for responses. This mostly impacts discovery jobs since they have the largest responses. + limit.blobSize.error: + - value: 15728640 # 15MB + constraints: {} + limit.blobSize.warn: + - value: 10485760 # 10MB + constraints: {} diff --git a/helm/airbyte-v1/charts/temporal/templates/deployment.yaml b/helm/airbyte-v1/charts/temporal/templates/deployment.yaml new file mode 100644 index 00000000..8db977aa --- /dev/null +++ b/helm/airbyte-v1/charts/temporal/templates/deployment.yaml @@ -0,0 +1,160 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "common.names.fullname" . }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} + {{- if .Values.extraLabels }} + {{ toYaml (mergeOverwrite .Values.extraLabels .Values.global.extraLabels) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "airbyte.selectorLabels" . | nindent 6 }} + {{- if .Values.extraLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 4 }} + {{- end }} + template: + metadata: + labels: + {{- include "airbyte.selectorLabels" . | nindent 8 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 8 }} + {{- end }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.podAnnotations }} + annotations: + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ .Values.global.serviceAccountName }} + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} +{{- if .Values.extraInitContainers }} + initContainers: +{{- toYaml .Values.extraInitContainers | nindent 6 }} +{{- end }} + containers: + - name: airbyte-temporal + image: {{ include "imageUrl" (list .Values.image $) }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- if eq .Values.global.deploymentMode "oss"}} + - name: AUTO_SETUP + value: "true" + - name: DB # The DB engine to use + value: "postgresql" + - name: DYNAMIC_CONFIG_FILE_PATH + value: "config/dynamicconfig/development.yaml" + + {{- include "airbyte.temporal.database.envs" . | nindent 10 }} + + {{- end }} + + {{- if eq .Values.global.database.type "external" }} + # Assume an external database requires SSL. + - name: POSTGRES_TLS_ENABLED + value: "true" + - name: POSTGRES_TLS_DISABLE_HOST_VERIFICATION + value: "true" + - name: SQL_TLS_ENABLED + value: "true" + - name: SQL_TLS_DISABLE_HOST_VERIFICATION + value: "true" + {{- end }} + + {{- if .Values.extraEnv }} + {{ .Values.extraEnv | toYaml | nindent 10 }} + {{- end }} + # Values from secret + {{- if .Values.secrets }} + {{- range $k, $v := .Values.secrets }} + - name: {{ $k }} + valueFrom: + secretKeyRef: + name: temporal-secrets + key: {{ $k }} + {{- end }} + {{- end }} + + # Values from env + {{- if or .Values.env_vars .Values.global.env_vars }} + {{- range $k, $v := mergeOverwrite .Values.env_vars .Values.global.env_vars }} + - name: {{ $k }} + value: {{ $v | quote }} + {{- end }} + {{- end }} + ports: + - containerPort: 7233 + {{- if .Values.containerSecurityContext }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 10 }} + {{- end }} + volumeMounts: + - name: airbyte-temporal-dynamicconfig + mountPath: "/etc/temporal/config/dynamicconfig/" + {{- if .Values.extraVolumeMounts }} + {{ toYaml .Values.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 10 }} + {{- end }} + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + exec: + command: + - /bin/sh + - -ec + - 'test $(ps -ef | grep -v grep | grep temporal-server | wc -l) -eq 1' + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + exec: + command: + - /bin/sh + - -ec + - 'test $(ps -ef | grep -v grep | grep temporal-server | wc -l) -eq 1' + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 6 }} + {{- end }} + {{- if .Values.global.extraContainers }} + {{ toYaml .Values.global.extraContainers | nindent 6 }} + {{- end }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + - name: airbyte-temporal-dynamicconfig + configMap: + name: {{ include "common.names.fullname" . }}-dynamicconfig + items: + - key: development.yaml + path: development.yaml + {{- if .Values.extraVolumes }} + {{ toYaml .Values.extraVolumes | nindent 6 }} + {{- end }} diff --git a/helm/airbyte-v1/charts/temporal/templates/secrets.yaml b/helm/airbyte-v1/charts/temporal/templates/secrets.yaml new file mode 100644 index 00000000..f77d1ff1 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal/templates/secrets.yaml @@ -0,0 +1,17 @@ +# Create secrets only for the local deployment +{{- if .Values.secrets }} +apiVersion: v1 +kind: Secret +metadata: + name: temporal-secrets + labels: + {{- include "airbyte.labels" . | nindent 4 }} + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-1" +type: Opaque +data: + {{- range $k, $v := mergeOverwrite .Values.secrets .Values.global.secrets }} + {{ $k }}: {{ if $v }}{{ $v | b64enc }} {{else}}""{{end}} + {{- end }} +{{- end }} diff --git a/helm/airbyte-v1/charts/temporal/templates/service.yaml b/helm/airbyte-v1/charts/temporal/templates/service.yaml new file mode 100644 index 00000000..39f13632 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal/templates/service.yaml @@ -0,0 +1,18 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-temporal + labels: + {{- include "airbyte.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + protocol: TCP + targetPort: 7233 + selector: + {{- include "airbyte.selectorLabels" . | nindent 4 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 4 }} + {{- end }} diff --git a/helm/airbyte-v1/charts/temporal/values.yaml b/helm/airbyte-v1/charts/temporal/values.yaml new file mode 100644 index 00000000..64f90af2 --- /dev/null +++ b/helm/airbyte-v1/charts/temporal/values.yaml @@ -0,0 +1,193 @@ +global: + serviceAccountName: placeholderServiceAccount + deploymentMode: oss + configMapName: "" + secretName: "" + extraContainers: [] + ## extraSelectorLabels [object] - use to specify own additional selector labels for deployment + extraSelectorLabels: {} + ## extraLabels [object] - use to specify own additional labels for deployment + extraLabels: {} + database: + type: internal + secretName: "" + secretValue: "" + + # Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "" + +enabled: true +## temporal.replicaCount The number of temporal replicas to deploy +replicaCount: 1 + +## temporal.image.repository The temporal image repository to use +## temporal.image.pullPolicy The pull policy for the temporal image +## temporal.image.tag The temporal image tag to use +image: + repository: temporalio/auto-setup + pullPolicy: IfNotPresent + tag: "1.23.0" + +## temporal.service.type The Kubernetes Service Type +## temporal.service.port The temporal port and exposed kubernetes port +service: + type: ClusterIP + port: 7233 + +## temporal.podAnnotations [object] Add extra annotations to the temporal pod +## +podAnnotations: {} + +## temporal.podLabels [object] Add extra labels to the temporal pod +## +podLabels: {} + +## temporal.containerSecurityContext Security context for the container +## Examples: +## containerSecurityContext: +## runAsNonRoot: true +## runAsUser: 1000 +## readOnlyRootFilesystem: true +containerSecurityContext: {} + +## temporal.extraInitContainers Additional InitContainers to initialize the pod +## Examples (when using `temporal.containerSecurityContext.readOnlyRootFilesystem=true`): +## extraInitContainers: +## - name: config-loader +## image: temporalio/auto-setup:1.23 +## command: +## - /bin/sh +## - -c +## - >- +## find /etc/temporal/config/ -maxdepth 1 -mindepth 1 -exec cp -ar {} /config/ \; +## volumeMounts: +## - name: config +## mountPath: /config +extraInitContainers: [] + +## Configure extra options for the temporal containers' liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## temporal.livenessProbe.enabled Enable livenessProbe on the temporal +## temporal.livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe +## temporal.livenessProbe.periodSeconds Period seconds for livenessProbe +## temporal.livenessProbe.timeoutSeconds Timeout seconds for livenessProbe +## temporal.livenessProbe.failureThreshold Failure threshold for livenessProbe +## temporal.livenessProbe.successThreshold Success threshold for livenessProbe +## +livenessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 30 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## temporal.readinessProbe.enabled Enable readinessProbe on the temporal +## temporal.readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe +## temporal.readinessProbe.periodSeconds Period seconds for readinessProbe +## temporal.readinessProbe.timeoutSeconds Timeout seconds for readinessProbe +## temporal.readinessProbe.failureThreshold Failure threshold for readinessProbe +## temporal.readinessProbe.successThreshold Success threshold for readinessProbe +## +readinessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 30 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## temporal.nodeSelector [object] Node labels for temporal pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## temporal.tolerations [array] Tolerations for temporal pod assignment. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## temporal.affinity [object] Affinity and anti-affinity for temporal pod assignment. +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## temporal.extraEnv [array] Additional env vars for temporal pod(s). +## Example: +## +## extraEnv: +## - name: SAMPLE_ENV_VAR +## value: "key=sample-value" +extraEnv: [] + +## temporal.extraVolumeMounts [array] Additional volumeMounts for temporal container(s). +## Examples (when using `temporal.containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumeMounts: +## - name: tmpdir +## mountPath: /tmp +## - name: config +## mountPath: /etc/temporal/config +## +extraVolumeMounts: [] + +## temporal.extraVolumes [array] Additional volumes for temporal pod(s). +## Examples (when using `temporal.containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumes: +## - name: tmpdir +## emptyDir: {} +## - name: config +## emptyDir: {} +## +extraVolumes: [] + +## Temporal resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## We usually recommend not to specify default resources and to leave this as a conscious +## choice for the user. This also increases chances charts run on environments with little +## resources, such as Minikube. If you do want to specify resources, uncomment the following +## lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## temporal.resources.limits [object] The resources limits for temporal pod(s) +## temporal.resources.requests [object] The requested resources for temporal pod(s) +resources: + ## Example: + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + +extraContainers: [] + +## secrets [object] Supply additional secrets to container +## Example: +## secrets: +## DATABASE_PASSWORD: strong-password +## DATABASE_USER: my-db-user +secrets: {} + +## env_vars [object] Supply extra env variables to main container using simplified notation +## Example with default vars for webapp: +# env_vars: + +# # Airbyte Internal Database, see https://docs.airbyte.io/operator-guides/configuring-airbyte-db +# DB: airbyte-db-svc +# DB_PORT: 5432 +# DATABASE_DB: airbyte +# POSTGRES_USER: airbyte +# POSTGRES_PWD: 12345 + +env_vars: {} + +## extraSelectorLabels [object] - use to specify own additional selector labels for deployment +extraSelectorLabels: {} +## extraLabels [object] - use to specify own additional labels for deployment +extraLabels: {} diff --git a/helm/airbyte-v1/charts/webapp/.gitignore b/helm/airbyte-v1/charts/webapp/.gitignore new file mode 100644 index 00000000..88e91e8a --- /dev/null +++ b/helm/airbyte-v1/charts/webapp/.gitignore @@ -0,0 +1,2 @@ +# Charts are downloaded at install time with `helm dep build`. +charts diff --git a/helm/airbyte-v1/charts/webapp/Chart.lock b/helm/airbyte-v1/charts/webapp/Chart.lock new file mode 100644 index 00000000..6d8b135d --- /dev/null +++ b/helm/airbyte-v1/charts/webapp/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2022-10-17T18:35:23.164183749Z" diff --git a/helm/airbyte-v1/charts/webapp/Chart.yaml b/helm/airbyte-v1/charts/webapp/Chart.yaml new file mode 100644 index 00000000..7cd62e56 --- /dev/null +++ b/helm/airbyte-v1/charts/webapp/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: Helm chart to deploy airbyte-webapp +name: webapp +type: application +version: 1.3.0 diff --git a/helm/airbyte-v1/charts/webapp/README.md b/helm/airbyte-v1/charts/webapp/README.md new file mode 100644 index 00000000..8becc7c3 --- /dev/null +++ b/helm/airbyte-v1/charts/webapp/README.md @@ -0,0 +1,69 @@ +# webapp + +![Version: 0.67.17](https://img.shields.io/badge/Version-0.67.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: dev](https://img.shields.io/badge/AppVersion-dev-informational?style=flat-square) + +Helm chart to deploy airbyte-webapp + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 1.x.x | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| api.url | string | `"/api/v1/"` | | +| containerSecurityContext | object | `{}` | | +| enabled | bool | `true` | | +| env_vars | object | `{}` | | +| extraContainers | list | `[]` | | +| extraEnv | list | `[]` | | +| extraInitContainers | list | `[]` | | +| extraLabels | object | `{}` | | +| extraSelectorLabels | object | `{}` | | +| extraVolumeMounts | list | `[]` | | +| extraVolumes | list | `[]` | | +| fullstory.enabled | bool | `false` | | +| global.configMapName | string | `""` | | +| global.database.secretName | string | `""` | | +| global.database.secretValue | string | `""` | | +| global.deploymentMode | string | `"oss"` | | +| global.extraContainers | list | `[]` | | +| global.extraLabels | object | `{}` | | +| global.extraSelectorLabels | object | `{}` | | +| global.secretName | string | `""` | | +| global.serviceAccountName | string | `"placeholderServiceAccount"` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"airbyte/webapp"` | | +| ingress.annotations | object | `{}` | | +| ingress.className | string | `""` | | +| ingress.enabled | bool | `false` | | +| ingress.hosts | list | `[]` | | +| ingress.tls | list | `[]` | | +| livenessProbe.enabled | bool | `true` | | +| livenessProbe.failureThreshold | int | `3` | | +| livenessProbe.initialDelaySeconds | int | `30` | | +| livenessProbe.periodSeconds | int | `10` | | +| livenessProbe.successThreshold | int | `1` | | +| livenessProbe.timeoutSeconds | int | `1` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| readinessProbe.enabled | bool | `true` | | +| readinessProbe.failureThreshold | int | `3` | | +| readinessProbe.initialDelaySeconds | int | `10` | | +| readinessProbe.periodSeconds | int | `10` | | +| readinessProbe.successThreshold | int | `1` | | +| readinessProbe.timeoutSeconds | int | `1` | | +| replicaCount | int | `1` | | +| resources.limits | object | `{}` | | +| resources.requests | object | `{}` | | +| secrets | object | `{}` | | +| service.annotations | object | `{}` | | +| service.port | int | `80` | | +| service.type | string | `"ClusterIP"` | | +| tolerations | list | `[]` | | + diff --git a/helm/airbyte-v1/charts/webapp/templates/_helpers.tpl b/helm/airbyte-v1/charts/webapp/templates/_helpers.tpl new file mode 100644 index 00000000..e3f0d38f --- /dev/null +++ b/helm/airbyte-v1/charts/webapp/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "airbyte.labels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "airbyte.selectorLabels" -}} +app.kubernetes.io/name: {{ include "airbyte.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + + +{{/* +Define db secret +*/}} + +{{- define "database.secret.name" -}} +{{- printf "%s-postgresql" .Release.Name }} +{{- end }} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/webapp/templates/_images.tpl b/helm/airbyte-v1/charts/webapp/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/charts/webapp/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/webapp/templates/deployment.yaml b/helm/airbyte-v1/charts/webapp/templates/deployment.yaml new file mode 100644 index 00000000..9fc93770 --- /dev/null +++ b/helm/airbyte-v1/charts/webapp/templates/deployment.yaml @@ -0,0 +1,172 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "common.names.fullname" . }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} + {{- if .Values.extraLabels }} + {{ toYaml (mergeOverwrite .Values.extraLabels .Values.global.extraLabels) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "airbyte.selectorLabels" . | nindent 6 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 6 }} + {{- end }} + template: + metadata: + labels: + {{- include "airbyte.selectorLabels" . | nindent 8 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 8 }} + {{- end }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.podAnnotations }} + annotations: + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ .Values.global.serviceAccountName }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + {{- if .Values.extraInitContainers }} + initContainers: + {{- toYaml .Values.extraInitContainers | nindent 6 }} + {{- end }} + containers: + - name: airbyte-webapp-container + image: {{ include "imageUrl" (list .Values.image $) }} + imagePullPolicy: "{{ .Values.image.pullPolicy }}" + env: + {{- if eq .Values.global.deploymentMode "oss" }} + - name: TRACKING_STRATEGY + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TRACKING_STRATEGY + - name: AIRBYTE_SERVER_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: AIRBYTE_SERVER_HOST + - name: KEYCLOAK_INTERNAL_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: KEYCLOAK_INTERNAL_HOST + - name: CONNECTOR_BUILDER_API_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: CONNECTOR_BUILDER_API_HOST + - name: AIRBYTE_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: AIRBYTE_VERSION + - name: API_URL + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: API_URL + - name: CONNECTOR_BUILDER_API_URL + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: CONNECTOR_BUILDER_API_URL + {{- end }} + # Values from secret + {{- if .Values.secrets }} + {{- range $k, $v := .Values.secrets }} + - name: {{ $k }} + valueFrom: + secretKeyRef: + name: webapp-secrets + key: {{ $k }} + {{- end }} + {{- end }} + + # Values from env + {{- if or .Values.env_vars .Values.global.env_vars }} + {{- range $k, $v := mergeOverwrite .Values.env_vars .Values.global.env_vars }} + - name: {{ $k }} + value: {{ $v | quote }} + {{- end }} + {{- end }} + + # Values from extraEnv for more compability(if you want to use external secret source or other stuff) + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 8 }} + {{- end }} + + + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + tcpSocket: + port: http + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: /index.html + port: http + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} + ports: + - name: http + containerPort: 8080 + protocol: TCP + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 10 }} + {{- end }} + {{- if .Values.containerSecurityContext }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 10 }} + {{- end }} + volumeMounts: + {{- if .Values.extraVolumeMounts }} + {{ toYaml .Values.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.global.extraVolumeMounts }} + {{ toYaml .Values.global.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 6 }} + {{- end }} + {{- if .Values.global.extraContainers }} + {{ toYaml .Values.global.extraContainers | nindent 6 }} + {{- end }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + {{- if .Values.extraVolumes }} +{{ toYaml .Values.extraVolumes | nindent 6 }} + {{- end }} + {{- if .Values.global.extraVolumes }} +{{ toYaml .Values.global.extraVolumes | nindent 6 }} + {{- end }} diff --git a/helm/airbyte-v1/charts/webapp/templates/ingress.yaml b/helm/airbyte-v1/charts/webapp/templates/ingress.yaml new file mode 100644 index 00000000..5fef4e02 --- /dev/null +++ b/helm/airbyte-v1/charts/webapp/templates/ingress.yaml @@ -0,0 +1,62 @@ +--- +{{ if .Values.ingress.enabled -}} +{{- $fullName := include "airbyte.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $.Release.Name }}-airbyte-webapp-svc + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }}-svc + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/helm/airbyte-v1/charts/webapp/templates/secrets.yaml b/helm/airbyte-v1/charts/webapp/templates/secrets.yaml new file mode 100644 index 00000000..8ac24955 --- /dev/null +++ b/helm/airbyte-v1/charts/webapp/templates/secrets.yaml @@ -0,0 +1,17 @@ +# Create secrets only for the local deployment +{{- if .Values.secrets }} +apiVersion: v1 +kind: Secret +metadata: + name: webapp-secrets + labels: + {{- include "airbyte.labels" . | nindent 4 }} + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-1" +type: Opaque +data: + {{- range $k, $v := mergeOverwrite .Values.secrets .Values.global.secrets }} + {{ $k }}: {{ if $v }}{{ $v | b64enc }} {{else}}""{{end}} + {{- end }} +{{- end }} diff --git a/helm/airbyte-v1/charts/webapp/templates/service.yaml b/helm/airbyte-v1/charts/webapp/templates/service.yaml new file mode 100644 index 00000000..a4ccded3 --- /dev/null +++ b/helm/airbyte-v1/charts/webapp/templates/service.yaml @@ -0,0 +1,29 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-airbyte-webapp-svc + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + {{ if and (eq .Values.service.type "NodePort") (.Values.service.nodePort) }} + nodePort: {{ .Values.service.nodePort }} + {{- end }} + selector: + {{- include "airbyte.selectorLabels" . | nindent 4 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 4 }} + {{- end }} + {{- if .Values.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} diff --git a/helm/airbyte-v1/charts/webapp/values.yaml b/helm/airbyte-v1/charts/webapp/values.yaml new file mode 100644 index 00000000..aedb5076 --- /dev/null +++ b/helm/airbyte-v1/charts/webapp/values.yaml @@ -0,0 +1,261 @@ +global: + serviceAccountName: placeholderServiceAccount + deploymentMode: oss + configMapName: "" + secretName: "" + extraContainers: [] + ## extraSelectorLabels [object] - use to specify own additional selector labels for deployment + extraSelectorLabels: {} + ## extraLabels [object] - use to specify own additional labels for deployment + extraLabels: {} + database: + secretName: "" + secretValue: "" + + # Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "" + +enabled: true +## webapp.replicaCount Number of webapp replicas +replicaCount: 1 + +## webapp.image.repository The repository to use for the airbyte webapp image. +## webapp.image.pullPolicy the pull policy to use for the airbyte webapp image +## webapp.image.tag The airbyte webapp image tag. Defaults to the chart's AppVersion +image: + repository: airbyte/webapp + pullPolicy: IfNotPresent + +## webapp.podAnnotations [object] Add extra annotations to the webapp pod(s) +## +podAnnotations: {} + +## webapp.podLabels [object] Add extra labels to the webapp pod(s) +## +podLabels: {} + +## webapp.containerSecurityContext Security context for the container +## Examples: +## containerSecurityContext: +## runAsNonRoot: true +## runAsUser: 1000 +## readOnlyRootFilesystem: true +containerSecurityContext: {} + +## Configure extra options for the webapp containers' liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## webapp.livenessProbe.enabled Enable livenessProbe on the webapp +## webapp.livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe +## webapp.livenessProbe.periodSeconds Period seconds for livenessProbe +## webapp.livenessProbe.timeoutSeconds Timeout seconds for livenessProbe +## webapp.livenessProbe.failureThreshold Failure threshold for livenessProbe +## webapp.livenessProbe.successThreshold Success threshold for livenessProbe +## +livenessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## webapp.readinessProbe.enabled Enable readinessProbe on the webapp +## webapp.readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe +## webapp.readinessProbe.periodSeconds Period seconds for readinessProbe +## webapp.readinessProbe.timeoutSeconds Timeout seconds for readinessProbe +## webapp.readinessProbe.failureThreshold Failure threshold for readinessProbe +## webapp.readinessProbe.successThreshold Success threshold for readinessProbe +## +readinessProbe: + enabled: true + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## webapp.service.type The service type to use for the webapp service +## webapp.service.port The service port to expose the webapp on +## webapp.service.annotations Annotations for the webapp service resource +service: + type: ClusterIP + port: 80 + annotations: {} + +## Web app resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## We usually recommend not to specify default resources and to leave this as a conscious +## choice for the user. This also increases chances charts run on environments with little +## resources, such as Minikube. If you do want to specify resources, uncomment the following +## lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## webapp.resources.limits [object] The resources limits for the Web container +## webapp.resources.requests [object] The requested resources for the Web container +resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + +## webapp.nodeSelector [object] Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## webapp.tolerations [array] Tolerations for webapp pod assignment. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## webapp.affinity [object] Affinity and anti-affinity for webapp pod assignment. +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## Configure the ingress resource that allows you to access the Airbyte installation. +## ref: http://kubernetes.io/docs/user-guide/ingress/ +## webapp.ingress.enabled Set to true to enable ingress record generation +## webapp.ingress.className Specifies ingressClassName for clusters >= 1.18+ +## webapp.ingress.annotations [object] Ingress annotations done as key:value pairs +## webapp.ingress.hosts The list of hostnames to be covered with this ingress record. +## webapp.ingress.tls [array] Custom ingress TLS configuration +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: [] + # - host: chart-example.local + # paths: + # - path: / + # pathType: ImplementationSpecific + + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +## webapp.api.url The webapp API url. +api: + url: /api/v1/ + +## webapp.fullstory.enabled Whether or not to enable fullstory +fullstory: + enabled: false + + +## webapp.extraVolumeMounts [array] Additional volumeMounts for webapp container(s). +## Examples (when using `webapp.containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumeMounts: +## - name: var-run +## mountPath: /var/run/ +## - name: var-cache-nginx +## mountPath: /var/cache/nginx +## - mountPath: /etc/nginx/conf.d +## name: nginx-conf-d +## +extraVolumeMounts: [] + +## webapp.extraVolumes [array] Additional volumes for webapp pod(s). +## Examples (when using `webapp.containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumes: +## - name: var-run +## emptyDir: {} +## - name: var-cache-nginx +## emptyDir: {} +## - name: nginx-conf-d +## emptyDir: {} +## +extraVolumes: [] + +## extraContainer [array] Additional container for server pod(s) +## Example: +# extraContainers: +# - name: otel_collector +# image: somerepo/someimage:sometag +# args: [ +# "--important-args" +# ] +# ports: +# - containerPort: 443 +# volumeMounts: +# - name: volumeMountCool +# mountPath: /some/path +# readOnly: true +extraContainers: [] + +## extraInitContainers [array] Additional init containers for server pod(s) +## Example: +# extraInitContainers: +# - name: sleepy +# image: alpine +# command: ['sleep', '60'] + +extraInitContainers: [] + +## extraEnv [array] Supply extra env variables to main container using full notation +## Example: (With default env vars and values taken from generated config map) +# extraEnv: +# - name: POSTGRES_USER +# valueFrom: +# secretKeyRef: +# name: airbyte-secrets +# key: DATABASE_USER +# - name: POSTGRES_PWD +# valueFrom: +# secretKeyRef: +# name: airbyte-secrets +# key: DATABASE_PASSWORD +# - name: DYNAMIC_CONFIG_FILE_PATH +# value: "config/dynamicconfig/development.yaml" +# - name: DB +# value: "postgresql" +# - name: DB_PORT +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: DATABASE_PORT +# - name: POSTGRES_SEEDS +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: DATABASE_HOST +## +extraEnv: [] +## secrets [object] Supply additional secrets to container +## Example: +## secrets: +## DATABASE_PASSWORD: strong-password +## DATABASE_USER: my-db-user +secrets: {} + +## env_vars [object] Supply extra env variables to main container using simplified notation +## Example with default vars for webapp: +# env_vars: +# AIRBYTE_VERSION: 0.40.4 + +# # Miscellaneous +# TRACKING_STRATEGY: segment +# API_URL: /api/v1/ +# AIRBYTE_SERVER_HOST: airbyte-server-svc:8001 + +env_vars: {} + + + + +## extraSelectorLabels [object] - use to specify own additional selector labels for deployment +extraSelectorLabels: {} +## extraLabels [object] - use to specify own additional labels for deployment +extraLabels: {} diff --git a/helm/airbyte-v1/charts/worker/.gitignore b/helm/airbyte-v1/charts/worker/.gitignore new file mode 100644 index 00000000..88e91e8a --- /dev/null +++ b/helm/airbyte-v1/charts/worker/.gitignore @@ -0,0 +1,2 @@ +# Charts are downloaded at install time with `helm dep build`. +charts diff --git a/helm/airbyte-v1/charts/worker/Chart.lock b/helm/airbyte-v1/charts/worker/Chart.lock new file mode 100644 index 00000000..7000cfe2 --- /dev/null +++ b/helm/airbyte-v1/charts/worker/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2022-10-17T18:35:31.130386898Z" diff --git a/helm/airbyte-v1/charts/worker/Chart.yaml b/helm/airbyte-v1/charts/worker/Chart.yaml new file mode 100644 index 00000000..1625f982 --- /dev/null +++ b/helm/airbyte-v1/charts/worker/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: Helm chart to deploy airbyte-worker +name: worker +type: application +version: 1.3.0 diff --git a/helm/airbyte-v1/charts/worker/README.md b/helm/airbyte-v1/charts/worker/README.md new file mode 100644 index 00000000..a9d1b210 --- /dev/null +++ b/helm/airbyte-v1/charts/worker/README.md @@ -0,0 +1,72 @@ +# worker + +![Version: 0.67.17](https://img.shields.io/badge/Version-0.67.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: dev](https://img.shields.io/badge/AppVersion-dev-informational?style=flat-square) + +Helm chart to deploy airbyte-worker + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 1.x.x | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| containerSecurityContext | object | `{}` | | +| debug.enabled | bool | `false` | | +| debug.remoteDebugPort | int | `5005` | | +| enabled | bool | `true` | | +| env_vars.CONTAINER_ORCHESTRATOR_ENABLED | bool | `true` | | +| extraContainers | list | `[]` | | +| extraEnv | list | `[]` | | +| extraInitContainers | list | `[]` | | +| extraLabels | object | `{}` | | +| extraSelectorLabels | object | `{}` | | +| extraVolumeMounts | list | `[]` | | +| extraVolumes | list | `[]` | | +| global.credVolumeOverride | string | `""` | | +| global.database.secretName | string | `""` | | +| global.database.secretValue | string | `""` | | +| global.edition | string | `"community"` | | +| global.extraContainers | list | `[]` | | +| global.extraLabels | object | `{}` | | +| global.extraSelectorLabels | object | `{}` | | +| global.jobs.kube.annotations | object | `{}` | | +| global.jobs.kube.images.busybox | string | `""` | | +| global.jobs.kube.images.curl | string | `""` | | +| global.jobs.kube.labels | object | `{}` | | +| global.jobs.kube.main_container_image_pull_secret | string | `""` | | +| global.jobs.kube.nodeSelector | object | `{}` | | +| global.jobs.kube.tolerations | list | `[]` | | +| global.jobs.resources.limits | object | `{}` | | +| global.jobs.resources.requests | object | `{}` | | +| global.secretName | string | `""` | | +| global.serviceAccountName | string | `"airbyte-admin"` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"airbyte/worker"` | | +| livenessProbe.enabled | bool | `true` | | +| livenessProbe.failureThreshold | int | `3` | | +| livenessProbe.initialDelaySeconds | int | `50` | | +| livenessProbe.periodSeconds | int | `10` | | +| livenessProbe.successThreshold | int | `1` | | +| livenessProbe.timeoutSeconds | int | `1` | | +| log.level | string | `"INFO"` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| readinessProbe.enabled | bool | `true` | | +| readinessProbe.failureThreshold | int | `3` | | +| readinessProbe.initialDelaySeconds | int | `10` | | +| readinessProbe.periodSeconds | int | `10` | | +| readinessProbe.successThreshold | int | `1` | | +| readinessProbe.timeoutSeconds | int | `1` | | +| replicaCount | int | `1` | | +| resources.limits | object | `{}` | | +| resources.requests | object | `{}` | | +| secrets | object | `{}` | | +| tolerations | list | `[]` | | +| workloadApi | object | `{}` | | + diff --git a/helm/airbyte-v1/charts/worker/templates/_helpers.tpl b/helm/airbyte-v1/charts/worker/templates/_helpers.tpl new file mode 100644 index 00000000..b8ac92f8 --- /dev/null +++ b/helm/airbyte-v1/charts/worker/templates/_helpers.tpl @@ -0,0 +1,242 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "airbyte.labels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "airbyte.selectorLabels" -}} +app.kubernetes.io/name: {{ include "airbyte.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Define db secret +*/}} + +{{- define "database.secret.name" -}} +{{- printf "%s-postgresql" .Release.Name }} +{{- end }} + +## DEFAULT HELM VALUES +# Secret Manager Defaults +{{/* +Define secret persistence +*/}} +{{- define "airbyte.secretPersistence" -}} +{{- if (((.Values.global).secretsManager).type) }} + {{- printf "%s" (snakecase .Values.global.secretsManager.type) }} +{{- else }} + {{- printf "" }} +{{- end }} +{{- end }} + +{{/* +Get secret store name or default +*/}} +{{- define "airbyte.secretStoreName" -}} +{{- $secretStoreName := . -}} +{{- if $secretStoreName -}} + {{- printf "%s" $secretStoreName -}} +{{- else -}} + {{- printf "airbyte-config-secrets" -}} +{{- end -}} +{{- end -}} + +{{/* +Get awsSecretManager access key id secret key or default +*/}} +{{- define "airbyte.awsSecretManagerAccessKeyIdSecretKey" -}} +{{- $awsSecretManagerAccessKeyIdSecretKey := . -}} +{{- if $awsSecretManagerAccessKeyIdSecretKey -}} + {{- printf "%s" $awsSecretManagerAccessKeyIdSecretKey -}} +{{- else -}} + {{- printf "aws-secret-manager-access-key-id" -}} +{{- end -}} +{{- end -}} + +{{/* +Get awsSecretManager secret access key secret key or default +*/}} +{{- define "airbyte.awsSecretManagerSecretAccessKeySecretKey" -}} +{{- $awsSecretManagerSecretAccessKeySecretKey := . -}} +{{- if $awsSecretManagerSecretAccessKeySecretKey -}} + {{- printf "%s" $awsSecretManagerSecretAccessKeySecretKey -}} +{{- else -}} + {{- printf "aws-secret-manager-secret-access-key" -}} +{{- end -}} +{{- end -}} + +{{/* +Get googleSecretManager credentials secret key or default +*/}} +{{- define "airbyte.googleSecretManagerCredentialsSecretKey" -}} +{{- $googleSecretManagerCredentialsSecretKey := . -}} +{{- if $googleSecretManagerCredentialsSecretKey -}} + {{- printf "%s" $googleSecretManagerCredentialsSecretKey -}} +{{- else -}} + {{- printf "google-secret-manager-credentials" -}} +{{- end -}} +{{- end -}} + +{{/* +Get vault auth token secret key or default +*/}} +{{- define "airbyte.vaultAuthTokenSecretKey" -}} +{{- $vaultAuthTokenSecretKey := . -}} +{{- if $vaultAuthTokenSecretKey -}} + {{- printf "%s" $vaultAuthTokenSecretKey -}} +{{- else -}} + {{- printf "vault-auth-token" -}} +{{- end -}} +{{- end -}} + + +# Storage Defaults +{{/* +Get storage type or default +*/}} +{{- define "airbyte.storageType" -}} +{{- $storageType := . -}} +{{- if $storageType -}} + {{- printf "%s" $storageType -}} +{{- else -}} + {{- printf "local" -}} +{{- end -}} +{{- end -}} + +{{/* +Get storage bucket log or default +*/}} +{{- define "airbyte.storageBucketLog" -}} +{{- $storageBucketLog := . -}} +{{- if $storageBucketLog -}} + {{- printf "%s" $storageBucketLog -}} +{{- else -}} + {{- printf "airbyte-storage" -}} +{{- end -}} +{{- end -}} + +{{/* +Get storage bucket state or default +*/}} +{{- define "airbyte.storageBucketState" -}} +{{- $storageBucketState := . -}} +{{- if $storageBucketState -}} + {{- printf "%s" $storageBucketState -}} +{{- else -}} + {{- printf "airbyte-storage" -}} +{{- end -}} +{{- end -}} + +{{/* +Get storage bucket workload output or default +*/}} +{{- define "airbyte.storageBucketWorkloadOutput" -}} +{{- $storageBucketWorkloadOutput := . -}} +{{- if $storageBucketWorkloadOutput -}} + {{- printf "%s" $storageBucketWorkloadOutput -}} +{{- else -}} + {{- printf "airbyte-storage" -}} +{{- end -}} +{{- end -}} + +{{/* +Get s3 access key id secret key or default +*/}} +{{- define "airbyte.s3AccessKeyIdSecretKey" -}} +{{- $s3AccessKeyIdSecretKey := . -}} +{{- if $s3AccessKeyIdSecretKey -}} + {{- printf "%s" $s3AccessKeyIdSecretKey -}} +{{- else -}} + {{- printf "s3-access-key-id" -}} +{{- end -}} +{{- end -}} + +{{/* +Get s3 secret access key secret key or default +*/}} +{{- define "airbyte.s3SecretAccessKeySecretKey" -}} +{{- $s3SecretAccessKeySecretKey := . -}} +{{- if $s3SecretAccessKeySecretKey -}} + {{- printf "%s" $s3SecretAccessKeySecretKey -}} +{{- else -}} + {{- printf "s3-secret-access-key" -}} +{{- end -}} +{{- end -}} + +{{/* +Get minio access key id secret key or default +*/}} +{{- define "airbyte.minioAccessKeyIdSecretKey" -}} +{{- $minioAccessKeyIdSecretKey := . -}} +{{- if $minioAccessKeyIdSecretKey -}} + {{- printf "%s" $minioAccessKeyIdSecretKey -}} +{{- else -}} + {{- printf "minio-access-key-id" -}} +{{- end -}} +{{- end -}} + +{{/* +Get minio secret access key secret key or default +*/}} +{{- define "airbyte.minioSecretAccessKeySecretKey" -}} +{{- $minioSecretAccessKeySecretKey := . -}} +{{- if $minioSecretAccessKeySecretKey -}} + {{- printf "%s" $minioSecretAccessKeySecretKey -}} +{{- else -}} + {{- printf "minio-secret-access-key" -}} +{{- end -}} +{{- end -}} + +{{/* +Get gcs credentials secret key or default +*/}} +{{- define "airbyte.gcsCredentialsSecretKey" -}} +{{- $gcsCredentialsSecretKey := . -}} +{{- if $gcsCredentialsSecretKey -}} + {{- printf "%s" $gcsCredentialsSecretKey -}} +{{- else -}} + {{- printf "gcs-credentials" -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/worker/templates/_images.tpl b/helm/airbyte-v1/charts/worker/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/charts/worker/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/worker/templates/deployment.yaml b/helm/airbyte-v1/charts/worker/templates/deployment.yaml new file mode 100644 index 00000000..ad46daeb --- /dev/null +++ b/helm/airbyte-v1/charts/worker/templates/deployment.yaml @@ -0,0 +1,500 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "common.names.fullname" . }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} + {{- if .Values.extraLabels }} + {{ toYaml (mergeOverwrite .Values.extraLabels .Values.global.extraLabels) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "airbyte.selectorLabels" . | nindent 6 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 6 }} + {{- end }} + template: + metadata: + labels: + {{- include "airbyte.selectorLabels" . | nindent 8 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 8 }} + {{- end }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.podAnnotations }} + annotations: + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ .Values.global.serviceAccountName }} + automountServiceAccountToken: true + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.extraInitContainers }} + initContainers: + {{- toYaml .Values.extraInitContainers | nindent 6 }} + {{- end }} + containers: + - name: airbyte-worker-container + image: {{ include "imageUrl" (list .Values.image $) }} + imagePullPolicy: "{{ .Values.image.pullPolicy }}" + env: + {{- if .Values.debug.enabled }} + - name: JAVA_TOOL_OPTIONS + value: "-Xdebug -agentlib:jdwp=transport=dt_socket,address=0.0.0.0:{{ .Values.debug.remoteDebugPort }},server=y,suspend=n" + {{- end}} + {{- if eq .Values.global.deploymentMode "oss" }} + - name: AIRBYTE_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: AIRBYTE_VERSION + - name: CONFIG_ROOT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: CONFIG_ROOT + {{- if eq (lower (default "" .Values.global.storage.type)) "gcs" }} + - name: CONTAINER_ORCHESTRATOR_SECRET_MOUNT_PATH + value: "/secrets/gcs-log-creds" + - name: CONTAINER_ORCHESTRATOR_SECRET_NAME + value: {{ include "airbyte.secretStoreName" .Values.global.storage.storageSecretName }} + {{- end }} + {{- include "airbyte.logging.envs" . | nindent 8 }} + - name: MICROMETER_METRICS_ENABLED + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MICROMETER_METRICS_ENABLED + - name: MICROMETER_METRICS_STATSD_FLAVOR + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MICROMETER_METRICS_STATSD_FLAVOR + - name: SEGMENT_WRITE_KEY + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: SEGMENT_WRITE_KEY + - name: STATSD_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STATSD_HOST + - name: STATSD_PORT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STATSD_PORT + - name: TRACKING_STRATEGY + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TRACKING_STRATEGY + - name: WORKSPACE_DOCKER_MOUNT + value: workspace + - name: WORKSPACE_ROOT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WORKSPACE_ROOT + - name: WEBAPP_URL + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WEBAPP_URL + - name: TEMPORAL_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TEMPORAL_HOST + - name: TEMPORAL_WORKER_PORTS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TEMPORAL_WORKER_PORTS + - name: JOB_KUBE_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: JOB_KUBE_SERVICEACCOUNT + value: {{ .Values.global.serviceAccountName }} + {{- if $.Values.global.jobs.kube.annotations }} + - name: JOB_KUBE_ANNOTATIONS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_KUBE_ANNOTATIONS + {{- end }} + {{- if $.Values.global.jobs.kube.labels }} + - name: JOB_KUBE_LABELS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_KUBE_LABELS + {{- end }} + {{- if $.Values.global.jobs.kube.nodeSelector }} + - name: JOB_KUBE_NODE_SELECTORS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_KUBE_NODE_SELECTORS + {{- end }} + {{- if $.Values.global.jobs.kube.tolerations }} + - name: JOB_KUBE_TOLERATIONS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_KUBE_TOLERATIONS + {{- end }} + - name: JOB_KUBE_BUSYBOX_IMAGE + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_KUBE_BUSYBOX_IMAGE + - name: JOB_KUBE_CURL_IMAGE + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_KUBE_CURL_IMAGE + {{- if $.Values.global.jobs.kube.main_container_image_pull_secret }} + - name: JOB_KUBE_MAIN_CONTAINER_IMAGE_PULL_SECRET + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_KUBE_MAIN_CONTAINER_IMAGE_PULL_SECRET + {{- end }} + - name: JOB_MAIN_CONTAINER_CPU_REQUEST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_MAIN_CONTAINER_CPU_REQUEST + - name: JOB_MAIN_CONTAINER_CPU_LIMIT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_MAIN_CONTAINER_CPU_LIMIT + - name: JOB_MAIN_CONTAINER_MEMORY_REQUEST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_MAIN_CONTAINER_MEMORY_REQUEST + - name: JOB_MAIN_CONTAINER_MEMORY_LIMIT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_MAIN_CONTAINER_MEMORY_LIMIT + - name: INTERNAL_API_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: INTERNAL_API_HOST + - name: WORKLOAD_API_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WORKLOAD_API_HOST + - name: WORKLOAD_API_BEARER_TOKEN + valueFrom: + secretKeyRef: + name: {{ index .Values "workloadApi" "bearerTokenSecretName" | default (printf "%s-airbyte-secrets" .Release.Name ) }} + key: {{ index .Values "workloadApi" "bearerTokenSecretKey" | default "WORKLOAD_API_BEARER_TOKEN" }} + - name: CONFIGS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: CONFIGS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + - name: JOBS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOBS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + - name: METRIC_CLIENT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: METRIC_CLIENT + - name: OTEL_COLLECTOR_ENDPOINT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: OTEL_COLLECTOR_ENDPOINT + - name: ACTIVITY_MAX_ATTEMPT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: ACTIVITY_MAX_ATTEMPT + - name: ACTIVITY_INITIAL_DELAY_BETWEEN_ATTEMPTS_SECONDS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: ACTIVITY_INITIAL_DELAY_BETWEEN_ATTEMPTS_SECONDS + - name: ACTIVITY_MAX_DELAY_BETWEEN_ATTEMPTS_SECONDS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: ACTIVITY_MAX_DELAY_BETWEEN_ATTEMPTS_SECONDS + - name: WORKFLOW_FAILURE_RESTART_DELAY_SECONDS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WORKFLOW_FAILURE_RESTART_DELAY_SECONDS + - name: SHOULD_RUN_NOTIFY_WORKFLOWS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: SHOULD_RUN_NOTIFY_WORKFLOWS + - name: MICRONAUT_ENVIRONMENTS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WORKERS_MICRONAUT_ENVIRONMENTS + {{- if or (eq .Values.global.edition "pro") (eq .Values.global.edition "enterprise") }} + - name: AIRBYTE_API_AUTH_HEADER_NAME + value: "X-Airbyte-Auth" + - name: AIRBYTE_API_AUTH_HEADER_VALUE + value: "Internal worker" + {{- else if and (eq .Values.global.deploymentMode "oss") .Values.global.auth.enabled }} + # Self-Managed Enterprise and Community w/ auth enabled use the same auth header, just + # splitting into two separate blocks for readability. + - name: AIRBYTE_API_AUTH_HEADER_NAME + value: "X-Airbyte-Auth" + - name: AIRBYTE_API_AUTH_HEADER_VALUE + value: "Internal worker" + {{- end }} + # SECRETS MANAGER + - name: SECRET_PERSISTENCE + value: {{ include "airbyte.secretPersistence" . }} + # Values for awsSecretManager + {{- if eq ((((.Values.global).secretsManager).awsSecretManager).authenticationType) "credentials" }} + - name: AWS_SECRET_MANAGER_ACCESS_KEY_ID + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.awsSecretManagerAccessKeyIdSecretKey" .Values.global.secretsManager.awsSecretManager.accessKeyIdSecretKey }} + - name: AWS_SECRET_MANAGER_SECRET_ACCESS_KEY + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.awsSecretManagerSecretAccessKeySecretKey" .Values.global.secretsManager.awsSecretManager.secretAccessKeySecretKey }} + {{- end }} + {{- if ((((.Values.global).secretsManager).awsSecretManager).region) }} + - name: AWS_SECRET_MANAGER_REGION + value: {{ (((.Values.global).secretsManager).awsSecretManager).region }} + {{- end }} + + {{- if ((((.Values.global).secretsManager).awsSecretManager).tags) }} + - name: AWS_SECRET_MANAGER_SECRET_TAGS + value: {{ include "airbyte.tagsToString" .Values.global.secretsManager.awsSecretManager.tags }} + {{- end }} + {{- if ((((.Values.global).secretsManager).awsSecretManager).kms) }} + - name: AWS_KMS_KEY_ARN + value: {{ ((((.Values.global).secretsManager).awsSecretManager).kms) | default "" }} + {{- end }} + + # Values for Azure Key Vault + {{- if (((.Values.global).secretsManager).azureKeyVault) }} + + - name: AB_AZURE_KEY_VAULT_VAULT_URL + value: {{ (((.Values.global).secretsManager).azureKeyVault).vaultUrl }} + + - name: AB_AZURE_KEY_VAULT_TENANT_ID + value: {{ (((.Values.global).secretsManager).azureKeyVault).tenantId }} + + - name: AB_AZURE_KEY_VAULT_CLIENT_ID + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.azureKeyVaultClientIdSecretKey" .Values.global.secretsManager.azureKeyVault.clientIdSecretKey }} + - name: AB_AZURE_KEY_VAULT_CLIENT_SECRET + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.azureKeyVaultClientSecretSecretKey" .Values.global.secretsManager.azureKeyVault.clientSecretSecretKey }} + + {{- end }} + + {{- if ((((.Values.global).secretsManager).azureKeyVault).tags) }} + - name: AB_AZURE_KEY_VAULT_TAGS + value: {{ include "airbyte.tagsToString" .Values.global.secretsManager.azureKeyVault.tags }} + {{- end }} + + # Values for googleSecretManager secrets + {{- if (((.Values.global).secretsManager).googleSecretManager) }} + - name: SECRET_STORE_GCP_PROJECT_ID + value: {{ .Values.global.secretsManager.googleSecretManager.projectId }} + - name: SECRET_STORE_GCP_CREDENTIALS + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.googleSecretManagerCredentialsSecretKey" .Values.global.secretsManager.googleSecretManager.credentialsSecretKey }} + {{- end }} + + # Values for vault secrets + {{- if (((.Values.global).secretsManager).vault) }} + - name: VAULT_ADDRESS + value: {{ (((.Values.global).secretsManager).vault).address }} + - name: VAULT_PREFIX + value: {{ (((.Values.global).secretsManager).vault).prefix }} + - name: VAULT_AUTH_TOKEN + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.vaultAuthTokenSecretKey" .Values.global.secretsManager.vault.authTokenSecretKey }} + {{- end }} + + # Storage + {{- include "airbyte.storage.envs" . | nindent 8 }} + + # Database + {{- include "airbyte.database.envs" . | nindent 8 }} + + {{- end }} + + # Values from secret + {{- if .Values.secrets }} + {{- range $k, $v := .Values.secrets }} + - name: {{ $k }} + valueFrom: + secretKeyRef: + name: worker-secrets + key: {{ $k }} + {{- end }} + {{- end }} + + # Values from env + {{- if or .Values.env_vars .Values.global.env_vars }} + {{- range $k, $v := mergeOverwrite .Values.env_vars .Values.global.env_vars }} + - name: {{ $k }} + value: {{ $v | quote }} + {{- end }} + {{- end }} + + # Values from extraEnv for more compatibility (if you want to use external secret source or other stuff) + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 8 }} + {{- end }} + + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: / + port: heartbeat + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: / + port: heartbeat + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} + ports: + {{- if .Values.debug.enabled }} + - name: debug + containerPort: {{ .Values.debug.remoteDebugPort }} + protocol: TCP + {{- end}} + - name: heartbeat + containerPort: 9000 # for heartbeat server + - containerPort: 9001 # start temporal worker port pool + - containerPort: 9002 + - containerPort: 9003 + - containerPort: 9004 + - containerPort: 9005 + - containerPort: 9006 + - containerPort: 9007 + - containerPort: 9008 + - containerPort: 9009 + - containerPort: 9010 + - containerPort: 9011 + - containerPort: 9012 + - containerPort: 9013 + - containerPort: 9014 + - containerPort: 9015 + - containerPort: 9016 + - containerPort: 9017 + - containerPort: 9018 + - containerPort: 9019 + - containerPort: 9020 + - containerPort: 9021 + - containerPort: 9022 + - containerPort: 9023 + - containerPort: 9024 + - containerPort: 9025 + - containerPort: 9026 + - containerPort: 9027 + - containerPort: 9028 + - containerPort: 9029 + - containerPort: 9030 # end temporal worker port pool + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 10 }} + {{- end }} + {{- if .Values.containerSecurityContext }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 10 }} + {{- end }} + volumeMounts: + {{- if eq (lower .Values.global.storage.type) "local" }} + - name: airbyte-storage + mountPath: /storage + {{- end }} + {{- if and (eq .Values.global.deploymentMode "oss") (eq (lower (default "" .Values.global.storage.type)) "gcs") }} + - name: gcs-log-creds-volume + mountPath: /secrets/gcs-log-creds + readOnly: true + {{- end }} + {{- if .Values.extraVolumeMounts }} +{{- toYaml .Values.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.global.extraVolumeMounts }} +{{- toYaml .Values.global.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 6 }} + {{- end }} + {{- if .Values.global.extraContainers }} + {{ toYaml .Values.global.extraContainers | nindent 6 }} + {{- end }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + {{- if eq (lower .Values.global.storage.type) "local" }} + - name: airbyte-storage + persistentVolumeClaim: + claimName: airbyte-storage-pvc + {{- end }} + {{- if and (eq .Values.global.deploymentMode "oss") (eq (lower (default "" .Values.global.storage.type)) "gcs") }} + - name: gcs-log-creds-volume + secret: + secretName: {{ ternary (printf "%s-gcs-log-creds" ( .Release.Name )) .Values.global.storage.storageSecretName (not ((.Values.global.storage).storageSecretName)) }} + {{- end }} + {{- if .Values.extraVolumes }} +{{- toYaml .Values.extraVolumes | nindent 6 }} + {{- end }} + {{- if .Values.global.extraVolumes }} +{{- toYaml .Values.global.extraVolumes | nindent 6 }} + {{- end }} diff --git a/helm/airbyte-v1/charts/worker/templates/secrets.yaml b/helm/airbyte-v1/charts/worker/templates/secrets.yaml new file mode 100644 index 00000000..93bb0c63 --- /dev/null +++ b/helm/airbyte-v1/charts/worker/templates/secrets.yaml @@ -0,0 +1,17 @@ +# Create secrets only for the local deployment +{{- if .Values.secrets }} +apiVersion: v1 +kind: Secret +metadata: + name: worker-secrets + labels: + {{- include "airbyte.labels" . | nindent 4 }} + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-1" +type: Opaque +data: + {{- range $k, $v := mergeOverwrite .Values.secrets .Values.global.secrets }} + {{ $k }}: {{ if $v }}{{ $v | b64enc }} {{else}}""{{end}} + {{- end }} +{{- end }} diff --git a/helm/airbyte-v1/charts/worker/values.yaml b/helm/airbyte-v1/charts/worker/values.yaml new file mode 100644 index 00000000..b05d279e --- /dev/null +++ b/helm/airbyte-v1/charts/worker/values.yaml @@ -0,0 +1,294 @@ +global: + serviceAccountName: &service-account-name "airbyte-admin" + edition: community + credVolumeOverride: "" + secretName: "" + extraContainers: [] + ## extraSelectorLabels [object] - use to specify own additional selector labels for deployment + extraSelectorLabels: {} + ## extraLabels [object] - use to specify own additional labels for deployment + extraLabels: {} + database: + secretName: "" + secretValue: "" + + storage: + type: minio + + # Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "" + + jobs: + ## Jobs resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## jobs.resources.limits [object] The resources limits for jobs + ## jobs.resources.requests [object] The requested resources for jobs + resources: + ## Example: + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + + kube: + ## JOB_KUBE_ANNOTATIONS + ## pod annotations of the sync job and the default pod annotations fallback for others jobs + ## jobs.kube.annotations [object] key/value annotations applied to kube jobs + annotations: {} + + ## JOB_KUBE_LABELS + ## pod labels of the sync job and the default pod labels fallback for others jobs + ## jobs.kube.labels [object] key/value labels applied to kube jobs + labels: {} + + ## JOB_KUBE_NODE_SELECTORS + ## pod node selector of the sync job and the default pod node selector fallback for others jobs + ## jobs.kube.nodeSelector [object] key/value node selector applied to kube jobs + nodeSelector: {} + + ## JOB_KUBE_TOLERATIONS + ## jobs.kube.tolerations [array] Tolerations for jobs.kube pod assignment. + ## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + ## any boolean values should be quoted to ensure the value is passed through as a string, eg: + ## - key: airbyte-server + ## operator: Equal + ## value: "true" + ## effect: NoSchedule + tolerations: [] + + ## JOB_KUBE_MAIN_CONTAINER_IMAGE_PULL_SECRET + ## image pull secret to use for job pod + ## jobs.kube.main_container_image_pull_secret [string] image pull secret to use for job pod + main_container_image_pull_secret: "" + + images: + ## JOB_KUBE_BUSYBOX_IMAGE + ## busybox image used by the job pod + ## jobs.kube.images.busybox [string] busybox image used by the job pod + busybox: "" + ## JOB_KUBE_CURL_IMAGE + ## curl image used by the job pod + ## jobs.kube.images.curl [string] curl image used by the job pod + curl: "" + +enabled: true +## worker.replicaCount Number of worker replicas +replicaCount: 1 + +## worker.image.repository The repository to use for the airbyte worker image. +## worker.image.pullPolicy the pull policy to use for the airbyte worker image +## worker.image.tag The airbyte worker image tag. Defaults to the chart's AppVersion +image: + repository: airbyte/worker + pullPolicy: IfNotPresent + +## worker.podAnnotations [object] Add extra annotations to the worker pod(s) +## +podAnnotations: {} + +## worker.podLabels [object] Add extra labels to the worker pod(s) +## +podLabels: {} + +## worker.containerSecurityContext Security context for the container +## Examples: +## containerSecurityContext: +## runAsNonRoot: true +## runAsUser: 1000 +## readOnlyRootFilesystem: true +containerSecurityContext: {} + +## Configure extra options for the worker containers' liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## worker.livenessProbe.enabled Enable livenessProbe on the worker +## worker.livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe +## worker.livenessProbe.periodSeconds Period seconds for livenessProbe +## worker.livenessProbe.timeoutSeconds Timeout seconds for livenessProbe +## worker.livenessProbe.failureThreshold Failure threshold for livenessProbe +## worker.livenessProbe.successThreshold Success threshold for livenessProbe +## +livenessProbe: + enabled: true + initialDelaySeconds: 50 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## worker.readinessProbe.enabled Enable readinessProbe on the worker +## worker.readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe +## worker.readinessProbe.periodSeconds Period seconds for readinessProbe +## worker.readinessProbe.timeoutSeconds Timeout seconds for readinessProbe +## worker.readinessProbe.failureThreshold Failure threshold for readinessProbe +## worker.readinessProbe.successThreshold Success threshold for readinessProbe +## +readinessProbe: + enabled: true + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## worker resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## We usually recommend not to specify default resources and to leave this as a conscious +## choice for the user. This also increases chances charts run on environments with little +## resources, such as Minikube. If you do want to specify resources, uncomment the following +## lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## worker.resources.limits [object] The resources limits for the worker container +## worker.resources.requests [object] The requested resources for the worker container +resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + +## worker.nodeSelector [object] Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## worker.tolerations [array] Tolerations for worker pod assignment. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## worker.affinity [object] Affinity and anti-affinity for worker pod assignment. +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## worker.log.level The log level to log at. +log: + level: "INFO" + + + +## worker.extraVolumeMounts [array] Additional volumeMounts for worker container(s). +## Examples (when using `worker.containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumeMounts: +## - name: tmpdir +## mountPath: /tmp +## +extraVolumeMounts: [] + +## worker.extraVolumes [array] Additional volumes for worker pod(s). +## Examples (when using `worker.containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumes: +## - name: tmpdir +## emptyDir: {} +## +extraVolumes: [] + +## extraContainer [array] Additional container for server pod(s) +## Example: +# extraContainers: +# - name: otel_collector +# image: somerepo/someimage:sometag +# args: [ +# "--important-args" +# ] +# ports: +# - containerPort: 443 +# volumeMounts: +# - name: volumeMountCool +# mountPath: /some/path +# readOnly: true +extraContainers: [] + +## extraInitContainers [array] Additional init containers for server pod(s) +## Example: +# extraInitContainers: +# - name: sleepy +# image: alpine +# command: ['sleep', '60'] + +extraInitContainers: [] + +## extraEnv [array] Supply extra env variables to main container using full notation +## Example: (With default env vars and values taken from generated config map) +# extraEnv: +# - name: AIRBYTE_VERSION +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: AIRBYTE_VERSION +# - name: API_URL +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: API_URL +# - name: TRACKING_STRATEGY +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: TRACKING_STRATEGY +# - name: FULLSTORY +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: FULLSTORY +# - name: INTERNAL_API_HOST +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: INTERNAL_API_HOST +## +extraEnv: [] +## secrets [object] Supply additional secrets to container +## Example: +## secrets: +## DATABASE_PASSWORD: strong-password +## DATABASE_USER: my-db-user +secrets: {} + +## env_vars [object] Supply extra env variables to main container using simplified notation +## Example with default values for worker: +# env_vars: +# AIRBYTE_VERSION: 0.40.4 + +# # Airbyte Internal Database, see https://docs.airbyte.io/operator-guides/configuring-airbyte-db +# DATABASE_HOST: airbyte-db-svc +# DATABASE_PORT: 5432 +# DATABASE_DB: airbyte +# # translate manually DATABASE_URL:jdbc:postgresql://${DATABASE_HOST}:${DATABASE_PORT/${DATABASE_DB} +# DATABASE_URL: jdbc:postgresql://airbyte-db-svc:5432/airbyte +# JOBS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION: 0.29.15.001 +# CONFIGS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION: 0.35.15.001 +env_vars: + CONTAINER_ORCHESTRATOR_ENABLED: true + +## extraSelectorLabels [object] - use to specify own additional selector labels for deployment +extraSelectorLabels: {} +## extraLabels [object] - use to specify own additional labels for deployment +extraLabels: {} + +## workloadApi: +## bearerTokenSecretName: workload-api-bearer-token-name kubernetes secret name where bearer token is stored +## bearerTokenSecretKey: workload-api-bearer-token-key kubernetes secret key where bearer token is stored +workloadApi: {} + +debug: + enabled: false + remoteDebugPort: 5005 diff --git a/helm/airbyte-v1/charts/workload-api-server/.gitignore b/helm/airbyte-v1/charts/workload-api-server/.gitignore new file mode 100644 index 00000000..88e91e8a --- /dev/null +++ b/helm/airbyte-v1/charts/workload-api-server/.gitignore @@ -0,0 +1,2 @@ +# Charts are downloaded at install time with `helm dep build`. +charts diff --git a/helm/airbyte-v1/charts/workload-api-server/Chart.lock b/helm/airbyte-v1/charts/workload-api-server/Chart.lock new file mode 100644 index 00000000..d174ec61 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-api-server/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2023-11-02T09:27:52.217541-07:00" diff --git a/helm/airbyte-v1/charts/workload-api-server/Chart.yaml b/helm/airbyte-v1/charts/workload-api-server/Chart.yaml new file mode 100644 index 00000000..b7dc7d1f --- /dev/null +++ b/helm/airbyte-v1/charts/workload-api-server/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: Helm chart to deploy the workload-api service +name: workload-api-server +type: application +version: 1.3.0 diff --git a/helm/airbyte-v1/charts/workload-api-server/README.md b/helm/airbyte-v1/charts/workload-api-server/README.md new file mode 100644 index 00000000..7c1e72e6 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-api-server/README.md @@ -0,0 +1,85 @@ +# workload-api-server + +![Version: 0.67.17](https://img.shields.io/badge/Version-0.67.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: dev](https://img.shields.io/badge/AppVersion-dev-informational?style=flat-square) + +Helm chart to deploy the workload-api service + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 1.x.x | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| containerSecurityContext | object | `{}` | | +| debug.enabled | bool | `false` | | +| debug.remoteDebugPort | int | `5005` | | +| enabled | bool | `false` | | +| env_vars | object | `{}` | | +| extraContainers | list | `[]` | | +| extraEnv | list | `[]` | | +| extraInitContainers | list | `[]` | | +| extraLabels | object | `{}` | | +| extraSelectorLabels | object | `{}` | | +| extraVolumeMounts | list | `[]` | | +| extraVolumes | list | `[]` | | +| global.configMapName | string | `""` | | +| global.credVolumeOverride | string | `""` | | +| global.database.secretName | string | `""` | | +| global.database.secretValue | string | `""` | | +| global.deploymentMode | string | `"oss"` | | +| global.extraContainers | list | `[]` | | +| global.extraLabels | object | `{}` | | +| global.extraSelectorLabels | object | `{}` | | +| global.logs.accessKey.existingSecret | string | `""` | | +| global.logs.accessKey.existingSecretKey | string | `""` | | +| global.logs.accessKey.password | string | `"minio"` | | +| global.logs.gcs.bucket | string | `""` | | +| global.logs.gcs.credentials | string | `""` | | +| global.logs.gcs.credentialsJson | string | `""` | | +| global.logs.minio.enabled | bool | `true` | | +| global.logs.s3.bucket | string | `"airbyte-dev-logs"` | | +| global.logs.s3.bucketRegion | string | `""` | | +| global.logs.s3.enabled | bool | `false` | | +| global.logs.secretKey.existingSecret | string | `""` | | +| global.logs.secretKey.existingSecretKey | string | `""` | | +| global.logs.secretKey.password | string | `"minio123"` | | +| global.secretName | string | `""` | | +| global.serviceAccountName | string | `"placeholderServiceAccount"` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"airbyte/workload-api-server"` | | +| ingress.annotations | object | `{}` | | +| ingress.className | string | `""` | | +| ingress.enabled | bool | `false` | | +| ingress.hosts | list | `[]` | | +| ingress.tls | list | `[]` | | +| livenessProbe.enabled | bool | `true` | | +| livenessProbe.failureThreshold | int | `3` | | +| livenessProbe.initialDelaySeconds | int | `60` | | +| livenessProbe.periodSeconds | int | `10` | | +| livenessProbe.successThreshold | int | `1` | | +| livenessProbe.timeoutSeconds | int | `1` | | +| log.level | string | `"INFO"` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| readinessProbe.enabled | bool | `true` | | +| readinessProbe.failureThreshold | int | `3` | | +| readinessProbe.initialDelaySeconds | int | `30` | | +| readinessProbe.periodSeconds | int | `10` | | +| readinessProbe.successThreshold | int | `1` | | +| readinessProbe.timeoutSeconds | int | `1` | | +| replicaCount | int | `1` | | +| resources.limits | object | `{}` | | +| resources.requests | object | `{}` | | +| secrets | object | `{}` | | +| service.annotations | object | `{}` | | +| service.port | int | `8007` | | +| service.type | string | `"ClusterIP"` | | +| tolerations | list | `[]` | | +| workloadApi | object | `{}` | | + diff --git a/helm/airbyte-v1/charts/workload-api-server/templates/_helpers.tpl b/helm/airbyte-v1/charts/workload-api-server/templates/_helpers.tpl new file mode 100644 index 00000000..847ec7b4 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-api-server/templates/_helpers.tpl @@ -0,0 +1,59 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "airbyte.labels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "airbyte.selectorLabels" -}} +app.kubernetes.io/name: {{ include "airbyte.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Define db secret +*/}} + +{{- define "database.secret.name" -}} +{{- printf "%s-postgresql" .Release.Name }} +{{- end }} diff --git a/helm/airbyte-v1/charts/workload-api-server/templates/_images.tpl b/helm/airbyte-v1/charts/workload-api-server/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-api-server/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/workload-api-server/templates/deployment.yaml b/helm/airbyte-v1/charts/workload-api-server/templates/deployment.yaml new file mode 100644 index 00000000..9eb4fcdd --- /dev/null +++ b/helm/airbyte-v1/charts/workload-api-server/templates/deployment.yaml @@ -0,0 +1,208 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "common.names.fullname" . }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} +spec: + minReadySeconds: 30 + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "airbyte.selectorLabels" . | nindent 6 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 6 }} + {{- end }} + strategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 0 + maxSurge: 100% + template: + metadata: + labels: + {{- include "airbyte.selectorLabels" . | nindent 8 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 8 }} + {{- end }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.podAnnotations }} + annotations: + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ .Values.global.serviceAccountName }} + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.extraInitContainers }} + initContainers: + {{- toYaml .Values.extraInitContainers | nindent 6 }} + {{- end }} + containers: + - name: airbyte-workload-api-server-container + image: {{ include "imageUrl" (list .Values.image $) }} + imagePullPolicy: "{{ .Values.image.pullPolicy }}" + env: + {{- if .Values.debug.enabled }} + - name: JAVA_TOOL_OPTIONS + value: "-Xdebug -agentlib:jdwp=transport=dt_socket,address=0.0.0.0:{{ .Values.debug.remoteDebugPort }},server=y,suspend=n" + {{- end }} + {{- if eq .Values.global.deploymentMode "oss" }} + - name: AIRBYTE_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: AIRBYTE_VERSION + - name: INTERNAL_API_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: INTERNAL_API_HOST + - name: AIRBYTE_API_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: AIRBYTE_API_HOST + - name: MICROMETER_METRICS_ENABLED + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MICROMETER_METRICS_ENABLED + - name: MICROMETER_METRICS_STATSD_FLAVOR + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MICROMETER_METRICS_STATSD_FLAVOR + - name: STATSD_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STATSD_HOST + - name: STATSD_PORT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STATSD_PORT + - name: TEMPORAL_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TEMPORAL_HOST + - name: WORKLOAD_API_BEARER_TOKEN + valueFrom: + secretKeyRef: + name: {{ index .Values "workloadApi" "bearerTokenSecretName" | default (printf "%s-airbyte-secrets" .Release.Name ) }} + key: {{ index .Values "workloadApi" "bearerTokenSecretKey" | default "WORKLOAD_API_BEARER_TOKEN" }} + # Database + {{- include "airbyte.database.envs" . | nindent 8 }} + + {{- end }} + + # Values from secret + {{- if .Values.secrets }} + {{- range $k, $v := .Values.secrets }} + - name: {{ $k }} + valueFrom: + secretKeyRef: + name: workload-api-secrets + key: {{ $k }} + {{- end }} + {{- end }} + + # Values from env + {{- if or .Values.env_vars .Values.global.env_vars }} + {{- range $k, $v := mergeOverwrite .Values.env_vars .Values.global.env_vars }} + - name: {{ $k }} + value: {{ $v | quote }} + {{- end }} + {{- end }} + + # Values from extraEnv for more compability(if you want to use external secret source or other stuff) + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 8 }} + {{- end }} + + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: /health/liveness + port: http + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: /health/liveness + port: http + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} + + ports: + - name: http + containerPort: 8007 + protocol: TCP + {{- if .Values.debug.enabled }} + - name: debug + containerPort: {{ .Values.debug.remoteDebugPort }} + protocol: TCP + {{- end }} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 10 }} + {{- end }} + {{- if .Values.containerSecurityContext }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 10 }} + {{- end }} + volumeMounts: + {{- if and (eq .Values.global.deploymentMode "oss") (eq (lower (default "" .Values.global.storage.type)) "gcs") }} + - name: gcs-log-creds-volume + mountPath: /secrets/gcs-log-creds + readOnly: true + {{- end }} + {{- if .Values.extraVolumeMounts }} +{{- toYaml .Values.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.global.extraVolumeMounts }} +{{- toYaml .Values.global.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 8 }} + {{- end }} + {{- if .Values.global.extraContainers }} + {{ toYaml .Values.global.extraContainers | nindent 8 }} + {{- end }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + {{- if and (eq .Values.global.deploymentMode "oss") (eq (lower (default "" .Values.global.storage.type)) "gcs") }} + - name: gcs-log-creds-volume + secret: + secretName: {{ ternary (printf "%s-gcs-log-creds" ( .Release.Name )) .Values.global.storage.storageSecretName (not ((.Values.global.storage).storageSecretName)) }} + {{- end }} + {{- if .Values.extraVolumes }} + {{- toYaml .Values.extraVolumes | nindent 6 }} + {{- end }} + {{- if .Values.global.extraVolumes }} + {{- toYaml .Values.global.extraVolumes | nindent 6 }} + {{- end }} diff --git a/helm/airbyte-v1/charts/workload-api-server/templates/secrets.yaml b/helm/airbyte-v1/charts/workload-api-server/templates/secrets.yaml new file mode 100644 index 00000000..03e6f309 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-api-server/templates/secrets.yaml @@ -0,0 +1,17 @@ +# Create secrets only for the local deployment + {{- if .Values.secrets }} +apiVersion: v1 +kind: Secret +metadata: + name: workload-api-secrets + labels: + {{- include "airbyte.labels" . | nindent 4 }} + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-1" +type: Opaque +data: + {{- range $k, $v := mergeOverwrite .Values.secrets .Values.global.secrets }} + {{ $k }}: {{ if $v }}{{ $v | b64enc }} {{else}}""{{end}} + {{- end }} + {{- end }} diff --git a/helm/airbyte-v1/charts/workload-api-server/templates/service.yaml b/helm/airbyte-v1/charts/workload-api-server/templates/service.yaml new file mode 100644 index 00000000..7319b2e2 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-api-server/templates/service.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{.Release.Name }}-workload-api-server-svc + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "airbyte.selectorLabels" . | nindent 4 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 4 }} + {{- end }} diff --git a/helm/airbyte-v1/charts/workload-api-server/values.yaml b/helm/airbyte-v1/charts/workload-api-server/values.yaml new file mode 100644 index 00000000..2c378abc --- /dev/null +++ b/helm/airbyte-v1/charts/workload-api-server/values.yaml @@ -0,0 +1,281 @@ +global: + serviceAccountName: placeholderServiceAccount + deploymentMode: oss + edition: community + configMapName: "" + secretName: "" + credVolumeOverride: "" + extraContainers: [] + ## extraSelectorLabels [object] - use to specify own additional selector labels for deployment + extraSelectorLabels: {} + ## extraLabels [object] - use to specify own additional labels for deployment + extraLabels: {} + database: + secretName: "" + secretValue: "" + + # Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "" + + logs: + ## logs.accessKey.password Logs Access Key + ## logs.accessKey.existingSecret + ## logs.accessKey.existingSecretKey + accessKey: + password: minio + existingSecret: "" + existingSecretKey: "" + ## logs.secretKey.password Logs Secret Key + ## logs.secretKey.existingSecret + ## logs.secretKey.existingSecretKey + secretKey: + password: minio123 + existingSecret: "" + existingSecretKey: "" + + ## logs.minio.enabled Switch to enable or disable the Minio helm chart + minio: + enabled: true + + ## logs.s3.enabled Switch to enable or disable custom S3 Log location + ## logs.s3.bucket Bucket name where logs should be stored + ## logs.s3.bucketRegion Region of the bucket (must be empty if using minio) + s3: + enabled: false + bucket: airbyte-dev-logs + bucketRegion: "" + + ## Google Cloud Storage (GCS) Log Location Configuration + ## logs.gcs.bucket GCS bucket name + ## logs.gcs.credentials The path the GCS creds are written to + ## logs.gcs.credentialsJson Base64 encoded json GCP credentials file contents + gcs: + bucket: "" + # If you are mounting an existing secret to extraVolumes on scheduler, server and worker + # deployments, then set credentials to the path of the mounted JSON file + credentials: "" + # If credentialsJson is set then credentials auto resolves (to /secrets/gcs-log-creds/gcp.json) + credentialsJson: "" + +enabled: true +## replicaCount Number of server replicas +replicaCount: 1 + +## image.repository The repository to use for the airbyte workload api server image. +## image.pullPolicy the pull policy to use for the airbyte workload api server image +## image.tag The airbyte workload api server image tag. Defaults to the chart's AppVersion +image: + repository: airbyte/workload-api-server + pullPolicy: IfNotPresent + +## podAnnotations [object] Add extra annotations to the server pod +## +podAnnotations: {} + +## podLabels [object] Add extra labels to the server pod +## +podLabels: {} + +## containerSecurityContext Security context for the container +## Examples: +## containerSecurityContext: +## runAsNonRoot: true +## runAsUser: 1000 +## readOnlyRootFilesystem: true +containerSecurityContext: {} + +## Configure extra options for the server containers' liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## livenessProbe.enabled Enable livenessProbe on the server +## livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe +## livenessProbe.periodSeconds Period seconds for livenessProbe +## livenessProbe.timeoutSeconds Timeout seconds for livenessProbe +## livenessProbe.failureThreshold Failure threshold for livenessProbe +## livenessProbe.successThreshold Success threshold for livenessProbe +## +livenessProbe: + enabled: true + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## readinessProbe.enabled Enable readinessProbe on the server +## readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe +## readinessProbe.periodSeconds Period seconds for readinessProbe +## readinessProbe.timeoutSeconds Timeout seconds for readinessProbe +## readinessProbe.failureThreshold Failure threshold for readinessProbe +## readinessProbe.successThreshold Success threshold for readinessProbe +## +readinessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## Server app resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## We usually recommend not to specify default resources and to leave this as a conscious +## choice for the user. This also increases chances charts run on environments with little +## resources, such as Minikube. If you do want to specify resources, uncomment the following +## lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## resources.limits [object] The resources limits for the server container +## resources.requests [object] The requested resources for the server container +resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + +## service.type The service type to use for the API server +## service.port The service port to expose the API server on +service: + type: ClusterIP + port: 8007 + annotations: {} + +## nodeSelector [object] Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## tolerations [array] Tolerations for server pod assignment. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## affinity [object] Affinity and anti-affinity for server pod assignment. +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## Configure the ingress resource that allows you to access the Airbyte API. +## ref: http://kubernetes.io/docs/user-guide/ingress/ +## webapp.ingress.enabled Set to true to enable ingress record generation +## webapp.ingress.className Specifies ingressClassName for clusters >= 1.18+ +## webapp.ingress.annotations [object] Ingress annotations done as key:value pairs +## webapp.ingress.hosts The list of hostnames to be covered with this ingress record. +## webapp.ingress.tls [array] Custom ingress TLS configuration +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: [] + # - host: chart-example.local + # paths: + # - path: / + # pathType: ImplementationSpecific + + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +## log.level The log level to log at +log: + level: "INFO" + +## extraVolumeMounts [array] Additional volumeMounts for server container(s). +## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumeMounts: +## - name: tmpdir +## mountPath: /tmp +## +extraVolumeMounts: [] + +## extraVolumes [array] Additional volumes for server pod(s). +## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumes: +## - name: tmpdir +## emptyDir: {} +## +extraVolumes: [] + +## extraContainer [array] Additional container for server pod(s) +## Example: +# extraContainers: +# - name: otel_collector +# image: somerepo/someimage:sometag +# args: [ +# "--important-args" +# ] +# ports: +# - containerPort: 443 +# volumeMounts: +# - name: volumeMountCool +# mountPath: /some/path +# readOnly: true +extraContainers: [] + +## extraInitContainers [array] Additional init containers for server pod(s) +## Example: +# extraInitContainers: +# - name: sleepy +# image: alpine +# command: ['sleep', '60'] + +extraInitContainers: [] + +## extraEnv [array] Supply extra env variables to main container using full notation +## Example: (With default env vars and values taken from generated config map) +# extraEnv: +# - name: AIRBYTE_VERSION +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: AIRBYTE_VERSION +## +extraEnv: [] +## secrets [object] Supply additional secrets to container +## Example: +## secrets: +## DATABASE_PASSWORD: strong-password +## DATABASE_USER: my-db-user +secrets: {} + +## env_vars [object] Supply extra env variables to main container using simplified notation +## Example: +# env_vars: +# AIRBYTE_VERSION: 0.40.4 + +# # Airbyte Internal Database, see https://docs.airbyte.io/operator-guides/configuring-airbyte-db +# DATABASE_HOST: airbyte-db-svc +# DATABASE_PORT: 5432 +# DATABASE_DB: airbyte +# # translate manually DATABASE_URL:jdbc:postgresql://${DATABASE_HOST}:${DATABASE_PORT/${DATABASE_DB} +# DATABASE_URL: jdbc:postgresql://airbyte-db-svc:5432/airbyte +# JOBS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION: 0.29.15.001 +# CONFIGS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION: 0.35.15.001 +env_vars: {} + + +## extraSelectorLabels [object] - use to specify own additional selector labels for deployment +extraSelectorLabels: {} +## extraLabels [object] - use to specify own additional labels for deployment +extraLabels: {} + + +## workloadApi: +## bearerTokenSecretName: workload-api-bearer-token-name kubernetes secret name where bearer token is stored +## bearerTokenSecretKey: workload-api-bearer-token-key kubernetes secret key where bearer token is stored +workloadApi: {} + +debug: + enabled: false + remoteDebugPort: 5005 diff --git a/helm/airbyte-v1/charts/workload-launcher/.helmignore b/helm/airbyte-v1/charts/workload-launcher/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/.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/airbyte-v1/charts/workload-launcher/Chart.lock b/helm/airbyte-v1/charts/workload-launcher/Chart.lock new file mode 100644 index 00000000..13ffbcf4 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.17.1 +digest: sha256:dacc73770a5640c011e067ff8840ddf89631fc19016c8d0a9e5ea160e7da8690 +generated: "2024-12-09T21:57:35.922522213Z" diff --git a/helm/airbyte-v1/charts/workload-launcher/Chart.yaml b/helm/airbyte-v1/charts/workload-launcher/Chart.yaml new file mode 100644 index 00000000..83cd8391 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: 1.3.0 +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: Helm chart to deploy airbyte-workload-launcher +name: workload-launcher +type: application +version: 1.3.0 diff --git a/helm/airbyte-v1/charts/workload-launcher/README.md b/helm/airbyte-v1/charts/workload-launcher/README.md new file mode 100644 index 00000000..d636166f --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/README.md @@ -0,0 +1,71 @@ +# workload-launcher + +![Version: 0.67.17](https://img.shields.io/badge/Version-0.67.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: dev](https://img.shields.io/badge/AppVersion-dev-informational?style=flat-square) + +Helm chart to deploy airbyte-workload-launcher + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 1.x.x | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| containerSecurityContext | object | `{}` | | +| debug.enabled | bool | `false` | | +| debug.remoteDebugPort | int | `5005` | | +| enabled | bool | `false` | | +| env_vars | object | `{}` | | +| extraContainers | list | `[]` | | +| extraEnv | list | `[]` | | +| extraInitContainers | list | `[]` | | +| extraLabels | object | `{}` | | +| extraSelectorLabels | object | `{}` | | +| extraVolumeMounts | list | `[]` | | +| extraVolumes | list | `[]` | | +| global.credVolumeOverride | string | `""` | | +| global.database.secretName | string | `""` | | +| global.database.secretValue | string | `""` | | +| global.extraContainers | list | `[]` | | +| global.extraLabels | object | `{}` | | +| global.extraSelectorLabels | object | `{}` | | +| global.jobs.kube.annotations | object | `{}` | | +| global.jobs.kube.images.busybox | string | `""` | | +| global.jobs.kube.images.curl | string | `""` | | +| global.jobs.kube.labels | object | `{}` | | +| global.jobs.kube.main_container_image_pull_secret | string | `""` | | +| global.jobs.kube.nodeSelector | object | `{}` | | +| global.jobs.kube.tolerations | list | `[]` | | +| global.jobs.resources.limits | object | `{}` | | +| global.jobs.resources.requests | object | `{}` | | +| global.secretName | string | `""` | | +| global.serviceAccountName | string | `"airbyte-admin"` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"airbyte/workload-launcher"` | | +| livenessProbe.enabled | bool | `true` | | +| livenessProbe.failureThreshold | int | `3` | | +| livenessProbe.initialDelaySeconds | int | `50` | | +| livenessProbe.periodSeconds | int | `10` | | +| livenessProbe.successThreshold | int | `1` | | +| livenessProbe.timeoutSeconds | int | `1` | | +| log.level | string | `"INFO"` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| readinessProbe.enabled | bool | `true` | | +| readinessProbe.failureThreshold | int | `3` | | +| readinessProbe.initialDelaySeconds | int | `10` | | +| readinessProbe.periodSeconds | int | `10` | | +| readinessProbe.successThreshold | int | `1` | | +| readinessProbe.timeoutSeconds | int | `1` | | +| replicaCount | int | `1` | | +| resources.limits | object | `{}` | | +| resources.requests | object | `{}` | | +| secrets | object | `{}` | | +| tolerations | list | `[]` | | +| workloadApi | object | `{}` | | + diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/.helmignore b/helm/airbyte-v1/charts/workload-launcher/charts/common/.helmignore new file mode 100644 index 00000000..50af0317 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/.helmignore @@ -0,0 +1,22 @@ +# 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 +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/Chart.yaml b/helm/airbyte-v1/charts/workload-launcher/charts/common/Chart.yaml new file mode 100644 index 00000000..39edbb3c --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/Chart.yaml @@ -0,0 +1,23 @@ +annotations: + category: Infrastructure +apiVersion: v2 +appVersion: 1.17.1 +description: A Library Helm Chart for grouping common logic between bitnami charts. + This chart is not deployable by itself. +home: https://github.com/bitnami/charts/tree/master/bitnami/common +icon: https://bitnami.com/downloads/logos/bitnami-mark.png +keywords: +- common +- helper +- template +- function +- bitnami +maintainers: +- name: Bitnami + url: https://github.com/bitnami/charts +name: common +sources: +- https://github.com/bitnami/charts +- https://www.bitnami.com/ +type: library +version: 1.17.1 diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/README.md b/helm/airbyte-v1/charts/workload-launcher/charts/common/README.md new file mode 100644 index 00000000..a2ecd604 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/README.md @@ -0,0 +1,350 @@ +# Bitnami Common Library Chart + +A [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between bitnami charts. + +## TL;DR + +```yaml +dependencies: + - name: common + version: 1.x.x + repository: https://charts.bitnami.com/bitnami +``` + +```bash +$ helm dependency update +``` + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.names.fullname" . }} +data: + myvalue: "Hello World" +``` + +## Introduction + +This chart provides a common template helpers which can be used to develop new charts using [Helm](https://helm.sh) package manager. + +Bitnami charts can be used with [Kubeapps](https://kubeapps.dev/) for deployment and management of Helm Charts in clusters. + +## Prerequisites + +- Kubernetes 1.19+ +- Helm 3.2.0+ + +## Parameters + +The following table lists the helpers available in the library which are scoped in different sections. + +### Affinities + +| Helper identifier | Description | Expected Input | +|-------------------------------|------------------------------------------------------|------------------------------------------------| +| `common.affinities.nodes.soft` | Return a soft nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` | +| `common.affinities.nodes.hard` | Return a hard nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` | +| `common.affinities.pods.soft` | Return a soft podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` | +| `common.affinities.pods.hard` | Return a hard podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` | + +### Capabilities + +| Helper identifier | Description | Expected Input | +|------------------------------------------------|------------------------------------------------------------------------------------------------|-------------------| +| `common.capabilities.kubeVersion` | Return the target Kubernetes version (using client default if .Values.kubeVersion is not set). | `.` Chart context | +| `common.capabilities.cronjob.apiVersion` | Return the appropriate apiVersion for cronjob. | `.` Chart context | +| `common.capabilities.deployment.apiVersion` | Return the appropriate apiVersion for deployment. | `.` Chart context | +| `common.capabilities.statefulset.apiVersion` | Return the appropriate apiVersion for statefulset. | `.` Chart context | +| `common.capabilities.ingress.apiVersion` | Return the appropriate apiVersion for ingress. | `.` Chart context | +| `common.capabilities.rbac.apiVersion` | Return the appropriate apiVersion for RBAC resources. | `.` Chart context | +| `common.capabilities.crd.apiVersion` | Return the appropriate apiVersion for CRDs. | `.` Chart context | +| `common.capabilities.policy.apiVersion` | Return the appropriate apiVersion for podsecuritypolicy. | `.` Chart context | +| `common.capabilities.networkPolicy.apiVersion` | Return the appropriate apiVersion for networkpolicy. | `.` Chart context | +| `common.capabilities.apiService.apiVersion` | Return the appropriate apiVersion for APIService. | `.` Chart context | +| `common.capabilities.hpa.apiVersion` | Return the appropriate apiVersion for Horizontal Pod Autoscaler | `.` Chart context | +| `common.capabilities.supportsHelmVersion` | Returns true if the used Helm version is 3.3+ | `.` Chart context | + +### Errors + +| Helper identifier | Description | Expected Input | +|-----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| +| `common.errors.upgrade.passwords.empty` | It will ensure required passwords are given when we are upgrading a chart. If `validationErrors` is not empty it will throw an error and will stop the upgrade action. | `dict "validationErrors" (list $validationError00 $validationError01) "context" $` | + +### Images + +| Helper identifier | Description | Expected Input | +|-----------------------------|------------------------------------------------------|---------------------------------------------------------------------------------------------------------| +| `common.images.image` | Return the proper and full image name | `dict "imageRoot" .Values.path.to.the.image "global" $`, see [ImageRoot](#imageroot) for the structure. | +| `common.images.pullSecrets` | Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global` | +| `common.images.renderPullSecrets` | Return the proper Docker Image Registry Secret Names (evaluates values as templates) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $` | + +### Ingress + +| Helper identifier | Description | Expected Input | +|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.ingress.backend` | Generate a proper Ingress backend entry depending on the API version | `dict "serviceName" "foo" "servicePort" "bar"`, see the [Ingress deprecation notice](https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/) for the syntax differences | +| `common.ingress.supportsPathType` | Prints "true" if the pathType field is supported | `.` Chart context | +| `common.ingress.supportsIngressClassname` | Prints "true" if the ingressClassname field is supported | `.` Chart context | +| `common.ingress.certManagerRequest` | Prints "true" if required cert-manager annotations for TLS signed certificates are set in the Ingress annotations | `dict "annotations" .Values.path.to.the.ingress.annotations` | + +### Labels + +| Helper identifier | Description | Expected Input | +|-----------------------------|-----------------------------------------------------------------------------|-------------------| +| `common.labels.standard` | Return Kubernetes standard labels | `.` Chart context | +| `common.labels.matchLabels` | Labels to use on `deploy.spec.selector.matchLabels` and `svc.spec.selector` | `.` Chart context | + +### Names + +| Helper identifier | Description | Expected Input | +|-----------------------------------|-----------------------------------------------------------------------|-------------------| +| `common.names.name` | Expand the name of the chart or use `.Values.nameOverride` | `.` Chart context | +| `common.names.fullname` | Create a default fully qualified app name. | `.` Chart context | +| `common.names.namespace` | Allow the release namespace to be overridden | `.` Chart context | +| `common.names.fullname.namespace` | Create a fully qualified app name adding the installation's namespace | `.` Chart context | +| `common.names.chart` | Chart name plus version | `.` Chart context | + +### Secrets + +| Helper identifier | Description | Expected Input | +|---------------------------|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.secrets.name` | Generate the name of the secret. | `dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $` see [ExistingSecret](#existingsecret) for the structure. | +| `common.secrets.key` | Generate secret key. | `dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName"` see [ExistingSecret](#existingsecret) for the structure. | +| `common.passwords.manage` | Generate secret password or retrieve one if already created. | `dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $`, length, strong and chartNAme fields are optional. | +| `common.secrets.exists` | Returns whether a previous generated secret already exists. | `dict "secret" "secret-name" "context" $` | + +### Storage + +| Helper identifier | Description | Expected Input | +|-------------------------------|---------------------------------------|---------------------------------------------------------------------------------------------------------------------| +| `common.storage.class` | Return the proper Storage Class | `dict "persistence" .Values.path.to.the.persistence "global" $`, see [Persistence](#persistence) for the structure. | + +### TplValues + +| Helper identifier | Description | Expected Input | +|---------------------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.tplvalues.render` | Renders a value that contains template | `dict "value" .Values.path.to.the.Value "context" $`, value is the value should rendered as template, context frequently is the chart context `$` or `.` | + +### Utils + +| Helper identifier | Description | Expected Input | +|--------------------------------|------------------------------------------------------------------------------------------|------------------------------------------------------------------------| +| `common.utils.fieldToEnvVar` | Build environment variable name given a field. | `dict "field" "my-password"` | +| `common.utils.secret.getvalue` | Print instructions to get a secret value. | `dict "secret" "secret-name" "field" "secret-value-field" "context" $` | +| `common.utils.getValueFromKey` | Gets a value from `.Values` object given its key path | `dict "key" "path.to.key" "context" $` | +| `common.utils.getKeyFromList` | Returns first `.Values` key with a defined value or first of the list if all non-defined | `dict "keys" (list "path.to.key1" "path.to.key2") "context" $` | + +### Validations + +| Helper identifier | Description | Expected Input | +|--------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.validations.values.single.empty` | Validate a value must not be empty. | `dict "valueKey" "path.to.value" "secret" "secret.name" "field" "my-password" "subchart" "subchart" "context" $` secret, field and subchart are optional. In case they are given, the helper will generate a how to get instruction. See [ValidateValue](#validatevalue) | +| `common.validations.values.multiple.empty` | Validate a multiple values must not be empty. It returns a shared error for all the values. | `dict "required" (list $validateValueConf00 $validateValueConf01) "context" $`. See [ValidateValue](#validatevalue) | +| `common.validations.values.mariadb.passwords` | This helper will ensure required password for MariaDB are not empty. It returns a shared error for all the values. | `dict "secret" "mariadb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mariadb chart and the helper. | +| `common.validations.values.mysql.passwords` | This helper will ensure required password for MySQL are not empty. It returns a shared error for all the values. | `dict "secret" "mysql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mysql chart and the helper. | +| `common.validations.values.postgresql.passwords` | This helper will ensure required password for PostgreSQL are not empty. It returns a shared error for all the values. | `dict "secret" "postgresql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use postgresql chart and the helper. | +| `common.validations.values.redis.passwords` | This helper will ensure required password for Redis® are not empty. It returns a shared error for all the values. | `dict "secret" "redis-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use redis chart and the helper. | +| `common.validations.values.cassandra.passwords` | This helper will ensure required password for Cassandra are not empty. It returns a shared error for all the values. | `dict "secret" "cassandra-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use cassandra chart and the helper. | +| `common.validations.values.mongodb.passwords` | This helper will ensure required password for MongoDB® are not empty. It returns a shared error for all the values. | `dict "secret" "mongodb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mongodb chart and the helper. | + +### Warnings + +| Helper identifier | Description | Expected Input | +|------------------------------|----------------------------------|------------------------------------------------------------| +| `common.warnings.rollingTag` | Warning about using rolling tag. | `ImageRoot` see [ImageRoot](#imageroot) for the structure. | + +## Special input schemas + +### ImageRoot + +```yaml +registry: + type: string + description: Docker registry where the image is located + example: docker.io + +repository: + type: string + description: Repository and image name + example: bitnami/nginx + +tag: + type: string + description: image tag + example: 1.16.1-debian-10-r63 + +pullPolicy: + type: string + description: Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + +pullSecrets: + type: array + items: + type: string + description: Optionally specify an array of imagePullSecrets (evaluated as templates). + +debug: + type: boolean + description: Set to true if you would like to see extra information on logs + example: false + +## An instance would be: +# registry: docker.io +# repository: bitnami/nginx +# tag: 1.16.1-debian-10-r63 +# pullPolicy: IfNotPresent +# debug: false +``` + +### Persistence + +```yaml +enabled: + type: boolean + description: Whether enable persistence. + example: true + +storageClass: + type: string + description: Ghost data Persistent Volume Storage Class, If set to "-", storageClassName: "" which disables dynamic provisioning. + example: "-" + +accessMode: + type: string + description: Access mode for the Persistent Volume Storage. + example: ReadWriteOnce + +size: + type: string + description: Size the Persistent Volume Storage. + example: 8Gi + +path: + type: string + description: Path to be persisted. + example: /bitnami + +## An instance would be: +# enabled: true +# storageClass: "-" +# accessMode: ReadWriteOnce +# size: 8Gi +# path: /bitnami +``` + +### ExistingSecret + +```yaml +name: + type: string + description: Name of the existing secret. + example: mySecret +keyMapping: + description: Mapping between the expected key name and the name of the key in the existing secret. + type: object + +## An instance would be: +# name: mySecret +# keyMapping: +# password: myPasswordKey +``` + +#### Example of use + +When we store sensitive data for a deployment in a secret, some times we want to give to users the possibility of using theirs existing secrets. + +```yaml +# templates/secret.yaml +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.names.fullname" . }} + labels: + app: {{ include "common.names.fullname" . }} +type: Opaque +data: + password: {{ .Values.password | b64enc | quote }} + +# templates/dpl.yaml +--- +... + env: + - name: PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "common.secrets.name" (dict "existingSecret" .Values.existingSecret "context" $) }} + key: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "password") }} +... + +# values.yaml +--- +name: mySecret +keyMapping: + password: myPasswordKey +``` + +### ValidateValue + +#### NOTES.txt + +```console +{{- $validateValueConf00 := (dict "valueKey" "path.to.value00" "secret" "secretName" "field" "password-00") -}} +{{- $validateValueConf01 := (dict "valueKey" "path.to.value01" "secret" "secretName" "field" "password-01") -}} + +{{ include "common.validations.values.multiple.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }} +``` + +If we force those values to be empty we will see some alerts + +```console +$ helm install test mychart --set path.to.value00="",path.to.value01="" + 'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value: + + export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 -d) + + 'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value: + + export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 -d) +``` + +## Upgrading + +### To 1.0.0 + +[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL. + +**What changes were introduced in this major version?** + +- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field. +- Use `type: library`. [Here](https://v3.helm.sh/docs/faq/#library-chart-support) you can find more information. +- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts + +**Considerations when upgrading to this version** + +- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues +- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore +- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3 + +**Useful links** + +- https://docs.bitnami.com/tutorials/resolve-helm2-helm3-post-migration-issues/ +- https://helm.sh/docs/topics/v2_v3_migration/ +- https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/ + +## License + +Copyright © 2022 Bitnami + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_affinities.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_affinities.tpl new file mode 100644 index 00000000..2387be26 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_affinities.tpl @@ -0,0 +1,102 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Return a soft nodeAffinity definition +{{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes.soft" -}} +preferredDuringSchedulingIgnoredDuringExecution: + - preference: + matchExpressions: + - key: {{ .key }} + operator: In + values: + {{- range .values }} + - {{ . | quote }} + {{- end }} + weight: 1 +{{- end -}} + +{{/* +Return a hard nodeAffinity definition +{{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes.hard" -}} +requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: {{ .key }} + operator: In + values: + {{- range .values }} + - {{ . | quote }} + {{- end }} +{{- end -}} + +{{/* +Return a nodeAffinity definition +{{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes" -}} + {{- if eq .type "soft" }} + {{- include "common.affinities.nodes.soft" . -}} + {{- else if eq .type "hard" }} + {{- include "common.affinities.nodes.hard" . -}} + {{- end -}} +{{- end -}} + +{{/* +Return a soft podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods.soft" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}} +*/}} +{{- define "common.affinities.pods.soft" -}} +{{- $component := default "" .component -}} +{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} +preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 10 }} + {{- if not (empty $component) }} + {{ printf "app.kubernetes.io/component: %s" $component }} + {{- end }} + {{- range $key, $value := $extraMatchLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + namespaces: + - {{ include "common.names.namespace" .context | quote }} + topologyKey: kubernetes.io/hostname + weight: 1 +{{- end -}} + +{{/* +Return a hard podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods.hard" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}} +*/}} +{{- define "common.affinities.pods.hard" -}} +{{- $component := default "" .component -}} +{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} +requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 8 }} + {{- if not (empty $component) }} + {{ printf "app.kubernetes.io/component: %s" $component }} + {{- end }} + {{- range $key, $value := $extraMatchLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + namespaces: + - {{ include "common.names.namespace" .context | quote }} + topologyKey: kubernetes.io/hostname +{{- end -}} + +{{/* +Return a podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.pods" -}} + {{- if eq .type "soft" }} + {{- include "common.affinities.pods.soft" . -}} + {{- else if eq .type "hard" }} + {{- include "common.affinities.pods.hard" . -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_capabilities.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_capabilities.tpl new file mode 100644 index 00000000..9d9b7600 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_capabilities.tpl @@ -0,0 +1,154 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Return the target Kubernetes version +*/}} +{{- define "common.capabilities.kubeVersion" -}} +{{- if .Values.global }} + {{- if .Values.global.kubeVersion }} + {{- .Values.global.kubeVersion -}} + {{- else }} + {{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} + {{- end -}} +{{- else }} +{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for poddisruptionbudget. +*/}} +{{- define "common.capabilities.policy.apiVersion" -}} +{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "policy/v1beta1" -}} +{{- else -}} +{{- print "policy/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for networkpolicy. +*/}} +{{- define "common.capabilities.networkPolicy.apiVersion" -}} +{{- if semverCompare "<1.7-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for cronjob. +*/}} +{{- define "common.capabilities.cronjob.apiVersion" -}} +{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "batch/v1beta1" -}} +{{- else -}} +{{- print "batch/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for deployment. +*/}} +{{- define "common.capabilities.deployment.apiVersion" -}} +{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for statefulset. +*/}} +{{- define "common.capabilities.statefulset.apiVersion" -}} +{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apps/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for ingress. +*/}} +{{- define "common.capabilities.ingress.apiVersion" -}} +{{- if .Values.ingress -}} +{{- if .Values.ingress.apiVersion -}} +{{- .Values.ingress.apiVersion -}} +{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end }} +{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for RBAC resources. +*/}} +{{- define "common.capabilities.rbac.apiVersion" -}} +{{- if semverCompare "<1.17-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "rbac.authorization.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "rbac.authorization.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for CRDs. +*/}} +{{- define "common.capabilities.crd.apiVersion" -}} +{{- if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apiextensions.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "apiextensions.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for APIService. +*/}} +{{- define "common.capabilities.apiService.apiVersion" -}} +{{- if semverCompare "<1.10-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apiregistration.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "apiregistration.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for Horizontal Pod Autoscaler. +*/}} +{{- define "common.capabilities.hpa.apiVersion" -}} +{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .context) -}} +{{- if .beta2 -}} +{{- print "autoscaling/v2beta2" -}} +{{- else -}} +{{- print "autoscaling/v2beta1" -}} +{{- end -}} +{{- else -}} +{{- print "autoscaling/v2" -}} +{{- end -}} +{{- end -}} + +{{/* +Returns true if the used Helm version is 3.3+. +A way to check the used Helm version was not introduced until version 3.3.0 with .Capabilities.HelmVersion, which contains an additional "{}}" structure. +This check is introduced as a regexMatch instead of {{ if .Capabilities.HelmVersion }} because checking for the key HelmVersion in <3.3 results in a "interface not found" error. +**To be removed when the catalog's minimun Helm version is 3.3** +*/}} +{{- define "common.capabilities.supportsHelmVersion" -}} +{{- if regexMatch "{(v[0-9])*[^}]*}}$" (.Capabilities | toString ) }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_errors.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_errors.tpl new file mode 100644 index 00000000..a79cc2e3 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_errors.tpl @@ -0,0 +1,23 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Through error when upgrading using empty passwords values that must not be empty. + +Usage: +{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}} +{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}} +{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }} + +Required password params: + - validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error. + - context - Context - Required. Parent context. +*/}} +{{- define "common.errors.upgrade.passwords.empty" -}} + {{- $validationErrors := join "" .validationErrors -}} + {{- if and $validationErrors .context.Release.IsUpgrade -}} + {{- $errorString := "\nPASSWORDS ERROR: You must provide your current passwords when upgrading the release." -}} + {{- $errorString = print $errorString "\n Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims." -}} + {{- $errorString = print $errorString "\n Further information can be obtained at https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases" -}} + {{- $errorString = print $errorString "\n%s" -}} + {{- printf $errorString $validationErrors | fail -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_images.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_images.tpl new file mode 100644 index 00000000..42ffbc72 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_images.tpl @@ -0,0 +1,75 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Return the proper image name +{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }} +*/}} +{{- define "common.images.image" -}} +{{- $registryName := .imageRoot.registry -}} +{{- $repositoryName := .imageRoot.repository -}} +{{- $tag := .imageRoot.tag | toString -}} +{{- if .global }} + {{- if .global.imageRegistry }} + {{- $registryName = .global.imageRegistry -}} + {{- end -}} +{{- end -}} +{{- if $registryName }} +{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- else -}} +{{- printf "%s:%s" $repositoryName $tag -}} +{{- end -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) +{{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }} +*/}} +{{- define "common.images.pullSecrets" -}} + {{- $pullSecrets := list }} + + {{- if .global }} + {{- range .global.imagePullSecrets -}} + {{- $pullSecrets = append $pullSecrets . -}} + {{- end -}} + {{- end -}} + + {{- range .images -}} + {{- range .pullSecrets -}} + {{- $pullSecrets = append $pullSecrets . -}} + {{- end -}} + {{- end -}} + + {{- if (not (empty $pullSecrets)) }} +imagePullSecrets: + {{- range $pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names evaluating values as templates +{{ include "common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }} +*/}} +{{- define "common.images.renderPullSecrets" -}} + {{- $pullSecrets := list }} + {{- $context := .context }} + + {{- if $context.Values.global }} + {{- range $context.Values.global.imagePullSecrets -}} + {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} + {{- end -}} + {{- end -}} + + {{- range .images -}} + {{- range .pullSecrets -}} + {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} + {{- end -}} + {{- end -}} + + {{- if (not (empty $pullSecrets)) }} +imagePullSecrets: + {{- range $pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_ingress.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_ingress.tpl new file mode 100644 index 00000000..8caf73a6 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_ingress.tpl @@ -0,0 +1,68 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Generate backend entry that is compatible with all Kubernetes API versions. + +Usage: +{{ include "common.ingress.backend" (dict "serviceName" "backendName" "servicePort" "backendPort" "context" $) }} + +Params: + - serviceName - String. Name of an existing service backend + - servicePort - String/Int. Port name (or number) of the service. It will be translated to different yaml depending if it is a string or an integer. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "common.ingress.backend" -}} +{{- $apiVersion := (include "common.capabilities.ingress.apiVersion" .context) -}} +{{- if or (eq $apiVersion "extensions/v1beta1") (eq $apiVersion "networking.k8s.io/v1beta1") -}} +serviceName: {{ .serviceName }} +servicePort: {{ .servicePort }} +{{- else -}} +service: + name: {{ .serviceName }} + port: + {{- if typeIs "string" .servicePort }} + name: {{ .servicePort }} + {{- else if or (typeIs "int" .servicePort) (typeIs "float64" .servicePort) }} + number: {{ .servicePort | int }} + {{- end }} +{{- end -}} +{{- end -}} + +{{/* +Print "true" if the API pathType field is supported +Usage: +{{ include "common.ingress.supportsPathType" . }} +*/}} +{{- define "common.ingress.supportsPathType" -}} +{{- if (semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .)) -}} +{{- print "false" -}} +{{- else -}} +{{- print "true" -}} +{{- end -}} +{{- end -}} + +{{/* +Returns true if the ingressClassname field is supported +Usage: +{{ include "common.ingress.supportsIngressClassname" . }} +*/}} +{{- define "common.ingress.supportsIngressClassname" -}} +{{- if semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "false" -}} +{{- else -}} +{{- print "true" -}} +{{- end -}} +{{- end -}} + +{{/* +Return true if cert-manager required annotations for TLS signed +certificates are set in the Ingress annotations +Ref: https://cert-manager.io/docs/usage/ingress/#supported-annotations +Usage: +{{ include "common.ingress.certManagerRequest" ( dict "annotations" .Values.path.to.the.ingress.annotations ) }} +*/}} +{{- define "common.ingress.certManagerRequest" -}} +{{ if or (hasKey .annotations "cert-manager.io/cluster-issuer") (hasKey .annotations "cert-manager.io/issuer") }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_labels.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_labels.tpl new file mode 100644 index 00000000..252066c7 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_labels.tpl @@ -0,0 +1,18 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Kubernetes standard labels +*/}} +{{- define "common.labels.standard" -}} +app.kubernetes.io/name: {{ include "common.names.name" . }} +helm.sh/chart: {{ include "common.names.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector +*/}} +{{- define "common.labels.matchLabels" -}} +app.kubernetes.io/name: {{ include "common.names.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_names.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_names.tpl new file mode 100644 index 00000000..1bdac8b7 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_names.tpl @@ -0,0 +1,70 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "common.names.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "common.names.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "common.names.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create a default fully qualified dependency name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +Usage: +{{ include "common.names.dependency.fullname" (dict "chartName" "dependency-chart-name" "chartValues" .Values.dependency-chart "context" $) }} +*/}} +{{- define "common.names.dependency.fullname" -}} +{{- if .chartValues.fullnameOverride -}} +{{- .chartValues.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .chartName .chartValues.nameOverride -}} +{{- if contains $name .context.Release.Name -}} +{{- .context.Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .context.Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Allow the release namespace to be overridden for multi-namespace deployments in combined charts. +*/}} +{{- define "common.names.namespace" -}} +{{- if .Values.namespaceOverride -}} +{{- .Values.namespaceOverride -}} +{{- else -}} +{{- .Release.Namespace -}} +{{- end -}} +{{- end -}} + +{{/* +Create a fully qualified app name adding the installation's namespace. +*/}} +{{- define "common.names.fullname.namespace" -}} +{{- printf "%s-%s" (include "common.names.fullname" .) (include "common.names.namespace" .) | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_secrets.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_secrets.tpl new file mode 100644 index 00000000..a53fb44f --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_secrets.tpl @@ -0,0 +1,140 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Generate secret name. + +Usage: +{{ include "common.secrets.name" (dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $) }} + +Params: + - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user + to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility. + +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret + - defaultNameSuffix - String - Optional. It is used only if we have several secrets in the same deployment. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "common.secrets.name" -}} +{{- $name := (include "common.names.fullname" .context) -}} + +{{- if .defaultNameSuffix -}} +{{- $name = printf "%s-%s" $name .defaultNameSuffix | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- with .existingSecret -}} +{{- if not (typeIs "string" .) -}} +{{- with .name -}} +{{- $name = . -}} +{{- end -}} +{{- else -}} +{{- $name = . -}} +{{- end -}} +{{- end -}} + +{{- printf "%s" $name -}} +{{- end -}} + +{{/* +Generate secret key. + +Usage: +{{ include "common.secrets.key" (dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName") }} + +Params: + - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user + to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility. + +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret + - key - String - Required. Name of the key in the secret. +*/}} +{{- define "common.secrets.key" -}} +{{- $key := .key -}} + +{{- if .existingSecret -}} + {{- if not (typeIs "string" .existingSecret) -}} + {{- if .existingSecret.keyMapping -}} + {{- $key = index .existingSecret.keyMapping $.key -}} + {{- end -}} + {{- end }} +{{- end -}} + +{{- printf "%s" $key -}} +{{- end -}} + +{{/* +Generate secret password or retrieve one if already created. + +Usage: +{{ include "common.secrets.passwords.manage" (dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $) }} + +Params: + - secret - String - Required - Name of the 'Secret' resource where the password is stored. + - key - String - Required - Name of the key in the secret. + - providedValues - List - Required - The path to the validating value in the values.yaml, e.g: "mysql.password". Will pick first parameter with a defined value. + - length - int - Optional - Length of the generated random password. + - strong - Boolean - Optional - Whether to add symbols to the generated random password. + - chartName - String - Optional - Name of the chart used when said chart is deployed as a subchart. + - context - Context - Required - Parent context. + +The order in which this function returns a secret password: + 1. Already existing 'Secret' resource + (If a 'Secret' resource is found under the name provided to the 'secret' parameter to this function and that 'Secret' resource contains a key with the name passed as the 'key' parameter to this function then the value of this existing secret password will be returned) + 2. Password provided via the values.yaml + (If one of the keys passed to the 'providedValues' parameter to this function is a valid path to a key in the values.yaml and has a value, the value of the first key with a value will be returned) + 3. Randomly generated secret password + (A new random secret password with the length specified in the 'length' parameter will be generated and returned) + +*/}} +{{- define "common.secrets.passwords.manage" -}} + +{{- $password := "" }} +{{- $subchart := "" }} +{{- $chartName := default "" .chartName }} +{{- $passwordLength := default 10 .length }} +{{- $providedPasswordKey := include "common.utils.getKeyFromList" (dict "keys" .providedValues "context" $.context) }} +{{- $providedPasswordValue := include "common.utils.getValueFromKey" (dict "key" $providedPasswordKey "context" $.context) }} +{{- $secretData := (lookup "v1" "Secret" $.context.Release.Namespace .secret).data }} +{{- if $secretData }} + {{- if hasKey $secretData .key }} + {{- $password = index $secretData .key }} + {{- else }} + {{- printf "\nPASSWORDS ERROR: The secret \"%s\" does not contain the key \"%s\"\n" .secret .key | fail -}} + {{- end -}} +{{- else if $providedPasswordValue }} + {{- $password = $providedPasswordValue | toString | b64enc | quote }} +{{- else }} + + {{- if .context.Values.enabled }} + {{- $subchart = $chartName }} + {{- end -}} + + {{- $requiredPassword := dict "valueKey" $providedPasswordKey "secret" .secret "field" .key "subchart" $subchart "context" $.context -}} + {{- $requiredPasswordError := include "common.validations.values.single.empty" $requiredPassword -}} + {{- $passwordValidationErrors := list $requiredPasswordError -}} + {{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordValidationErrors "context" $.context) -}} + + {{- if .strong }} + {{- $subStr := list (lower (randAlpha 1)) (randNumeric 1) (upper (randAlpha 1)) | join "_" }} + {{- $password = randAscii $passwordLength }} + {{- $password = regexReplaceAllLiteral "\\W" $password "@" | substr 5 $passwordLength }} + {{- $password = printf "%s%s" $subStr $password | toString | shuffle | b64enc | quote }} + {{- else }} + {{- $password = randAlphaNum $passwordLength | b64enc | quote }} + {{- end }} +{{- end -}} +{{- printf "%s" $password -}} +{{- end -}} + +{{/* +Returns whether a previous generated secret already exists + +Usage: +{{ include "common.secrets.exists" (dict "secret" "secret-name" "context" $) }} + +Params: + - secret - String - Required - Name of the 'Secret' resource where the password is stored. + - context - Context - Required - Parent context. +*/}} +{{- define "common.secrets.exists" -}} +{{- $secret := (lookup "v1" "Secret" $.context.Release.Namespace .secret) }} +{{- if $secret }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_storage.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_storage.tpl new file mode 100644 index 00000000..60e2a844 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_storage.tpl @@ -0,0 +1,23 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Return the proper Storage Class +{{ include "common.storage.class" ( dict "persistence" .Values.path.to.the.persistence "global" $) }} +*/}} +{{- define "common.storage.class" -}} + +{{- $storageClass := .persistence.storageClass -}} +{{- if .global -}} + {{- if .global.storageClass -}} + {{- $storageClass = .global.storageClass -}} + {{- end -}} +{{- end -}} + +{{- if $storageClass -}} + {{- if (eq "-" $storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" $storageClass -}} + {{- end -}} +{{- end -}} + +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_tplvalues.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_tplvalues.tpl new file mode 100644 index 00000000..2db16685 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_tplvalues.tpl @@ -0,0 +1,13 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Renders a value that contains template. +Usage: +{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }} +*/}} +{{- define "common.tplvalues.render" -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{- else }} + {{- tpl (.value | toYaml) .context }} + {{- end }} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_utils.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_utils.tpl new file mode 100644 index 00000000..8c22b2a3 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_utils.tpl @@ -0,0 +1,62 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Print instructions to get a secret value. +Usage: +{{ include "common.utils.secret.getvalue" (dict "secret" "secret-name" "field" "secret-value-field" "context" $) }} +*/}} +{{- define "common.utils.secret.getvalue" -}} +{{- $varname := include "common.utils.fieldToEnvVar" . -}} +export {{ $varname }}=$(kubectl get secret --namespace {{ .context.Release.Namespace | quote }} {{ .secret }} -o jsonpath="{.data.{{ .field }}}" | base64 -d) +{{- end -}} + +{{/* +Build env var name given a field +Usage: +{{ include "common.utils.fieldToEnvVar" dict "field" "my-password" }} +*/}} +{{- define "common.utils.fieldToEnvVar" -}} + {{- $fieldNameSplit := splitList "-" .field -}} + {{- $upperCaseFieldNameSplit := list -}} + + {{- range $fieldNameSplit -}} + {{- $upperCaseFieldNameSplit = append $upperCaseFieldNameSplit ( upper . ) -}} + {{- end -}} + + {{ join "_" $upperCaseFieldNameSplit }} +{{- end -}} + +{{/* +Gets a value from .Values given +Usage: +{{ include "common.utils.getValueFromKey" (dict "key" "path.to.key" "context" $) }} +*/}} +{{- define "common.utils.getValueFromKey" -}} +{{- $splitKey := splitList "." .key -}} +{{- $value := "" -}} +{{- $latestObj := $.context.Values -}} +{{- range $splitKey -}} + {{- if not $latestObj -}} + {{- printf "please review the entire path of '%s' exists in values" $.key | fail -}} + {{- end -}} + {{- $value = ( index $latestObj . ) -}} + {{- $latestObj = $value -}} +{{- end -}} +{{- printf "%v" (default "" $value) -}} +{{- end -}} + +{{/* +Returns first .Values key with a defined value or first of the list if all non-defined +Usage: +{{ include "common.utils.getKeyFromList" (dict "keys" (list "path.to.key1" "path.to.key2") "context" $) }} +*/}} +{{- define "common.utils.getKeyFromList" -}} +{{- $key := first .keys -}} +{{- $reverseKeys := reverse .keys }} +{{- range $reverseKeys }} + {{- $value := include "common.utils.getValueFromKey" (dict "key" . "context" $.context ) }} + {{- if $value -}} + {{- $key = . }} + {{- end -}} +{{- end -}} +{{- printf "%s" $key -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_warnings.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_warnings.tpl new file mode 100644 index 00000000..ae10fa41 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/_warnings.tpl @@ -0,0 +1,14 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Warning about using rolling tag. +Usage: +{{ include "common.warnings.rollingTag" .Values.path.to.the.imageRoot }} +*/}} +{{- define "common.warnings.rollingTag" -}} + +{{- if and (contains "bitnami/" .repository) (not (.tag | toString | regexFind "-r\\d+$|sha256:")) }} +WARNING: Rolling tag detected ({{ .repository }}:{{ .tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment. ++info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/ +{{- end }} + +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_cassandra.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_cassandra.tpl new file mode 100644 index 00000000..ded1ae3b --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_cassandra.tpl @@ -0,0 +1,72 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate Cassandra required passwords are not empty. + +Usage: +{{ include "common.validations.values.cassandra.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where Cassandra values are stored, e.g: "cassandra-passwords-secret" + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.cassandra.passwords" -}} + {{- $existingSecret := include "common.cassandra.values.existingSecret" . -}} + {{- $enabled := include "common.cassandra.values.enabled" . -}} + {{- $dbUserPrefix := include "common.cassandra.values.key.dbUser" . -}} + {{- $valueKeyPassword := printf "%s.password" $dbUserPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "cassandra-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.cassandra.values.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.cassandra.values.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.cassandra.dbUser.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.dbUser.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled cassandra. + +Usage: +{{ include "common.cassandra.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.cassandra.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.cassandra.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key dbUser + +Usage: +{{ include "common.cassandra.values.key.dbUser" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.cassandra.values.key.dbUser" -}} + {{- if .subchart -}} + cassandra.dbUser + {{- else -}} + dbUser + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_mariadb.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_mariadb.tpl new file mode 100644 index 00000000..b6906ff7 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_mariadb.tpl @@ -0,0 +1,103 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MariaDB required passwords are not empty. + +Usage: +{{ include "common.validations.values.mariadb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MariaDB values are stored, e.g: "mysql-passwords-secret" + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mariadb.passwords" -}} + {{- $existingSecret := include "common.mariadb.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mariadb.values.enabled" . -}} + {{- $architecture := include "common.mariadb.values.architecture" . -}} + {{- $authPrefix := include "common.mariadb.values.key.auth" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mariadb-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- if not (empty $valueUsername) -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mariadb-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replication") -}} + {{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mariadb-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mariadb.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mariadb.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mariadb. + +Usage: +{{ include "common.mariadb.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mariadb.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mariadb.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mariadb.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mariadb.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mariadb.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.key.auth" -}} + {{- if .subchart -}} + mariadb.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_mongodb.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_mongodb.tpl new file mode 100644 index 00000000..f820ec10 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_mongodb.tpl @@ -0,0 +1,108 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MongoDB® required passwords are not empty. + +Usage: +{{ include "common.validations.values.mongodb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MongoDB® values are stored, e.g: "mongodb-passwords-secret" + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mongodb.passwords" -}} + {{- $existingSecret := include "common.mongodb.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mongodb.values.enabled" . -}} + {{- $authPrefix := include "common.mongodb.values.key.auth" . -}} + {{- $architecture := include "common.mongodb.values.architecture" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyDatabase := printf "%s.database" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicaSetKey := printf "%s.replicaSetKey" $authPrefix -}} + {{- $valueKeyAuthEnabled := printf "%s.enabled" $authPrefix -}} + + {{- $authEnabled := include "common.utils.getValueFromKey" (dict "key" $valueKeyAuthEnabled "context" .context) -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") (eq $authEnabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mongodb-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- $valueDatabase := include "common.utils.getValueFromKey" (dict "key" $valueKeyDatabase "context" .context) }} + {{- if and $valueUsername $valueDatabase -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mongodb-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replicaset") -}} + {{- $requiredReplicaSetKey := dict "valueKey" $valueKeyReplicaSetKey "secret" .secret "field" "mongodb-replica-set-key" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicaSetKey -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mongodb.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDb is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mongodb.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mongodb. + +Usage: +{{ include "common.mongodb.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mongodb.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mongodb.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mongodb.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.key.auth" -}} + {{- if .subchart -}} + mongodb.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mongodb.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mongodb.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_mysql.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_mysql.tpl new file mode 100644 index 00000000..74472a06 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_mysql.tpl @@ -0,0 +1,103 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MySQL required passwords are not empty. + +Usage: +{{ include "common.validations.values.mysql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MySQL values are stored, e.g: "mysql-passwords-secret" + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mysql.passwords" -}} + {{- $existingSecret := include "common.mysql.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mysql.values.enabled" . -}} + {{- $architecture := include "common.mysql.values.architecture" . -}} + {{- $authPrefix := include "common.mysql.values.key.auth" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mysql-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- if not (empty $valueUsername) -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mysql-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replication") -}} + {{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mysql-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mysql.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mysql.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mysql. + +Usage: +{{ include "common.mysql.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mysql.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mysql.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mysql.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mysql.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mysql.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.key.auth" -}} + {{- if .subchart -}} + mysql.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_postgresql.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_postgresql.tpl new file mode 100644 index 00000000..164ec0d0 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_postgresql.tpl @@ -0,0 +1,129 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate PostgreSQL required passwords are not empty. + +Usage: +{{ include "common.validations.values.postgresql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where postgresql values are stored, e.g: "postgresql-passwords-secret" + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.postgresql.passwords" -}} + {{- $existingSecret := include "common.postgresql.values.existingSecret" . -}} + {{- $enabled := include "common.postgresql.values.enabled" . -}} + {{- $valueKeyPostgresqlPassword := include "common.postgresql.values.key.postgressPassword" . -}} + {{- $valueKeyPostgresqlReplicationEnabled := include "common.postgresql.values.key.replicationPassword" . -}} + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + {{- $requiredPostgresqlPassword := dict "valueKey" $valueKeyPostgresqlPassword "secret" .secret "field" "postgresql-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlPassword -}} + + {{- $enabledReplication := include "common.postgresql.values.enabled.replication" . -}} + {{- if (eq $enabledReplication "true") -}} + {{- $requiredPostgresqlReplicationPassword := dict "valueKey" $valueKeyPostgresqlReplicationEnabled "secret" .secret "field" "postgresql-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to decide whether evaluate global values. + +Usage: +{{ include "common.postgresql.values.use.global" (dict "key" "key-of-global" "context" $) }} +Params: + - key - String - Required. Field to be evaluated within global, e.g: "existingSecret" +*/}} +{{- define "common.postgresql.values.use.global" -}} + {{- if .context.Values.global -}} + {{- if .context.Values.global.postgresql -}} + {{- index .context.Values.global.postgresql .key | quote -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.postgresql.values.existingSecret" (dict "context" $) }} +*/}} +{{- define "common.postgresql.values.existingSecret" -}} + {{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "existingSecret" "context" .context) -}} + + {{- if .subchart -}} + {{- default (.context.Values.postgresql.existingSecret | quote) $globalValue -}} + {{- else -}} + {{- default (.context.Values.existingSecret | quote) $globalValue -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled postgresql. + +Usage: +{{ include "common.postgresql.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.postgresql.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.postgresql.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key postgressPassword. + +Usage: +{{ include "common.postgresql.values.key.postgressPassword" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.key.postgressPassword" -}} + {{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "postgresqlUsername" "context" .context) -}} + + {{- if not $globalValue -}} + {{- if .subchart -}} + postgresql.postgresqlPassword + {{- else -}} + postgresqlPassword + {{- end -}} + {{- else -}} + global.postgresql.postgresqlPassword + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled.replication. + +Usage: +{{ include "common.postgresql.values.enabled.replication" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.enabled.replication" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.postgresql.replication.enabled -}} + {{- else -}} + {{- printf "%v" .context.Values.replication.enabled -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key replication.password. + +Usage: +{{ include "common.postgresql.values.key.replicationPassword" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.key.replicationPassword" -}} + {{- if .subchart -}} + postgresql.replication.password + {{- else -}} + replication.password + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_redis.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_redis.tpl new file mode 100644 index 00000000..dcccfc1a --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_redis.tpl @@ -0,0 +1,76 @@ + +{{/* vim: set filetype=mustache: */}} +{{/* +Validate Redis® required passwords are not empty. + +Usage: +{{ include "common.validations.values.redis.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where redis values are stored, e.g: "redis-passwords-secret" + - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.redis.passwords" -}} + {{- $enabled := include "common.redis.values.enabled" . -}} + {{- $valueKeyPrefix := include "common.redis.values.keys.prefix" . -}} + {{- $standarizedVersion := include "common.redis.values.standarized.version" . }} + + {{- $existingSecret := ternary (printf "%s%s" $valueKeyPrefix "auth.existingSecret") (printf "%s%s" $valueKeyPrefix "existingSecret") (eq $standarizedVersion "true") }} + {{- $existingSecretValue := include "common.utils.getValueFromKey" (dict "key" $existingSecret "context" .context) }} + + {{- $valueKeyRedisPassword := ternary (printf "%s%s" $valueKeyPrefix "auth.password") (printf "%s%s" $valueKeyPrefix "password") (eq $standarizedVersion "true") }} + {{- $valueKeyRedisUseAuth := ternary (printf "%s%s" $valueKeyPrefix "auth.enabled") (printf "%s%s" $valueKeyPrefix "usePassword") (eq $standarizedVersion "true") }} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $useAuth := include "common.utils.getValueFromKey" (dict "key" $valueKeyRedisUseAuth "context" .context) -}} + {{- if eq $useAuth "true" -}} + {{- $requiredRedisPassword := dict "valueKey" $valueKeyRedisPassword "secret" .secret "field" "redis-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRedisPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled redis. + +Usage: +{{ include "common.redis.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.redis.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.redis.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right prefix path for the values + +Usage: +{{ include "common.redis.values.key.prefix" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false +*/}} +{{- define "common.redis.values.keys.prefix" -}} + {{- if .subchart -}}redis.{{- else -}}{{- end -}} +{{- end -}} + +{{/* +Checks whether the redis chart's includes the standarizations (version >= 14) + +Usage: +{{ include "common.redis.values.standarized.version" (dict "context" $) }} +*/}} +{{- define "common.redis.values.standarized.version" -}} + + {{- $standarizedAuth := printf "%s%s" (include "common.redis.values.keys.prefix" .) "auth" -}} + {{- $standarizedAuthValues := include "common.utils.getValueFromKey" (dict "key" $standarizedAuth "context" .context) }} + + {{- if $standarizedAuthValues -}} + {{- true -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_validations.tpl b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_validations.tpl new file mode 100644 index 00000000..9a814cf4 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/templates/validations/_validations.tpl @@ -0,0 +1,46 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate values must not be empty. + +Usage: +{{- $validateValueConf00 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-00") -}} +{{- $validateValueConf01 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-01") -}} +{{ include "common.validations.values.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }} + +Validate value params: + - valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password" + - secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret" + - field - String - Optional. Name of the field in the secret data, e.g: "mysql-password" +*/}} +{{- define "common.validations.values.multiple.empty" -}} + {{- range .required -}} + {{- include "common.validations.values.single.empty" (dict "valueKey" .valueKey "secret" .secret "field" .field "context" $.context) -}} + {{- end -}} +{{- end -}} + +{{/* +Validate a value must not be empty. + +Usage: +{{ include "common.validations.value.empty" (dict "valueKey" "mariadb.password" "secret" "secretName" "field" "my-password" "subchart" "subchart" "context" $) }} + +Validate value params: + - valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password" + - secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret" + - field - String - Optional. Name of the field in the secret data, e.g: "mysql-password" + - subchart - String - Optional - Name of the subchart that the validated password is part of. +*/}} +{{- define "common.validations.values.single.empty" -}} + {{- $value := include "common.utils.getValueFromKey" (dict "key" .valueKey "context" .context) }} + {{- $subchart := ternary "" (printf "%s." .subchart) (empty .subchart) }} + + {{- if not $value -}} + {{- $varname := "my-value" -}} + {{- $getCurrentValue := "" -}} + {{- if and .secret .field -}} + {{- $varname = include "common.utils.fieldToEnvVar" . -}} + {{- $getCurrentValue = printf " To get the current value:\n\n %s\n" (include "common.utils.secret.getvalue" .) -}} + {{- end -}} + {{- printf "\n '%s' must not be empty, please add '--set %s%s=$%s' to the command.%s" .valueKey $subchart .valueKey $varname $getCurrentValue -}} + {{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/charts/common/values.yaml b/helm/airbyte-v1/charts/workload-launcher/charts/common/values.yaml new file mode 100644 index 00000000..f2df68e5 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/charts/common/values.yaml @@ -0,0 +1,5 @@ +## bitnami/common +## It is required by CI/CD tools and processes. +## @skip exampleValue +## +exampleValue: common-chart diff --git a/helm/airbyte-v1/charts/workload-launcher/templates/_helpers.tpl b/helm/airbyte-v1/charts/workload-launcher/templates/_helpers.tpl new file mode 100644 index 00000000..933c125b --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/templates/_helpers.tpl @@ -0,0 +1,258 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "airbyte.labels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "airbyte.selectorLabels" -}} +app.kubernetes.io/name: {{ include "airbyte.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +## DEFAULT HELM VALUES +# Secret Manager Defaults +{{/* +Define secret persistence +*/}} +{{- define "airbyte.secretPersistence" -}} +{{- if (((.Values.global).secretsManager).type) }} + {{- printf "%s" (snakecase .Values.global.secretsManager.type) }} +{{- else }} + {{- printf "" }} +{{- end }} +{{- end }} + +{{/* +Get secret store name or default +*/}} +{{- define "airbyte.secretStoreName" -}} +{{- $secretStoreName := . -}} +{{- if $secretStoreName -}} + {{- printf "%s" $secretStoreName -}} +{{- else -}} + {{- printf "airbyte-config-secrets" -}} +{{- end -}} +{{- end -}} + +{{/* +Get awsSecretManager access key id secret key or default +*/}} +{{- define "airbyte.awsSecretManagerAccessKeyIdSecretKey" -}} +{{- $awsSecretManagerAccessKeyIdSecretKey := . -}} +{{- if $awsSecretManagerAccessKeyIdSecretKey -}} + {{- printf "%s" $awsSecretManagerAccessKeyIdSecretKey -}} +{{- else -}} + {{- printf "aws-secret-manager-access-key-id" -}} +{{- end -}} +{{- end -}} + +{{/* +Get awsSecretManager secret access key secret key or default +*/}} +{{- define "airbyte.awsSecretManagerSecretAccessKeySecretKey" -}} +{{- $awsSecretManagerSecretAccessKeySecretKey := . -}} +{{- if $awsSecretManagerSecretAccessKeySecretKey -}} + {{- printf "%s" $awsSecretManagerSecretAccessKeySecretKey -}} +{{- else -}} + {{- printf "aws-secret-manager-secret-access-key" -}} +{{- end -}} +{{- end -}} + +{{/* +Get azureKeyVault clientId or default +*/}} +{{- define "airbyte.azureKeyVaultClientIdSecretKey" -}} +{{- $azureKeyVaultClientIdSecretKey := . -}} +{{- if $azureKeyVaultClientIdSecretKey -}} + {{- printf "%s" $azureKeyVaultClientIdSecretKey -}} +{{- else -}} + {{- printf "azure-key-vault-client-id" -}} +{{- end -}} +{{- end -}} + +{{/* +Get azureKeyVault clientSecret or default +*/}} +{{- define "airbyte.azureKeyVaultClientSecretSecretKey" -}} +{{- $azureKeyVaultClientSecretSecretKey := . -}} +{{- if $azureKeyVaultClientSecretSecretKey -}} + {{- printf "%s" $azureKeyVaultClientSecretSecretKey -}} +{{- else -}} + {{- printf "azure-key-vault-client-secret" -}} +{{- end -}} +{{- end -}} + +{{/* +Get googleSecretManager credentials secret key or default +*/}} +{{- define "airbyte.googleSecretManagerCredentialsSecretKey" -}} +{{- $googleSecretManagerCredentialsSecretKey := . -}} +{{- if $googleSecretManagerCredentialsSecretKey -}} + {{- printf "%s" $googleSecretManagerCredentialsSecretKey -}} +{{- else -}} + {{- printf "google-secret-manager-credentials" -}} +{{- end -}} +{{- end -}} + +{{/* +Get vault auth token secret key or default +*/}} +{{- define "airbyte.vaultAuthTokenSecretKey" -}} +{{- $vaultAuthTokenSecretKey := . -}} +{{- if $vaultAuthTokenSecretKey -}} + {{- printf "%s" $vaultAuthTokenSecretKey -}} +{{- else -}} + {{- printf "vault-auth-token" -}} +{{- end -}} +{{- end -}} + + +# Storage Defaults +{{/* +Get storage type or default +*/}} +{{- define "airbyte.storageType" -}} +{{- $storageType := . -}} +{{- if $storageType -}} + {{- printf "%s" $storageType -}} +{{- else -}} + {{- printf "local" -}} +{{- end -}} +{{- end -}} + +{{/* +Get storage bucket log or default +*/}} +{{- define "airbyte.storageBucketLog" -}} +{{- $storageBucketLog := . -}} +{{- if $storageBucketLog -}} + {{- printf "%s" $storageBucketLog -}} +{{- else -}} + {{- printf "airbyte-storage" -}} +{{- end -}} +{{- end -}} + +{{/* +Get storage bucket state or default +*/}} +{{- define "airbyte.storageBucketState" -}} +{{- $storageBucketState := . -}} +{{- if $storageBucketState -}} + {{- printf "%s" $storageBucketState -}} +{{- else -}} + {{- printf "airbyte-storage" -}} +{{- end -}} +{{- end -}} + +{{/* +Get storage bucket workload output or default +*/}} +{{- define "airbyte.storageBucketWorkloadOutput" -}} +{{- $storageBucketWorkloadOutput := . -}} +{{- if $storageBucketWorkloadOutput -}} + {{- printf "%s" $storageBucketWorkloadOutput -}} +{{- else -}} + {{- printf "airbyte-storage" -}} +{{- end -}} +{{- end -}} + +{{/* +Get s3 access key id secret key or default +*/}} +{{- define "airbyte.s3AccessKeyIdSecretKey" -}} +{{- $s3AccessKeyIdSecretKey := . -}} +{{- if $s3AccessKeyIdSecretKey -}} + {{- printf "%s" $s3AccessKeyIdSecretKey -}} +{{- else -}} + {{- printf "s3-access-key-id" -}} +{{- end -}} +{{- end -}} + +{{/* +Get s3 secret access key secret key or default +*/}} +{{- define "airbyte.s3SecretAccessKeySecretKey" -}} +{{- $s3SecretAccessKeySecretKey := . -}} +{{- if $s3SecretAccessKeySecretKey -}} + {{- printf "%s" $s3SecretAccessKeySecretKey -}} +{{- else -}} + {{- printf "s3-secret-access-key" -}} +{{- end -}} +{{- end -}} + +{{/* +Get minio access key id secret key or default +*/}} +{{- define "airbyte.minioAccessKeyIdSecretKey" -}} +{{- $minioAccessKeyIdSecretKey := . -}} +{{- if $minioAccessKeyIdSecretKey -}} + {{- printf "%s" $minioAccessKeyIdSecretKey -}} +{{- else -}} + {{- printf "minio-access-key-id" -}} +{{- end -}} +{{- end -}} + +{{/* +Get minio secret access key secret key or default +*/}} +{{- define "airbyte.minioSecretAccessKeySecretKey" -}} +{{- $minioSecretAccessKeySecretKey := . -}} +{{- if $minioSecretAccessKeySecretKey -}} + {{- printf "%s" $minioSecretAccessKeySecretKey -}} +{{- else -}} + {{- printf "minio-secret-access-key" -}} +{{- end -}} +{{- end -}} + +{{/* +Get gcs credentials secret key or default +*/}} +{{- define "airbyte.gcsCredentialsSecretKey" -}} +{{- $gcsCredentialsSecretKey := . -}} +{{- if $gcsCredentialsSecretKey -}} + {{- printf "%s" $gcsCredentialsSecretKey -}} +{{- else -}} + {{- printf "gcs-credentials" -}} +{{- end -}} +{{- end -}} diff --git a/helm/airbyte-v1/charts/workload-launcher/templates/_images.tpl b/helm/airbyte-v1/charts/workload-launcher/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/charts/workload-launcher/templates/deployment.yaml b/helm/airbyte-v1/charts/workload-launcher/templates/deployment.yaml new file mode 100644 index 00000000..ce0dfa93 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/templates/deployment.yaml @@ -0,0 +1,557 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "common.names.fullname" . }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} + {{- if .Values.extraLabels }} + {{ toYaml (mergeOverwrite .Values.extraLabels .Values.global.extraLabels) | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "airbyte.selectorLabels" . | nindent 6 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 6 }} + {{- end }} + strategy: + type: Recreate + template: + metadata: + labels: + {{- include "airbyte.selectorLabels" . | nindent 8 }} + {{- if .Values.extraSelectorLabels }} + {{ toYaml (mergeOverwrite .Values.extraSelectorLabels .Values.global.extraSelectorLabels) | nindent 8 }} + {{- end }} + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.podAnnotations }} + annotations: + {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ .Values.global.serviceAccountName }} + automountServiceAccountToken: true + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.extraInitContainers }} + initContainers: + {{- toYaml .Values.extraInitContainers | nindent 6 }} + {{- end }} + containers: + - name: airbyte-workload-launcher-container + image: {{ include "imageUrl" (list .Values.image $) }} + imagePullPolicy: "{{ .Values.image.pullPolicy }}" + env: + {{- if .Values.debug.enabled }} + - name: JAVA_TOOL_OPTIONS + value: "-Xdebug -agentlib:jdwp=transport=dt_socket,address=0.0.0.0:{{ .Values.debug.remoteDebugPort }},server=y,suspend=n" + {{- end}} + {{- if eq .Values.global.deploymentMode "oss" }} + - name: AIRBYTE_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: AIRBYTE_VERSION + - name: DATA_PLANE_ID + value: "local" + - name: PUB_SUB_ENABLED + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: PUB_SUB_ENABLED + - name: PUB_SUB_TOPIC_NAME + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: PUB_SUB_TOPIC_NAME + - name: CONFIG_ROOT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: CONFIG_ROOT + {{- if eq (lower (default "" .Values.global.storage.type)) "gcs" }} + - name: CONTAINER_ORCHESTRATOR_SECRET_MOUNT_PATH + value: "/secrets/gcs-log-creds" + - name: CONTAINER_ORCHESTRATOR_SECRET_NAME + value: {{ include "airbyte.secretStoreName" .Values.global.storage.storageSecretName }} + {{- end }} + + {{- include "airbyte.database.envs" . | nindent 8 }} + {{- include "airbyte.logging.envs" . | nindent 8 }} + - name: MICROMETER_METRICS_ENABLED + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MICROMETER_METRICS_ENABLED + - name: MICROMETER_METRICS_STATSD_FLAVOR + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MICROMETER_METRICS_STATSD_FLAVOR + - name: SEGMENT_WRITE_KEY + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: SEGMENT_WRITE_KEY + - name: STATSD_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STATSD_HOST + - name: STATSD_PORT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STATSD_PORT + - name: TRACKING_STRATEGY + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TRACKING_STRATEGY + - name: WORKSPACE_DOCKER_MOUNT + value: workspace + - name: WORKSPACE_ROOT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WORKSPACE_ROOT + - name: WEBAPP_URL + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WEBAPP_URL + - name: WORKLOAD_API_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WORKLOAD_API_HOST + - name: TEMPORAL_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TEMPORAL_HOST + - name: TEMPORAL_WORKER_PORTS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: TEMPORAL_WORKER_PORTS + - name: JOB_KUBE_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: JOB_KUBE_SERVICEACCOUNT + value: {{ .Values.global.serviceAccountName }} + {{- if $.Values.global.jobs.kube.annotations }} + - name: JOB_KUBE_ANNOTATIONS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_KUBE_ANNOTATIONS + {{- end }} + {{- if $.Values.global.jobs.kube.labels }} + - name: JOB_KUBE_LABELS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_KUBE_LABELS + {{- end }} + {{- if $.Values.global.jobs.kube.nodeSelector }} + - name: JOB_KUBE_NODE_SELECTORS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_KUBE_NODE_SELECTORS + {{- end }} + {{- if $.Values.global.jobs.kube.tolerations }} + - name: JOB_KUBE_TOLERATIONS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_KUBE_TOLERATIONS + {{- end }} + - name: CONNECTOR_SIDECAR_IMAGE + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: CONNECTOR_SIDECAR_IMAGE + - name: WORKLOAD_INIT_IMAGE + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WORKLOAD_INIT_IMAGE + - name: CONTAINER_ORCHESTRATOR_IMAGE + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: CONTAINER_ORCHESTRATOR_IMAGE + - name: JOB_KUBE_BUSYBOX_IMAGE + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_KUBE_BUSYBOX_IMAGE + - name: JOB_KUBE_CURL_IMAGE + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_KUBE_CURL_IMAGE + {{- if $.Values.global.jobs.kube.main_container_image_pull_secret }} + - name: JOB_KUBE_MAIN_CONTAINER_IMAGE_PULL_SECRET + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_KUBE_MAIN_CONTAINER_IMAGE_PULL_SECRET + {{- end }} + - name: JOB_MAIN_CONTAINER_CPU_REQUEST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_MAIN_CONTAINER_CPU_REQUEST + - name: JOB_MAIN_CONTAINER_CPU_LIMIT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_MAIN_CONTAINER_CPU_LIMIT + - name: JOB_MAIN_CONTAINER_MEMORY_REQUEST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_MAIN_CONTAINER_MEMORY_REQUEST + - name: JOB_MAIN_CONTAINER_MEMORY_LIMIT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_MAIN_CONTAINER_MEMORY_LIMIT + - name: JOB_KUBE_LOCAL_VOLUME_ENABLED + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOB_KUBE_LOCAL_VOLUME_ENABLED + - name: KUBERNETES_CLIENT_MAX_IDLE_CONNECTIONS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: KUBERNETES_CLIENT_MAX_IDLE_CONNECTIONS + - name: WORKLOAD_API_BEARER_TOKEN + valueFrom: + secretKeyRef: + name: {{ index .Values "workloadApi" "bearerTokenSecretName" | default (printf "%s-airbyte-secrets" .Release.Name ) }} + key: {{ index .Values "workloadApi" "bearerTokenSecretKey" | default "WORKLOAD_API_BEARER_TOKEN" }} + - name: WORKLOAD_API_BEARER_TOKEN_SECRET_NAME + value: {{ index .Values "workloadApi" "bearerTokenSecretName" | default (printf "%s-airbyte-secrets" .Release.Name ) }} + - name: WORKLOAD_API_BEARER_TOKEN_SECRET_KEY + value: {{ index .Values "workloadApi" "bearerTokenSecretKey" | default "WORKLOAD_API_BEARER_TOKEN" }} + - name: INTERNAL_API_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: INTERNAL_API_HOST + - name: CONFIGS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: CONFIGS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + - name: JOBS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: JOBS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION + - name: METRIC_CLIENT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: METRIC_CLIENT + - name: OTEL_COLLECTOR_ENDPOINT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: OTEL_COLLECTOR_ENDPOINT + - name: ACTIVITY_MAX_ATTEMPT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: ACTIVITY_MAX_ATTEMPT + - name: ACTIVITY_INITIAL_DELAY_BETWEEN_ATTEMPTS_SECONDS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: ACTIVITY_INITIAL_DELAY_BETWEEN_ATTEMPTS_SECONDS + - name: ACTIVITY_MAX_DELAY_BETWEEN_ATTEMPTS_SECONDS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: ACTIVITY_MAX_DELAY_BETWEEN_ATTEMPTS_SECONDS + - name: WORKFLOW_FAILURE_RESTART_DELAY_SECONDS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WORKFLOW_FAILURE_RESTART_DELAY_SECONDS + - name: SHOULD_RUN_NOTIFY_WORKFLOWS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: SHOULD_RUN_NOTIFY_WORKFLOWS + - name: MICRONAUT_ENVIRONMENTS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: LAUNCHER_MICRONAUT_ENVIRONMENTS + - name: WORKLOAD_LAUNCHER_PARALLELISM + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: WORKLOAD_LAUNCHER_PARALLELISM + - name: FILE_TRANSFER_EPHEMERAL_STORAGE_LIMIT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: FILE_TRANSFER_EPHEMERAL_STORAGE_LIMIT + - name: FILE_TRANSFER_EPHEMERAL_STORAGE_REQUEST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: FILE_TRANSFER_EPHEMERAL_STORAGE_REQUEST + {{- if or (eq .Values.global.edition "pro") (eq .Values.global.edition "enterprise") }} + - name: AIRBYTE_API_AUTH_HEADER_NAME + value: "X-Airbyte-Auth" + - name: AIRBYTE_API_AUTH_HEADER_VALUE + value: "Internal worker" + {{- else if and (eq .Values.global.deploymentMode "oss") .Values.global.auth.enabled }} + # Self-Managed Enterprise and Community w/ auth enabled use the same auth header, just + # splitting into two separate blocks for readability. + - name: AIRBYTE_API_AUTH_HEADER_NAME + value: "X-Airbyte-Auth" + - name: AIRBYTE_API_AUTH_HEADER_VALUE + value: "Internal worker" + {{- end }} + + # SECRETS MANAGER + - name: SECRET_PERSISTENCE + value: {{ include "airbyte.secretPersistence" . }} + # Values for AwsSecretsManager + {{- if eq ((((.Values.global).secretsManager).awsSecretManager).authenticationType) "credentials" }} + - name: AWS_SECRET_MANAGER_ACCESS_KEY_ID + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.awsSecretManagerAccessKeyIdSecretKey" .Values.global.secretsManager.awsSecretManager.accessKeyIdSecretKey }} + - name: AWS_SECRET_MANAGER_SECRET_ACCESS_KEY + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.awsSecretManagerSecretAccessKeySecretKey" .Values.global.secretsManager.awsSecretManager.secretAccessKeySecretKey }} + + - name: AWS_SECRET_MANAGER_ACCESS_KEY_ID_REF_NAME + value: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + - name: AWS_SECRET_MANAGER_ACCESS_KEY_ID_REF_KEY + value: {{ include "airbyte.awsSecretManagerAccessKeyIdSecretKey" .Values.global.secretsManager.awsSecretManager.accessKeyIdSecretKey }} + + - name: AWS_SECRET_MANAGER_SECRET_ACCESS_KEY_REF_NAME + value: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + - name: AWS_SECRET_MANAGER_SECRET_ACCESS_KEY_REF_KEY + value: {{ include "airbyte.awsSecretManagerSecretAccessKeySecretKey" .Values.global.secretsManager.awsSecretManager.secretAccessKeySecretKey }} + + {{- end }} + {{- if ((((.Values.global).secretsManager).awsSecretManager).region) }} + - name: AWS_SECRET_MANAGER_REGION + value: {{ (((.Values.global).secretsManager).awsSecretManager).region }} + {{- end }} + + {{- if ((((.Values.global).secretsManager).awsSecretManager).tags) }} + - name: AWS_SECRET_MANAGER_SECRET_TAGS + value: {{ include "airbyte.tagsToString" .Values.global.secretsManager.awsSecretManager.tags }} + {{- end }} + {{- if ((((.Values.global).secretsManager).awsSecretManager).kms) }} + - name: AWS_KMS_KEY_ARN + value: {{ ((((.Values.global).secretsManager).awsSecretManager).kms) | default "" }} + {{- end }} + + # Values for Azure Key Vault + {{- if (((.Values.global).secretsManager).azureKeyVault) }} + + - name: AB_AZURE_KEY_VAULT_VAULT_URL + value: {{ (((.Values.global).secretsManager).azureKeyVault).vaultUrl }} + + - name: AB_AZURE_KEY_VAULT_TENANT_ID + value: {{ (((.Values.global).secretsManager).azureKeyVault).tenantId }} + + - name: AB_AZURE_KEY_VAULT_CLIENT_ID + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.azureKeyVaultClientIdSecretKey" .Values.global.secretsManager.azureKeyVault.clientIdSecretKey }} + - name: AB_AZURE_KEY_VAULT_CLIENT_SECRET + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.azureKeyVaultClientSecretSecretKey" .Values.global.secretsManager.azureKeyVault.clientSecretSecretKey }} + + - name: AB_AZURE_KEY_VAULT_CLIENT_ID_REF_NAME + value: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + - name: AB_AZURE_KEY_VAULT_CLIENT_ID_REF_REF_KEY + value: {{ include "airbyte.azureKeyVaultClientIdSecretKey" .Values.global.secretsManager.azureKeyVault.clientIdSecretKey }} + + - name: AB_AZURE_KEY_VAULT_CLIENT_SECRET_REF_REF_NAME + value: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + - name: AB_AZURE_KEY_VAULT_CLIENT_SECRET_REF_REF_KEY + value: {{ include "airbyte.azureKeyVaultClientSecretSecretKey" .Values.global.secretsManager.azureKeyVault.clientSecretSecretKey }} + + {{- end }} + + {{- if ((((.Values.global).secretsManager).azureKeyVault).tags) }} + - name: AB_AZURE_KEY_VAULT_TAGS + value: {{ include "airbyte.tagsToString" .Values.global.secretsManager.azureKeyVault.tags }} + {{- end }} + + # Values for googleSecretManager secrets + {{- if (((.Values.global).secretsManager).googleSecretManager) }} + - name: SECRET_STORE_GCP_PROJECT_ID + value: {{ .Values.global.secretsManager.googleSecretManager.projectId }} + - name: SECRET_STORE_GCP_CREDENTIALS + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.googleSecretManagerCredentialsSecretKey" .Values.global.secretsManager.googleSecretManager.credentialsSecretKey }} + - name: SECRET_STORE_GCP_SECRET_NAME + value: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + - name: SECRET_STORE_GCP_SECRET_KEY + value: {{ include "airbyte.googleSecretManagerCredentialsSecretKey" .Values.global.secretsManager.googleSecretManager.credentialsSecretKey }} + {{- end }} + + # Values for vault secrets + {{- if (((.Values.global).secretsManager).vault) }} + - name: VAULT_ADDRESS + value: {{ (((.Values.global).secretsManager).vault).address }} + - name: VAULT_PREFIX + value: {{ (((.Values.global).secretsManager).vault).prefix }} + - name: VAULT_AUTH_TOKEN + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + key: {{ include "airbyte.vaultAuthTokenSecretKey" .Values.global.secretsManager.vault.authTokenSecretKey }} + - name: VAULT_AUTH_TOKEN_REF_NAME + value: {{ include "airbyte.secretStoreName" .Values.global.secretsManager.secretsManagerSecretName }} + - name: VAULT_AUTH_TOKEN_REF_KEY + value: {{ include "airbyte.vaultAuthTokenSecretKey" .Values.global.secretsManager.vault.authTokenSecretKey }} + {{- end }} + + # Storage + {{- include "airbyte.storage.envs" . | nindent 8 }} + + {{- end }} + + # Values from secret + {{- if .Values.secrets }} + {{- range $k, $v := .Values.secrets }} + - name: {{ $k }} + valueFrom: + secretKeyRef: + name: workload-launcher-secrets + key: {{ $k }} + {{- end }} + {{- end }} + + # Values from env + {{- if or .Values.env_vars .Values.global.env_vars }} + {{- range $k, $v := mergeOverwrite .Values.env_vars .Values.global.env_vars }} + - name: {{ $k }} + value: {{ $v | quote }} + {{- end }} + {{- end }} + + # Values from extraEnv for more compability(if you want to use external secret source or other stuff) + {{- if .Values.extraEnv }} + {{- toYaml .Values.extraEnv | nindent 8 }} + {{- end }} + + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: /health/liveness + port: heartbeat + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: /health/readiness + port: heartbeat + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} + ports: + {{- if .Values.debug.enabled }} + - name: debug + containerPort: {{ .Values.debug.remoteDebugPort }} + protocol: TCP + {{- end}} + - name: heartbeat + containerPort: 8016 # for heartbeat server + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 10 }} + {{- end }} + {{- if .Values.containerSecurityContext }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 10 }} + {{- end }} + volumeMounts: + {{- if eq (lower .Values.global.storage.type) "local" }} + - name: airbyte-storage + mountPath: /storage + {{- end }} + {{- if and (eq .Values.global.deploymentMode "oss") (eq (lower (default "" .Values.global.storage.type)) "gcs") }} + - name: gcs-log-creds-volume + mountPath: /secrets/gcs-log-creds + readOnly: true + {{- end }} + {{- if .Values.extraVolumeMounts }} +{{- toYaml .Values.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.global.extraVolumeMounts }} +{{- toYaml .Values.global.extraVolumeMounts | nindent 8 }} + {{- end }} + {{- if .Values.extraContainers }} + {{ toYaml .Values.extraContainers | nindent 6 }} + {{- end }} + {{- if .Values.global.extraContainers }} + {{ toYaml .Values.global.extraContainers | nindent 6 }} + {{- end }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + {{- if eq (lower .Values.global.storage.type) "local" }} + - name: airbyte-storage + persistentVolumeClaim: + claimName: airbyte-storage-pvc + {{- end }} + {{- if and (eq .Values.global.deploymentMode "oss") (eq (lower (default "" .Values.global.storage.type)) "gcs") }} + - name: gcs-log-creds-volume + secret: + secretName: {{ ternary (printf "%s-gcs-log-creds" ( .Release.Name )) .Values.global.storage.storageSecretName (not ((.Values.global.storage).storageSecretName)) }} + {{- end }} + {{- if .Values.extraVolumes }} +{{- toYaml .Values.extraVolumes | nindent 6 }} + {{- end }} + {{- if .Values.global.extraVolumes }} +{{- toYaml .Values.global.extraVolumes | nindent 6 }} + {{- end }} diff --git a/helm/airbyte-v1/charts/workload-launcher/templates/jobs-secrets.yaml b/helm/airbyte-v1/charts/workload-launcher/templates/jobs-secrets.yaml new file mode 100644 index 00000000..c49cec64 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/templates/jobs-secrets.yaml @@ -0,0 +1,18 @@ +# Create dataplane secrets only for the local deployment + {{- if .Values.secrets }} +apiVersion: v1 +kind: Secret +metadata: + name: workload-launcher-secrets + namespace: {{ .Values.jobs_namespace }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-1" +type: Opaque +data: + {{- range $k, $v := mergeOverwrite .Values.secrets .Values.global.secrets }} + {{ $k }}: {{ if $v }}{{ $v | b64enc }} {{else}}""{{end}} + {{- end }} + {{- end }} diff --git a/helm/airbyte-v1/charts/workload-launcher/templates/secrets.yaml b/helm/airbyte-v1/charts/workload-launcher/templates/secrets.yaml new file mode 100644 index 00000000..c72f6bfe --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/templates/secrets.yaml @@ -0,0 +1,17 @@ +# Create secrets only for the local deployment +{{- if .Values.secrets }} +apiVersion: v1 +kind: Secret +metadata: + name: workload-launcher-secrets + labels: + {{- include "airbyte.labels" . | nindent 4 }} + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-1" +type: Opaque +data: + {{- range $k, $v := mergeOverwrite .Values.secrets .Values.global.secrets }} + {{ $k }}: {{ if $v }}{{ $v | b64enc }} {{else}}""{{end}} + {{- end }} +{{- end }} diff --git a/helm/airbyte-v1/charts/workload-launcher/values.yaml b/helm/airbyte-v1/charts/workload-launcher/values.yaml new file mode 100644 index 00000000..486760a5 --- /dev/null +++ b/helm/airbyte-v1/charts/workload-launcher/values.yaml @@ -0,0 +1,294 @@ +global: + + serviceAccountName: &service-account-name "airbyte-admin" + edition: community + credVolumeOverride: "" + secretName: "" + extraContainers: [] + ## extraSelectorLabels [object] - use to specify own additional selector labels for deployment + extraSelectorLabels: {} + ## extraLabels [object] - use to specify own additional labels for deployment + extraLabels: {} + database: + secretName: "" + secretValue: "" + + storage: + type: minio + + # Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "" + + jobs: + ## Jobs resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## jobs.resources.limits [object] The resources limits for jobs + ## jobs.resources.requests [object] The requested resources for jobs + resources: + ## Example: + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + + kube: + ## JOB_KUBE_ANNOTATIONS + ## pod annotations of the sync job and the default pod annotations fallback for others jobs + ## jobs.kube.annotations [object] key/value annotations applied to kube jobs + annotations: {} + + ## JOB_KUBE_LABELS + ## pod labels of the sync job and the default pod labels fallback for others jobs + ## jobs.kube.labels [object] key/value labels applied to kube jobs + labels: {} + + ## JOB_KUBE_NODE_SELECTORS + ## pod node selector of the sync job and the default pod node selector fallback for others jobs + ## jobs.kube.nodeSelector [object] key/value node selector applied to kube jobs + nodeSelector: {} + + ## JOB_KUBE_TOLERATIONS + ## jobs.kube.tolerations [array] Tolerations for jobs.kube pod assignment. + ## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + ## any boolean values should be quoted to ensure the value is passed through as a string, eg: + ## - key: airbyte-server + ## operator: Equal + ## value: "true" + ## effect: NoSchedule + tolerations: [] + + ## JOB_KUBE_MAIN_CONTAINER_IMAGE_PULL_SECRET + ## image pull secret to use for job pod + ## jobs.kube.main_container_image_pull_secret [string] image pull secret to use for job pod + main_container_image_pull_secret: "" + + images: + ## JOB_KUBE_BUSYBOX_IMAGE + ## busybox image used by the job pod + ## jobs.kube.images.busybox [string] busybox image used by the job pod + busybox: "" + ## JOB_KUBE_CURL_IMAGE + ## curl image used by the job pod + ## jobs.kube.images.curl [string] curl image used by the job pod + curl: "" + +enabled: true +## workload-launcher.replicaCount Number of workload launcher replicas +replicaCount: 1 + +## workload-launcher.image.repository The repository to use for the airbyte workload launcher image. +## workload-launcher.image.pullPolicy the pull policy to use for the airbyte workload launcher image +## workload-launcher.image.tag The airbyte workload launcher image tag. Defaults to the chart's AppVersion +image: + repository: airbyte/workload-launcher + pullPolicy: IfNotPresent + +## workload-launcher.podAnnotations [object] Add extra annotations to the workload launcher pod(s) +## +podAnnotations: {} + +## workload-launcher.podLabels [object] Add extra labels to the workload launcher pod(s) +## +podLabels: {} + +## workload-launcher.containerSecurityContext Security context for the container +## Examples: +## containerSecurityContext: +## runAsNonRoot: true +## runAsUser: 1000 +## readOnlyRootFilesystem: true +containerSecurityContext: {} + +## Configure extra options for the workload launcher containers' liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +## workload-launcher.livenessProbe.enabled Enable livenessProbe on the workload launcher +## workload-launcher.livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe +## workload-launcher.livenessProbe.periodSeconds Period seconds for livenessProbe +## workload-launcher.livenessProbe.timeoutSeconds Timeout seconds for livenessProbe +## workload-launcher.livenessProbe.failureThreshold Failure threshold for livenessProbe +## workload-launcher.livenessProbe.successThreshold Success threshold for livenessProbe +## +livenessProbe: + enabled: true + initialDelaySeconds: 50 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## workload-launcher.readinessProbe.enabled Enable readinessProbe on the workload launcher +## workload-launcher.readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe +## workload-launcher.readinessProbe.periodSeconds Period seconds for readinessProbe +## workload-launcher.readinessProbe.timeoutSeconds Timeout seconds for readinessProbe +## workload-launcher.readinessProbe.failureThreshold Failure threshold for readinessProbe +## workload-launcher.readinessProbe.successThreshold Success threshold for readinessProbe +## +readinessProbe: + enabled: true + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + +## workload launcher resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## We usually recommend not to specify default resources and to leave this as a conscious +## choice for the user. This also increases chances charts run on environments with little +## resources, such as Minikube. If you do want to specify resources, uncomment the following +## lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## workload-launcher.resources.limits [object] The resources limits for the workload launcher container +## workload-launcher.resources.requests [object] The requested resources for the workload launcher container +resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + requests: {} + +## workload-launcher.nodeSelector [object] Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## workload-launcher.tolerations [array] Tolerations for workload launcher pod assignment. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## workload-launcher.affinity [object] Affinity and anti-affinity for workload launcher pod assignment. +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## workload-launcher.log.level The log level to log at. +log: + level: "INFO" + + + +## workload-launcher.extraVolumeMounts [array] Additional volumeMounts for workload launcher container(s). +## Examples (when using `workload-launcher.containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumeMounts: +## - name: tmpdir +## mountPath: /tmp +## +extraVolumeMounts: [] + +## workload-launcher.extraVolumes [array] Additional volumes for workload launcher pod(s). +## Examples (when using `workload-launcher.containerSecurityContext.readOnlyRootFilesystem=true`): +## extraVolumes: +## - name: tmpdir +## emptyDir: {} +## +extraVolumes: [] + +## extraContainer [array] Additional container for server pod(s) +## Example: +# extraContainers: +# - name: otel_collector +# image: somerepo/someimage:sometag +# args: [ +# "--important-args" +# ] +# ports: +# - containerPort: 443 +# volumeMounts: +# - name: volumeMountCool +# mountPath: /some/path +# readOnly: true +extraContainers: [] + +## extraInitContainers [array] Additional init containers for server pod(s) +## Example: +# extraInitContainers: +# - name: sleepy +# image: alpine +# command: ['sleep', '60'] + +extraInitContainers: [] + +## extraEnv [array] Supply extra env variables to main container using full notation +## Example: (With default env vars and values taken from generated config map) +# extraEnv: +# - name: AIRBYTE_VERSION +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: AIRBYTE_VERSION +# - name: API_URL +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: API_URL +# - name: TRACKING_STRATEGY +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: TRACKING_STRATEGY +# - name: FULLSTORY +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: FULLSTORY +# - name: INTERNAL_API_HOST +# valueFrom: +# configMapKeyRef: +# name: airbyte-env +# key: INTERNAL_API_HOST +## +extraEnv: [] +## secrets [object] Supply additional secrets to container +## Example: +## secrets: +## DATABASE_PASSWORD: strong-password +## DATABASE_USER: my-db-user +secrets: {} + +## env_vars [object] Supply extra env variables to main container using simplified notation +## Example with default values for workload launcher: +# env_vars: +# AIRBYTE_VERSION: 0.40.4 + +# # Workspace storage for running jobs (logs, etc) +# WORKSPACE_ROOT: /workspace +# WORKSPACE_DOCKER_MOUNT: airbyte_workspace + +# # Miscellaneous +# TRACKING_STRATEGY: segment +# WEBAPP_URL: airbyte-webapp-svc:80 +# INTERNAL_API_HOST: http://airbyte-server-svc:8001 +env_vars: {} + +## extraSelectorLabels [object] - use to specify own additional selector labels for deployment +extraSelectorLabels: {} +## extraLabels [object] - use to specify own additional labels for deployment +extraLabels: {} + +## workloadApi: +## bearerTokenSecretName: workload-api-bearer-token-name kubernetes secret name where bearer token is stored +## bearerTokenSecretKey: workload-api-bearer-token-key kubernetes secret key where bearer token is stored +workloadApi: {} + +debug: + enabled: false + remoteDebugPort: 5005 diff --git a/helm/airbyte-v1/templates/NOTES.txt b/helm/airbyte-v1/templates/NOTES.txt new file mode 100644 index 00000000..6487ae65 --- /dev/null +++ b/helm/airbyte-v1/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.webapp.ingress.enabled }} +{{- range $host := .Values.webapp.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.webapp.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.webapp.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "airbyte.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.webapp.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "airbyte.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "airbyte.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.webapp.service.port }} +{{- else if contains "ClusterIP" .Values.webapp.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name=webapp" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/helm/airbyte-v1/templates/_database.tpl b/helm/airbyte-v1/templates/_database.tpl new file mode 100644 index 00000000..3e8d567d --- /dev/null +++ b/helm/airbyte-v1/templates/_database.tpl @@ -0,0 +1,234 @@ +{{/* +Database Configuration +*/}} + +{{/* +Renders the database host +*/}} +{{- define "airbyte.database.host" }} + {{- if .Values.postgresql.enabled }} + {{- printf "%s" "airbyte-db-svc" }} + {{- else if .Values.global.database.host }} + {{- .Values.global.database.host }} + {{- else }} + {{ $host := .Values.global.database.host | required "You must set `global.database.host` when using an external database" }} + {{- end }} +{{- end }} + +{{/* +Renders an environment variable definition that provides the database host +*/}} +{{- define "airbyte.database.host.env" }} +- name: DATABASE_HOST + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: DATABASE_HOST +{{- end }} + +{{/* +Renders the database port +*/}} +{{- define "airbyte.database.port" }} + {{- if .Values.postgresql.enabled }} + {{- printf "%s" "5432" }} + {{- else if .Values.global.database.port }} + {{- .Values.global.database.port }} + {{- else }} + {{ $port := .Values.global.database.port | required "You must set `global.database.port` when using an external database" }} + {{- end }} +{{- end }} + +{{/* +Renders an environment variable definition that provides the database port +*/}} +{{- define "airbyte.database.port.env" }} +- name: DATABASE_PORT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: DATABASE_PORT +{{- end }} + +{{/* +Renders the database name +*/}} +{{- define "airbyte.database.name" }} + {{- if .Values.postgresql.enabled }} + {{- .Values.postgresql.postgresqlDatabase }} + {{- else if .Values.global.database.database }} + {{- .Values.global.database.database }} + {{- else }} + {{ $database := .Values.global.database.database | required "You must set `global.database.database` when using an external database" }} + {{- end }} +{{- end }} + +{{/* +Renders an environment variable definition that provides the database name +*/}} +{{- define "airbyte.database.name.env" }} +- name: DATABASE_DB + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: DATABASE_DB +{{- end }} + +{{/* +Renders the database user +*/}} +{{- define "airbyte.database.user" }} + {{- if .Values.postgresql.enabled }} + {{- .Values.postgresql.postgresqlUsername }} + {{- else if .Values.global.database.user }} + {{- .Values.global.database.user }} + {{- else }} + {{- if .Values.global.database.userSecretKey }} + {{ $secretName := .Values.global.database.secretName | required "You must set `global.database.secretName` when using an external database" }} + {{- else }} + {{ $user := .Values.global.database.user | required "You must set `global.database.user` when using an external database" }} + {{- end }} + {{- end }} +{{- end }} + +{{/* +Renders the name of the secret where the database user will be referenced +*/}} +{{- define "airbyte.database.userSecretKey" }} + {{- if .Values.global.database.userSecretKey }} + {{ $secretName := .Values.global.database.secretName | required "You must set `global.database.secretName` when using an external database" }} + {{- .Values.global.database.userSecretKey }} + {{- else }} + {{- printf "%s" "DATABASE_USER" }} + {{- end }} +{{- end }} + +{{/* +Renders an environment variable definition that provides the database user +*/}} +{{- define "airbyte.database.user.env" }} +- name: DATABASE_USER + valueFrom: + secretKeyRef: + {{- if .Values.global.database.userSecretKey }} + name: {{ .Values.global.database.secretName }} + {{- else }} + name: {{ .Release.Name }}-airbyte-secrets + {{- end }} + key: {{ include "airbyte.database.userSecretKey" .}} +{{- end }} + +{{/* +Renders the database password +*/}} +{{- define "airbyte.database.password" }} + {{- if .Values.postgresql.enabled }} + {{- .Values.postgresql.postgresqlPassword }} + {{- else if .Values.global.database.password }} + {{- .Values.global.database.password }} + {{- else }} + {{- if .Values.global.database.passwordSecretKey }} + {{ $secretName := .Values.global.database.secretName | required "You must set `global.database.secretName` when using an external database" }} + {{- else }} + {{ $password := .Values.global.database.password | required "You must set `global.database.password` when using an external database" }} + {{- end }} + {{- end }} +{{- end }} + +{{/* +Renders the name of the secret where the database password will be referenced +*/}} +{{- define "airbyte.database.passwordSecretKey" }} + {{- if .Values.global.database.passwordSecretKey }} + {{ $secretName := .Values.global.database.secretName | required "You must set `global.database.secretName` when using an external database" }} + {{- .Values.global.database.passwordSecretKey }} + {{- else }} + {{- printf "%s" "DATABASE_PASSWORD" }} + {{- end }} +{{- end }} + +{{/* +Renders an environment variable definition that provides the database password +*/}} +{{- define "airbyte.database.password.env" }} +- name: DATABASE_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "airbyte.database.secretName" . }} + key: {{ include "airbyte.database.passwordSecretKey" . }} +{{- end }} + + +{{/* +Renders the database url (JDBC) +*/}} +{{- define "airbyte.database.url" }} +{{- $host := (include "airbyte.database.host" .) }} +{{- $dbName := (include "airbyte.database.name" .) }} +{{- $port := (include "airbyte.database.port" . ) }} +{{- printf "jdbc:postgresql://%s:%s/%s" $host $port $dbName }} +{{- end }} + +{{/* +Renders an environment variable definition that provides the database url (JDBC) +*/}} +{{- define "airbyte.database.url.env" }} +- name: DATABASE_URL + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: DATABASE_URL +{{- end }} + +{{/* +Renders the name of the secret containing database credentials +*/}} +{{- define "airbyte.database.secretName" }} + {{- if .Values.global.database.secretName }} + {{- .Values.global.database.secretName | quote }} + {{- else }} + {{ .Release.Name }}-airbyte-secrets + {{- end }} +{{- end }} + +{{/* +Renders all of the common environment variables which provide database credentials +*/}} +{{- define "airbyte.database.envs" }} +{{ include "airbyte.database.host.env" . }} +{{ include "airbyte.database.port.env" . }} +{{ include "airbyte.database.name.env" . }} +{{ include "airbyte.database.user.env" . }} +{{ include "airbyte.database.password.env" . }} +{{ include "airbyte.database.url.env" . }} +{{- end }} + +{{/* +Renders a set of database secrets to be included in the shared Airbyte secret +*/}} +{{- define "airbyte.database.secrets" }} +{{ $user := (include "airbyte.database.user" .)}} +{{- if not (empty $user) }} +DATABASE_USER: {{ $user }} +{{- end }} +{{ $password := (include "airbyte.database.password" .)}} +{{- if not (empty $password) }} +DATABASE_PASSWORD: {{ $password }} +{{- end}} +{{- end }} + +{{/* +Renders a set of database configuration variables to be included in the shared Airbyte config map +*/}} +{{- define "airbyte.database.configVars" }} +DATABASE_HOST: {{ include "airbyte.database.host" . }} +DATABASE_PORT: {{ include "airbyte.database.port" . | quote }} +DATABASE_DB: {{ include "airbyte.database.name" . }} +DATABASE_URL: {{ include "airbyte.database.url" . }} +{{- if .Values.global.database.user }} +DATABASE_USER: {{ include "airbyte.database.user" . }} +{{- end}} +{{- if .Values.global.database.password }} +DATABASE_PASSWORD: {{ include "airbyte.database.password" . }} +{{- end}} +{{- end }} diff --git a/helm/airbyte-v1/templates/_enterprise.tpl b/helm/airbyte-v1/templates/_enterprise.tpl new file mode 100644 index 00000000..8e74d5aa --- /dev/null +++ b/helm/airbyte-v1/templates/_enterprise.tpl @@ -0,0 +1,83 @@ +{{/* +Enteprise Configuration +*/}} + +{{- define "airbyte.enterprise.license" -}} +{{- if and (or (eq .Values.global.edition "pro") (eq .Values.global.edition "enterprise")) (not .Values.global.airbyteYml) }} +{{- $secretName := .Values.global.enterprise.secretName | required "You must set `global.enterprise.secretName` when `global.edition` is 'enterprise'" }} +{{- $secretKey := .Values.global.enterprise.licenseKeySecretKey | required "You must set `global.enterprise.licenseKeySecretKey` when `global.edition` is 'enterprise'" }} +- name: AIRBYTE_LICENSE_KEY + valueFrom: + secretKeyRef: + name: {{ .Values.global.enterprise.secretName | default (printf "%s-airbyte-secrets" .Release.Name) }} + key: {{ .Values.global.enterprise.licenseKeySecretKey }} +{{- end }} +{{- end }} + +{{- define "airbyte.enterprise.instanceAdmin" -}} +{{- if and (or (eq .Values.global.edition "pro") (eq .Values.global.edition "enterprise")) (not .Values.global.airbyteYml) }} +{{- $auth := .Values.global.auth | required "You must set `global.auth` when `global.edition` is 'enterprise'"}} +{{- $authInstanceAdminSecretName := .Values.global.auth.instanceAdmin.secretName | required "You must set `global.auth.instanceAdmin.secretName` when `global.edition` is 'enterprise'" }} +{{- $authInstanceAdminFirstName := .Values.global.auth.instanceAdmin.firstName | required "You must set `global.auth.instanceAdmin.firstName` when `global.edition` is 'enterprise'" }} +{{- $authInstanceAdminLastName := .Values.global.auth.instanceAdmin.lastName | required "You must set `global.auth.instanceAdmin.lastName` when `global.edition` is 'enterprise'" }} +{{- $authInstanceAdminEmailSecretKey := .Values.global.auth.instanceAdmin.emailSecretKey | required "You must set `global.auth.instanceAdmin.emailSecretKey` when `global.edition` is 'enterprise'" }} +{{- $authInstanceAdminPasswordSecretKey := .Values.global.auth.instanceAdmin.passwordSecretKey | required "You must set `global.auth.instanceAdmin.passwordSecretKey` when `global.edition` is 'enterprise'" }} +- name: INITIAL_USER_FIRST_NAME + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: INITIAL_USER_FIRST_NAME +- name: INITIAL_USER_LAST_NAME + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: INITIAL_USER_LAST_NAME +- name: INITIAL_USER_EMAIL + valueFrom: + secretKeyRef: + name: {{ .Values.global.auth.instanceAdmin.secretName | default (printf "%s-airbyte-secrets" .Release.Name) }} + key: {{ .Values.global.auth.instanceAdmin.emailSecretKey }} +- name: INITIAL_USER_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.global.auth.instanceAdmin.secretName | default (printf "%s-airbyte-secrets" .Release.Name) }} + key: {{ .Values.global.auth.instanceAdmin.passwordSecretKey }} +{{- end }} +{{- end }} + +{{- define "airbyte.enterprise.identityProvider" -}} +{{- if and (or (eq .Values.global.edition "pro") (eq .Values.global.edition "enterprise")) (not .Values.global.airbyteYml) .Values.global.auth.identityProvider }} +{{- $authIdentityProviderSecretName := .Values.global.auth.identityProvider.secretName | required "You must set `global.auth.identityProvider.secretName` when enabling SSO" }} +{{- $authIdentityProviderType := .Values.global.auth.identityProvider.type | required "You must set `global.auth.identityProvider.type` when enabling SSO "}} +{{- $authIdentityProviderOIDC := .Values.global.auth.identityProvider.oidc | required "You must set `global.auth.identityProvider.oidc` when enabling SSO" }} +{{- $authIdentityProviderOIDCDomain := .Values.global.auth.identityProvider.oidc.domain | required "You must set `global.auth.identityProvider.oidc.domain` when enabling SSO" }} +{{- $authIdentityProviderOIDCAppName := .Values.global.auth.identityProvider.oidc.appName | required "You must set `global.auth.identityProvider.oidc.appName` when enabling SSO" }} +{{- $authIdentityProviderOIDCClientIdSecretKey := .Values.global.auth.identityProvider.oidc.clientIdSecretKey | required "You must set `global.auth.identityProvider.oidc.clientIdSecretKey` when enabling SSO" }} +{{- $authIdentityProviderOIDCClientSecretSecretKey := .Values.global.auth.identityProvider.oidc.clientSecretSecretKey | required "You must set `global.auth.identityProvider.oidc.clientSecretSecretKey` when enabling SSO" }} +- name: IDENTITY_PROVIDER_TYPE + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: IDENTITY_PROVIDER_TYPE +- name: OIDC_DOMAIN + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: OIDC_DOMAIN +- name: OIDC_APP_NAME + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: OIDC_APP_NAME +- name: OIDC_CLIENT_ID + valueFrom: + secretKeyRef: + name: {{ .Values.global.auth.identityProvider.secretName | default (printf "%s-airbyte-secrets" .Release.Name) }} + key: {{ .Values.global.auth.identityProvider.oidc.clientIdSecretKey }} +- name: OIDC_CLIENT_SECRET + valueFrom: + secretKeyRef: + name: {{ .Values.global.auth.identityProvider.secretName | default (printf "%s-airbyte-secrets" .Release.Name) }} + key: {{ .Values.global.auth.identityProvider.oidc.clientSecretSecretKey }} +{{- end }} +{{- end }} diff --git a/helm/airbyte-v1/templates/_helpers.tpl b/helm/airbyte-v1/templates/_helpers.tpl new file mode 100644 index 00000000..d99db7f4 --- /dev/null +++ b/helm/airbyte-v1/templates/_helpers.tpl @@ -0,0 +1,350 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "airbyte.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "airbyte.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "airbyte.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "airbyte.labels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "airbyte.selectorLabels" -}} +app.kubernetes.io/name: {{ include "airbyte.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + + +{{/* +Common DB labels +*/}} +{{- define "airbyte.databaseLabels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.databaseSelectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector DB labels +*/}} +{{- define "airbyte.databaseSelectorLabels" -}} +app.kubernetes.io/name: {{ printf "%s-db" .Release.Name }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Common DB labels +*/}} +{{- define "airbyte.minioLabels" -}} +helm.sh/chart: {{ include "airbyte.chart" . }} +{{ include "airbyte.minioSelectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector DB labels +*/}} +{{- define "airbyte.minioSelectorLabels" -}} +app.kubernetes.io/name: {{ printf "%s-minio" .Release.Name }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "airbyte.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "airbyte.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Add environment variables to configure minio +*/}} +{{- define "airbyte.storage.minio.endpoint" -}} +{{- if ((((.Values.global).storage).minio).endpoint) }} + {{- .Values.global.storage.minio.endpoint -}} +{{- else -}} + {{- printf "http://airbyte-minio-svc:9000" -}} +{{- end -}} +{{- end -}} + +{{- define "airbyte.s3PathStyleAccess" -}} +{{- ternary "true" "" (eq (lower (default "" .Values.global.storage.type)) "minio") -}} +{{- end -}} + +{{/* +Returns the GCP credentials path +*/}} +{{- define "airbyte.gcpLogCredentialsPath" -}} +{{- if ((((.Values.global).storage).gcs).credentialsPath) }} + {{- printf "%s" .Values.global.storage.gcs.credentialsPath -}} +{{- else -}} + {{- printf "%s" "/secrets/gcs-log-creds/gcp.json" -}} +{{- end -}} +{{- end -}} + +{{/* +Construct comma separated list of key/value pairs from object (useful for ENV var values) +*/}} +{{- define "airbyte.flattenMap" -}} +{{- $kvList := list -}} +{{- range $key, $value := . -}} +{{- $kvList = printf "%s=%s" $key $value | mustAppend $kvList -}} +{{- end -}} +{{ join "," $kvList }} +{{- end -}} + +{{/* +Construct semi-colon delimited list of comma separated key/value pairs from array of objects (useful for ENV var values) +*/}} +{{- define "airbyte.flattenArrayMap" -}} +{{- $mapList := list -}} +{{- range $element := . -}} +{{- $mapList = include "airbyte.flattenMap" $element | mustAppend $mapList -}} +{{- end -}} +{{ join ";" $mapList }} +{{- end -}} + +## DEFAULT HELM VALUES +# Secret Manager Defaults +{{/* +Define secret persistence +*/}} +{{- define "airbyte.secretPersistence" -}} +{{- if (((.Values.global).secretsManager).type) }} + {{- printf "%s" (snakecase .Values.global.secretsManager.type) }} +{{- else }} + {{- printf "" }} +{{- end }} +{{- end }} + +{{/* +Get secret store name or default +*/}} +{{- define "airbyte.secretStoreName" -}} +{{- $secretStoreName := . -}} +{{- if $secretStoreName -}} + {{- printf "%s" $secretStoreName -}} +{{- else -}} + {{- printf "airbyte-config-secrets" -}} +{{- end -}} +{{- end -}} + +{{/* +Get awsSecretManager access key id secret key or default +*/}} +{{- define "airbyte.awsSecretManagerAccessKeyIdSecretKey" -}} +{{- $awsSecretManagerAccessKeyIdSecretKey := . -}} +{{- if $awsSecretManagerAccessKeyIdSecretKey -}} + {{- printf "%s" $awsSecretManagerAccessKeyIdSecretKey -}} +{{- else -}} + {{- printf "aws-secret-manager-access-key-id" -}} +{{- end -}} +{{- end -}} + +{{/* +Get awsSecretManager secret access key secret key or default +*/}} +{{- define "airbyte.awsSecretManagerSecretAccessKeySecretKey" -}} +{{- $awsSecretManagerSecretAccessKeySecretKey := . -}} +{{- if $awsSecretManagerSecretAccessKeySecretKey -}} + {{- printf "%s" $awsSecretManagerSecretAccessKeySecretKey -}} +{{- else -}} + {{- printf "aws-secret-manager-secret-access-key" -}} +{{- end -}} +{{- end -}} + +{{/* +Get googleSecretManager credentials secret key or default +*/}} +{{- define "airbyte.googleSecretManagerCredentialsSecretKey" -}} +{{- $googleSecretManagerCredentialsSecretKey := . -}} +{{- if $googleSecretManagerCredentialsSecretKey -}} + {{- printf "%s" $googleSecretManagerCredentialsSecretKey -}} +{{- else -}} + {{- printf "google-secret-manager-credentials" -}} +{{- end -}} +{{- end -}} + +{{/* +Get vault auth token secret key or default +*/}} +{{- define "airbyte.vaultAuthTokenSecretKey" -}} +{{- $vaultAuthTokenSecretKey := . -}} +{{- if $vaultAuthTokenSecretKey -}} + {{- printf "%s" $vaultAuthTokenSecretKey -}} +{{- else -}} + {{- printf "vault-auth-token" -}} +{{- end -}} +{{- end -}} + + +# Storage Defaults +{{/* +Get storage type or default +*/}} +{{- define "airbyte.storageType" -}} +{{- $storageType := . -}} +{{- if $storageType -}} + {{- printf "%s" $storageType -}} +{{- else -}} + {{- printf "local" -}} +{{- end -}} +{{- end -}} + +{{/* +Get storage bucket log or default +*/}} +{{- define "airbyte.storageBucketLog" -}} +{{- $storageBucketLog := . -}} +{{- if $storageBucketLog -}} + {{- printf "%s" $storageBucketLog -}} +{{- else -}} + {{- printf "airbyte-storage" -}} +{{- end -}} +{{- end -}} + +{{/* +Get storage bucket state or default +*/}} +{{- define "airbyte.storageBucketState" -}} +{{- $storageBucketState := . -}} +{{- if $storageBucketState -}} + {{- printf "%s" $storageBucketState -}} +{{- else -}} + {{- printf "airbyte-storage" -}} +{{- end -}} +{{- end -}} + +{{/* +Get storage bucket workload output or default +*/}} +{{- define "airbyte.storageBucketWorkloadOutput" -}} +{{- $storageBucketWorkloadOutput := . -}} +{{- if $storageBucketWorkloadOutput -}} + {{- printf "%s" $storageBucketWorkloadOutput -}} +{{- else -}} + {{- printf "airbyte-storage" -}} +{{- end -}} +{{- end -}} + +{{/* +Get s3 access key id secret key or default +*/}} +{{- define "airbyte.s3AccessKeyIdSecretKey" -}} +{{- $s3AccessKeyIdSecretKey := . -}} +{{- if $s3AccessKeyIdSecretKey -}} + {{- printf "%s" $s3AccessKeyIdSecretKey -}} +{{- else -}} + {{- printf "s3-access-key-id" -}} +{{- end -}} +{{- end -}} + +{{/* +Get s3 secret access key secret key or default +*/}} +{{- define "airbyte.s3SecretAccessKeySecretKey" -}} +{{- $s3SecretAccessKeySecretKey := . -}} +{{- if $s3SecretAccessKeySecretKey -}} + {{- printf "%s" $s3SecretAccessKeySecretKey -}} +{{- else -}} + {{- printf "s3-secret-access-key" -}} +{{- end -}} +{{- end -}} + +{{/* +Get minio access key id secret key or default +*/}} +{{- define "airbyte.minioAccessKeyIdSecretKey" -}} +{{- $minioAccessKeyIdSecretKey := . -}} +{{- if $minioAccessKeyIdSecretKey -}} + {{- printf "%s" $minioAccessKeyIdSecretKey -}} +{{- else -}} + {{- printf "minio-access-key-id" -}} +{{- end -}} +{{- end -}} + +{{/* +Get minio secret access key secret key or default +*/}} +{{- define "airbyte.minioSecretAccessKeySecretKey" -}} +{{- $minioSecretAccessKeySecretKey := . -}} +{{- if $minioSecretAccessKeySecretKey -}} + {{- printf "%s" $minioSecretAccessKeySecretKey -}} +{{- else -}} + {{- printf "minio-secret-access-key" -}} +{{- end -}} +{{- end -}} + +{{/* +Get gcs credentials secret key or default +*/}} +{{- define "airbyte.gcsCredentialsSecretKey" -}} +{{- $gcsCredentialsSecretKey := . -}} +{{- if $gcsCredentialsSecretKey -}} + {{- printf "%s" $gcsCredentialsSecretKey -}} +{{- else -}} + {{- printf "gcs-credentials" -}} +{{- end -}} +{{- end -}} + +{{/* +Convert tags to a comma-separated list of key=value pairs. +*/}} +{{- define "airbyte.tagsToString" -}} +{{- $result := list -}} +{{- range . -}} + {{- $key := .key -}} + {{- $value := .value -}} + {{- if eq (typeOf $value) "bool" -}} + {{- $value = ternary "true" "false" $value -}} + {{- end -}} + {{- $result = append $result (printf "%s=%s" $key $value) -}} +{{- end -}} +{{- join "," $result -}} +{{- end -}} diff --git a/helm/airbyte-v1/templates/_images.tpl b/helm/airbyte-v1/templates/_images.tpl new file mode 100644 index 00000000..6c32ec44 --- /dev/null +++ b/helm/airbyte-v1/templates/_images.tpl @@ -0,0 +1,17 @@ +{{- define "imageUrl" -}} +{{- $img := index . 0 -}} +{{- $root := index . 1 -}} + +{{- $reg := $root.Values.global.image.registry -}} +{{/* ensure the registry has a trailing slash, if set */}} +{{- $reg = (ternary $reg (printf "%s/" (trimSuffix "/" $reg)) (empty $reg)) -}} + +{{/* some images are defined as a string instead of an object (busybox, curl, connector sidecar, etc) */}} +{{- if (eq (typeOf $img) "string") -}} +{{- printf "%s%s" $reg (tpl $img $root) | quote -}} +{{- else -}} +{{- $tag := coalesce $img.tag $root.Values.global.image.tag $root.Chart.AppVersion -}} +{{- printf "%s%s:%s" $reg $img.repository $tag | quote -}} +{{- end -}} + +{{- end -}} \ No newline at end of file diff --git a/helm/airbyte-v1/templates/_keycloak.tpl b/helm/airbyte-v1/templates/_keycloak.tpl new file mode 100644 index 00000000..ac0545db --- /dev/null +++ b/helm/airbyte-v1/templates/_keycloak.tpl @@ -0,0 +1,44 @@ +{{/* +Keycloak Configuration +*/}} + +{{- define "airbyte.keycloak.database.user.env" }} +- name: KEYCLOAK_DATABASE_USERNAME + valueFrom: + secretKeyRef: + {{- if .Values.global.database.userSecretKey }} + name: {{ .Values.global.database.secretName }} + {{- else }} + name: {{ .Release.Name }}-airbyte-secrets + {{- end }} + key: {{ include "airbyte.database.userSecretKey" .}} +{{- end }} + +{{- define "airbyte.keycloak.database.password.env" }} +- name: KEYCLOAK_DATABASE_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "airbyte.database.secretName" . }} + key: {{ include "airbyte.database.passwordSecretKey" . }} +{{- end }} + +{{- define "airbyte.keycloak.database.url" }} +{{ $host := (include "airbyte.database.host" .) }} +{{ $dbName := (include "airbyte.database.name" .) }} +{{ $port := (include "airbyte.database.port" . ) }} +{{- printf "jdbc:postgresql://%s:%s/%s?currentSchema=keycloak" $host $port $dbName }} +{{- end }} + +{{- define "airbyte.keycloak.database.url.env" }} +- name: KEYCLOAK_DATABASE_URL + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: KEYCLOAK_DATABASE_URL +{{- end }} + +{{- define "airbyte.keycloak.database.envs" }} +{{ include "airbyte.keycloak.database.user.env" . }} +{{ include "airbyte.keycloak.database.password.env" . }} +{{ include "airbyte.keycloak.database.url.env" . }} +{{- end }} diff --git a/helm/airbyte-v1/templates/_logging.tpl b/helm/airbyte-v1/templates/_logging.tpl new file mode 100644 index 00000000..f1382739 --- /dev/null +++ b/helm/airbyte-v1/templates/_logging.tpl @@ -0,0 +1,10 @@ +{{/* +Common logging configs +*/}} +{{- define "airbyte.logging.envs" }} +- name: LOG_LEVEL + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: LOG_LEVEL +{{- end }} diff --git a/helm/airbyte-v1/templates/_storage.tpl b/helm/airbyte-v1/templates/_storage.tpl new file mode 100644 index 00000000..70819063 --- /dev/null +++ b/helm/airbyte-v1/templates/_storage.tpl @@ -0,0 +1,243 @@ +{{/* +Storage configs +*/}} + +{{/* +Returns the provider name +*/}} +{{- define "airbyte.storage.provider" }} +{{- if .Values.global.storage.type }} + {{- printf "%s" (lower .Values.global.storage.type) }} +{{- else }} + {{- printf "minio" }} +{{- end }} +{{- end }} + +{{/* +Returns the storage provider secret name +*/}} +{{- define "airbyte.storage.secretName" }} +{{- if .Values.global.storage.secretName }} + {{- printf "%s" .Values.global.storage.secretName }} +{{- else if .Values.global.storage.storageSecretName }} + {{- printf "%s" .Values.global.storage.storageSecretName }} +{{- else -}} + {{/* GCS has its own default secret we create */}} + {{- if eq (include "airbyte.storage.provider" .) "gcs" }} + {{- printf "%s-gcs-log-creds" .Release.Name }} + {{- else }} + {{- printf "%s-airbyte-secrets" .Release.Name }} + {{- end }} +{{- end }} +{{- end }} + +{{/* +Returns azure environment variables. +*/}} +{{- define "airbyte.storage.azure.envs" }} +{{- if .Values.global.storage.azure.connectionString }} +- name: AZURE_STORAGE_CONNECTION_STRING + value: {{ .Values.global.storage.azure.connectionString }} +{{- end }} +{{- if .Values.global.storage.azure.connectionStringSecretKey }} +- name: AZURE_STORAGE_CONNECTION_STRING + valueFrom: + secretKeyRef: + name: {{ include "airbyte.storage.secretName" . }} + key: {{ .Values.global.storage.azure.connectionStringSecretKey }} +{{- end }} +{{- end }} + +{{/* +Returns azure secrets +*/}} +{{- define "airbyte.storage.azure.secrets" }} +{{- if .Values.global.storage.azure }} +AZURE_STORAGE_CONNECTION_STRING: {{ .Values.global.storage.azure.connectionString | default "" }} +{{- end }} +{{- end }} + +{{/* +Returns S3 environment variables. +*/}} +{{- define "airbyte.storage.s3.envs" }} +{{- if eq .Values.global.storage.s3.authenticationType "credentials" }} +- name: AWS_ACCESS_KEY_ID + valueFrom: + secretKeyRef: + name: {{ include "airbyte.storage.secretName" . }} + key: {{ .Values.global.storage.s3.accessKeyIdSecretKey | default "s3-access-key-id" }} +- name: AWS_SECRET_ACCESS_KEY + valueFrom: + secretKeyRef: + name: {{ include "airbyte.storage.secretName" . }} + key: {{ .Values.global.storage.s3.secretAccessKeySecretKey | default "s3-secret-access-key" }} +{{- end }} +{{- if .Values.global.storage.s3.region }} +- name: AWS_DEFAULT_REGION + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: AWS_DEFAULT_REGION +{{- end }} +{{- end}} + +{{/* +Returns S3 secrets +*/}} +{{- define "airbyte.storage.s3.secrets" }} +{{- if and (.Values.global.storage.s3) (eq .Values.global.storage.s3.authenticationType "credentials") }} +AWS_ACCESS_KEY_ID: {{ .Values.global.storage.s3.accessKeyId | default "" }} +AWS_SECRET_ACCESS_KEY: {{ .Values.global.storage.s3.secretAccessKey | default "" }} +{{- end }} +{{- end }} + +{{/* +Returns GCS environment variables. +*/}} +{{- define "airbyte.storage.gcs.envs" }} +- name: GOOGLE_APPLICATION_CREDENTIALS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: GOOGLE_APPLICATION_CREDENTIALS +{{- end}} + +{{/* +Returns GCS secrets. +*/}} +{{- define "airbyte.storage.gcs.secrets" }} +{{- if .Values.global.storage.gcs }} +gcp.json: {{ .Values.global.storage.gcs.credentialsJson }} +{{- end }} +{{- end}} + +{{/* +Returns Minio environment variables. +*/}} +{{- define "airbyte.storage.minio.envs" }} +{{- if .Values.global.storage.minio }} +- name: AWS_ACCESS_KEY_ID + valueFrom: + secretKeyRef: + name: {{ include "airbyte.storage.secretName" . }} + key: {{ .Values.global.storage.minio.accessKeyIdSecretKey | default "MINIO_ACCESS_KEY_ID" }} +- name: AWS_SECRET_ACCESS_KEY + valueFrom: + secretKeyRef: + name: {{ include "airbyte.storage.secretName" . }} + key: {{ .Values.global.storage.minio.secretAccessKeySecretKey | default "MINIO_SECRET_ACCESS_KEY" }} +{{- else }} +- name: AWS_ACCESS_KEY_ID + valueFrom: + secretKeyRef: + name: {{ include "airbyte.storage.secretName" . }} + key: "MINIO_ACCESS_KEY_ID" +- name: AWS_SECRET_ACCESS_KEY + valueFrom: + secretKeyRef: + name: {{ include "airbyte.storage.secretName" . }} + key: "MINIO_SECRET_ACCESS_KEY" +{{- end }} +- name: MINIO_ENDPOINT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MINIO_ENDPOINT +{{- end }} + +{{- define "airbyte.storage.minio.secrets" }} +{{- if .Values.global.storage.minio }} +MINIO_ACCESS_KEY_ID: {{ .Values.global.storage.minio.accessKeyId | default "minio" | quote }} +MINIO_SECRET_ACCESS_KEY: {{ .Values.global.storage.minio.secretAccessKey | default "minio123" | quote }} +{{- else }} +MINIO_ACCESS_KEY_ID: "minio" +MINIO_SECRET_ACCESS_KEY: "minio123" +{{- end }} +{{- end }} + +{{/* +Returns storage config environment variables. +*/}} +{{- define "airbyte.storage.envs" }} +{{- $storageProvider := (include "airbyte.storage.provider" .) }} +- name: S3_PATH_STYLE_ACCESS + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: S3_PATH_STYLE_ACCESS +- name: STORAGE_TYPE + value: {{ upper $storageProvider }} +- name: STORAGE_BUCKET_ACTIVITY_PAYLOAD + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STORAGE_BUCKET_ACTIVITY_PAYLOAD +- name: STORAGE_BUCKET_LOG + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STORAGE_BUCKET_LOG +- name: STORAGE_BUCKET_STATE + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STORAGE_BUCKET_STATE +- name: STORAGE_BUCKET_WORKLOAD_OUTPUT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: STORAGE_BUCKET_WORKLOAD_OUTPUT +{{/* S3 */}} +{{- if eq $storageProvider "s3" }} +{{- include "airbyte.storage.s3.envs" . }} +{{- end }} + +{{/* GCS */}} +{{- if eq $storageProvider "gcs" }} +{{- include "airbyte.storage.gcs.envs" . }} +{{- end }} + +{{/* MINIO */}} +{{- if eq $storageProvider "minio" }} +{{- include "airbyte.storage.minio.envs" . }} +{{- end }} + +{{/* AZURE */}} +{{- if eq $storageProvider "azure" }} +{{- include "airbyte.storage.azure.envs" . }} +{{- end }} + +{{- end }} + +{{/* +Returns storage config variables. +*/}} +{{- define "airbyte.storage.configVars" }} +{{- end }} + +{{/* +Returns storage config secrets. +*/}} +{{- define "airbyte.storage.secrets" }} +{{- $storageProvider := (include "airbyte.storage.provider" .) }} +{{/* S3 */}} +{{- if eq $storageProvider "s3" }} +{{- include "airbyte.storage.s3.secrets" . }} +{{- end }} + +{{/* GCS */}} +{{- if eq $storageProvider "gcs" }} +{{- include "airbyte.storage.gcs.secrets" . }} +{{- end }} + +{{/* MINIO */}} +{{- if eq $storageProvider "minio" }} +{{- include "airbyte.storage.minio.secrets" . }} +{{- end }} + +{{/* AZURE */}} +{{- if eq $storageProvider "azure" }} +{{- include "airbyte.storage.azure.secrets" . }} +{{- end }} +{{- end }} diff --git a/helm/airbyte-v1/templates/_temporal.tpl b/helm/airbyte-v1/templates/_temporal.tpl new file mode 100644 index 00000000..c4e213c9 --- /dev/null +++ b/helm/airbyte-v1/templates/_temporal.tpl @@ -0,0 +1,58 @@ +{{/* +Temporal Configuration +*/}} + +{{- define "airbyte.temporal.database.host.env" }} +- name: POSTGRES_SEEDS + valueFrom: + {{- if .Values.global.database.hostSecretKey }} + secretKeyRef: + name: {{ include "airbyte.database.secretName" . }} + key: {{ .Values.global.database.hostSecretKey }} + {{- else }} + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: DATABASE_HOST + {{- end }} +{{- end }} + +{{- define "airbyte.temporal.database.port.env" }} +- name: DB_PORT + valueFrom: + {{- if .Values.global.database.portSecretKey }} + secretKeyRef: + name: {{ include "airbyte.database.secretName" . }} + key: {{ .Values.global.database.portSecretKey }} + {{- else }} + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: DATABASE_PORT + {{- end }} +{{- end }} + +{{- define "airbyte.temporal.database.user.env" }} +- name: POSTGRES_USER + valueFrom: + secretKeyRef: + {{- if .Values.global.database.userSecretKey }} + name: {{ .Values.global.database.secretName }} + {{- else }} + name: {{ .Release.Name }}-airbyte-secrets + {{- end }} + key: {{ include "airbyte.database.userSecretKey" .}} +{{- end }} + +{{- define "airbyte.temporal.database.password.env" }} +- name: POSTGRES_PWD + valueFrom: + secretKeyRef: + name: {{ include "airbyte.database.secretName" . }} + key: {{ include "airbyte.database.passwordSecretKey" . }} +{{- end }} + +{{- define "airbyte.temporal.database.envs" }} +{{ include "airbyte.temporal.database.host.env" . }} +{{ include "airbyte.temporal.database.port.env" . }} +{{ include "airbyte.temporal.database.user.env" . }} +{{ include "airbyte.temporal.database.password.env" . }} +{{- end }} diff --git a/helm/airbyte-v1/templates/airbyte-db.yaml b/helm/airbyte-v1/templates/airbyte-db.yaml new file mode 100644 index 00000000..91cbd658 --- /dev/null +++ b/helm/airbyte-v1/templates/airbyte-db.yaml @@ -0,0 +1,85 @@ +{{- if .Values.postgresql.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: airbyte-db-svc + annotations: + helm.sh/hook: pre-install + helm.sh/hook-weight: "-1" + labels: + {{ include "airbyte.databaseLabels" . | nindent 4 }} +spec: + type: ClusterIP + ports: + - port: 5432 + protocol: TCP + selector: + {{ include "airbyte.databaseSelectorLabels" . | nindent 4 }} +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: airbyte-db + annotations: + helm.sh/hook: pre-install + helm.sh/hook-weight: "-1" + labels: + {{ include "airbyte.databaseLabels" . | nindent 4 }} +spec: + replicas: 1 + serviceName: airbyte-db-svc + selector: + matchLabels: + {{ include "airbyte.databaseSelectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{ include "airbyte.databaseSelectorLabels" . | nindent 8 }} + spec: + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + containers: + - name: airbyte-db-container + image: {{ include "imageUrl" (list .Values.postgresql.image $) }} + env: + - name: POSTGRES_DB + value: {{ .Values.postgresql.postgresqlDatabase }} + - name: POSTGRES_PASSWORD + value: {{ .Values.postgresql.postgresqlPassword }} + - name: POSTGRES_USER + value: {{ .Values.postgresql.postgresqlUsername }} + - name: PGDATA + value: /var/lib/postgresql/data/pgdata + ports: + - containerPort: 5432 + securityContext: {{- toYaml .Values.postgresql.containerSecurityContext | nindent 12 }} + volumeMounts: + - name: airbyte-volume-db + mountPath: /var/lib/postgresql/data + {{- with .Values.postgresql.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.postgresql.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.postgresql.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: {{- toYaml .Values.postgresql.podSecurityContext | nindent 8 }} + + volumeClaimTemplates: + - metadata: + name: airbyte-volume-db + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: 500Mi +{{- end }} diff --git a/helm/airbyte-v1/templates/airbyte-yml-secret.yaml b/helm/airbyte-v1/templates/airbyte-yml-secret.yaml new file mode 100644 index 00000000..eb6574e6 --- /dev/null +++ b/helm/airbyte-v1/templates/airbyte-yml-secret.yaml @@ -0,0 +1,19 @@ +{{- if .Values.global.airbyteYml }} +# The Secret that contains the airbyte.yml content. For this to work helm must be started with +# --set-file global.airbyteYml=/airbyte.yml +# For Airbyte Enterprise our installation script automatically specifies this, for Community +# users will need to specify it, if they want to use the airbyte.yml config file. +# If nothing is specified we'll assume an empty config +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Release.Name }}-airbyte-yml + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-1" + labels: + {{- include "airbyte.labels" . | nindent 4 }} +type: Opaque +data: + fileContents: "{{ .Values.global.airbyteYml | default "" | nindent 4 | b64enc }}" +{{- end }} diff --git a/helm/airbyte-v1/templates/env-configmap.yaml b/helm/airbyte-v1/templates/env-configmap.yaml new file mode 100644 index 00000000..12c489d8 --- /dev/null +++ b/helm/airbyte-v1/templates/env-configmap.yaml @@ -0,0 +1,175 @@ +{{- $airbyteYmlDict := (default "" .Values.global.airbyteYml | fromYaml) }} +# default to empty dict if airbyteYml is undefined +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-airbyte-env + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-1" + labels: + {{- include "airbyte.labels" . | nindent 4 }} +data: + AIRBYTE_VERSION: {{ .Values.version | default .Chart.AppVersion }} + {{- if or (eq .Values.global.edition "pro") (eq .Values.global.edition "enterprise") }} + AIRBYTE_EDITION: "pro" + {{- else }} + AIRBYTE_EDITION: "community" + {{- end }} + + {{- if $airbyteYmlDict }} + AIRBYTE_URL: {{ (index $airbyteYmlDict "webapp-url") | quote }} + {{- else}} + AIRBYTE_URL: {{ .Values.global.airbyteUrl | quote }} + {{- end }} + +### Env vars requested by the Blotout team + # BLOTOUT_AUTH_ENDPOINT: "" + # BLOTOUT_BASE_URL: "" + AWS_SECRET_ACCESS_KEY: {{ .Values.global.aws_secret_key | default "" }} + AWS_ACCESS_KEY_ID: {{ .Values.global.aws_access_key | default "" | quote }} + JOB_MAIN_CONTAINER_CPU_REQUEST: {{ .Values.global.resource_cpu_request | default "0.5" }} + JOB_MAIN_CONTAINER_CPU_LIMIT: {{ .Values.global.resource_cpu_limit | default "2" }} + JOB_MAIN_CONTAINER_MEMORY_REQUEST: {{ .Values.global.resource_memory_request | default "1Gi" }} + JOB_MAIN_CONTAINER_MEMORY_LIMIT: {{ .Values.global.resource_memory_limit | default "2Gi" }} + SECRET_PERSISTENCE: {{ .Values.global.secret_persistence | default "" }} + S3_PATH_STYLE_ACCESS: {{ .Values.global.s3_path_style_access | default "" }} + +##################################################### + + + AIRBYTE_SERVER_HOST: {{ .Release.Name }}-airbyte-server-svc:{{ .Values.server.service.port }} + API_URL: {{ .Values.webapp.api.url }} + CONNECTOR_BUILDER_API_URL: {{ index .Values.webapp "connector-builder-server" "url" | quote }} + CONFIG_API_HOST: http://{{ .Release.Name }}-airbyte-server-svc:{{ .Values.server.service.port }} # temporary solution for oss kube deploys for airbyte api server until that server is wrapped into the config server + CONFIG_ROOT: /configs + CONFIGS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION: "0.35.15.001" + DATA_DOCKER_MOUNT: airbyte_data + DB_DOCKER_MOUNT: airbyte_db + {{- include "airbyte.database.configVars" . | nindent 2 }} + KEYCLOAK_DATABASE_URL: {{ include "airbyte.keycloak.database.url" . | quote }} + GOOGLE_APPLICATION_CREDENTIALS: {{ include "airbyte.gcpLogCredentialsPath" . | quote }} + INTERNAL_API_HOST: http://{{ .Release.Name }}-airbyte-server-svc:{{ .Values.server.service.port }} + WORKLOAD_API_HOST: http://{{ .Release.Name }}-workload-api-server-svc:{{ index .Values "workload-api-server" "service" "port" }} + + + {{- if or (eq .Values.global.edition "pro") (eq .Values.global.edition "enterprise") }} + INITIAL_USER_FIRST_NAME: {{ .Values.global.auth.instanceAdmin.firstName }} + INITIAL_USER_LAST_NAME: {{ .Values.global.auth.instanceAdmin.lastName }} + {{- if .Values.global.auth.identityProvider }} + IDENTITY_PROVIDER_TYPE: {{ .Values.global.auth.identityProvider.type }} + OIDC_DOMAIN: {{ .Values.global.auth.identityProvider.oidc.domain }} + OIDC_APP_NAME: {{ .Values.global.auth.identityProvider.oidc.appName }} + {{- end }} + KEYCLOAK_INTERNAL_HOST: {{ .Release.Name }}-airbyte-keycloak-svc:{{ .Values.keycloak.service.port }} + KEYCLOAK_PORT: {{ .Values.keycloak.service.port | quote }} + + {{- if $airbyteYmlDict }} + KEYCLOAK_HOSTNAME_URL: {{ printf "%s/auth" (index $airbyteYmlDict "webapp-url") | quote }} + {{- else }} + KEYCLOAK_HOSTNAME_URL: {{ printf "%s/auth" .Values.global.airbyteUrl | quote }} + {{- end }} + + KEYCLOAK_JAVA_OPTS_APPEND: -Djgroups.dns.query={{ .Release.Name }}-airbyte-keycloak-headless-svc + {{- else }} + KEYCLOAK_INTERNAL_HOST: localhost # just a placeholder so that nginx template is valid - shouldn't be used when edition isn't "pro" + {{- end }} + + CONNECTOR_BUILDER_API_HOST: {{ .Release.Name }}-airbyte-connector-builder-server-svc:{{ index .Values "connector-builder-server" "service" "port" }} + + {{- if or (eq .Values.global.edition "pro") (eq .Values.global.edition "enterprise") }} + {{- if $airbyteYmlDict }} + AIRBYTE_API_HOST: {{ printf "%s/api/public" (index $airbyteYmlDict "webapp-url") | quote }} + {{- else }} + AIRBYTE_API_HOST: {{ printf "%s/api/public" .Values.global.airbyteUrl | quote }} + {{- end }} + {{- else if (eq .Values.global.edition "community")}} + AIRBYTE_API_HOST: http://localhost:{{ .Values.server.service.port }}/api/public + {{- else }} + AIRBYTE_API_HOST: http://{{ .Release.Name }}-airbyte-server-svc:{{ .Values.server.service.port }}/api/public + {{- end }} + + {{- if $.Values.global.jobs.kube.annotations }} + JOB_KUBE_ANNOTATIONS: {{ $.Values.global.jobs.kube.annotations | include "airbyte.flattenMap" | quote }} + {{- end }} + + {{- if $.Values.global.jobs.kube.labels }} + JOB_KUBE_LABELS: {{ $.Values.global.jobs.kube.labels | include "airbyte.flattenMap" | quote }} + {{- end }} + + {{- if $.Values.global.jobs.kube.nodeSelector }} + JOB_KUBE_NODE_SELECTORS: {{ $.Values.global.jobs.kube.nodeSelector | include "airbyte.flattenMap" | quote }} + {{- end }} + + {{- if $.Values.global.jobs.kube.tolerations }} + JOB_KUBE_TOLERATIONS: {{ $.Values.global.jobs.kube.tolerations | include "airbyte.flattenArrayMap" | quote }} + {{- end }} + + JOB_KUBE_BUSYBOX_IMAGE: {{ include "imageUrl" (list $.Values.global.jobs.kube.images.busybox $) }} + JOB_KUBE_CURL_IMAGE: {{ include "imageUrl" (list $.Values.global.jobs.kube.images.curl $) }} + {{ $workloadLauncher := (index .Values "workload-launcher") }} + CONTAINER_ORCHESTRATOR_IMAGE: {{ include "imageUrl" (list $workloadLauncher.containerOrchestrator.image $) }} + WORKLOAD_INIT_IMAGE: {{ include "imageUrl" (list $workloadLauncher.workloadInit.image $) }} + CONNECTOR_SIDECAR_IMAGE: {{ include "imageUrl" (list $workloadLauncher.connectorSidecar.image $) }} + + JOB_MAIN_CONTAINER_CPU_LIMIT: {{ ((.Values.global.jobs.resources | default dict).limits | default dict).cpu | default "" | quote }} + JOB_MAIN_CONTAINER_CPU_REQUEST: {{ ((.Values.global.jobs.resources | default dict).requests | default dict).cpu | default "" | quote }} + JOB_MAIN_CONTAINER_MEMORY_LIMIT: {{ ((.Values.global.jobs.resources | default dict).limits | default dict).memory | default "" | quote }} + JOB_MAIN_CONTAINER_MEMORY_REQUEST: {{ ((.Values.global.jobs.resources | default dict).requests | default dict).memory | default "" | quote }} + + {{- if $.Values.global.jobs.kube.main_container_image_pull_secret }} + JOB_KUBE_MAIN_CONTAINER_IMAGE_PULL_SECRET: {{ $.Values.global.jobs.kube.main_container_image_pull_secret }} + {{- end }} + JOBS_DATABASE_MINIMUM_FLYWAY_MIGRATION_VERSION: "0.29.15.001" + + JOB_KUBE_LOCAL_VOLUME_ENABLED: {{ .Values.global.jobs.local.volume.enabled | quote }} + + LOG_LEVEL: {{ default "INFO" (((.Values.global).logging).level) }} + MICROMETER_METRICS_ENABLED: "false" + MICROMETER_METRICS_STATSD_FLAVOR: "datadog" + RUN_DATABASE_MIGRATION_ON_STARTUP: {{ index .Values "airbyte-bootloader" "runDatabaseMigrationsOnStartup" | default "true" | quote }} + SEGMENT_WRITE_KEY: 7UDdp5K55CyiGgsauOr2pNNujGvmhaeu + # Storage start + STORAGE_TYPE: {{ (((.Values.global).storage).type) | default "minio" | quote }} + STORAGE_BUCKET_ACTIVITY_PAYLOAD: {{ ((((.Values.global).storage).bucket).activityPayload) | default "airbyte-storage" | quote }} + STORAGE_BUCKET_LOG: {{ ((((.Values.global).storage).bucket).log) | default "airbyte-storage" | quote }} + STORAGE_BUCKET_STATE: {{ ((((.Values.global).storage).bucket).state) | default "airbyte-storage" | quote }} + STORAGE_BUCKET_WORKLOAD_OUTPUT: {{ ((((.Values.global).storage).bucket).workloadOutput) | default "airbyte-storage" | quote }} + + {{- with .Values.global.storage.s3 }} + AWS_DEFAULT_REGION: {{ .region | default "" | quote }} + {{- end}} + + MINIO_ENDPOINT: {{ include "airbyte.storage.minio.endpoint" . | quote }} + S3_PATH_STYLE_ACCESS: {{ include "airbyte.s3PathStyleAccess" . | quote }} + # Storage end + STATSD_HOST: "localhost" + STATSD_PORT: "8125" + TEMPORAL_HOST: {{ .Release.Name }}-temporal:{{ .Values.temporal.service.port }} + TEMPORAL_WORKER_PORTS: 9001,9002,9003,9004,9005,9006,9007,9008,9009,9010,9011,9012,9013,9014,9015,9016,9017,9018,9019,9020,9021,9022,9023,9024,9025,9026,9027,9028,9029,9030,9031,9032,9033,9034,9035,9036,9037,9038,9039,9040 + TRACKING_STRATEGY: segment + WEBAPP_URL: {{ .Values.webapp.url | default (printf "http://%s-airbyte-webapp-svc:%d" .Release.Name (.Values.webapp.service.port | int)) }} + WORKER_ENVIRONMENT: kubernetes + WORKSPACE_DOCKER_MOUNT: airbyte_workspace + WORKSPACE_ROOT: /workspace + METRIC_CLIENT: {{ .Values.global.metrics.metricClient | default "" | quote }} + OTEL_COLLECTOR_ENDPOINT: {{ .Values.global.metrics.otelCollectorEndpoint | default "" | quote }} + ACTIVITY_MAX_ATTEMPT: {{ .Values.worker.activityMaxAttempt | default "" | quote }} + ACTIVITY_INITIAL_DELAY_BETWEEN_ATTEMPTS_SECONDS: {{ .Values.worker.activityInitialDelayBetweenAttemptsSeconds | default "" | quote }} + ACTIVITY_MAX_DELAY_BETWEEN_ATTEMPTS_SECONDS: {{ .Values.worker.activityMaxDelayBetweenAttemptsSeconds | default "" | quote }} + WORKFLOW_FAILURE_RESTART_DELAY_SECONDS: "" + FILE_TRANSFER_EPHEMERAL_STORAGE_LIMIT: 5G + FILE_TRANSFER_EPHEMERAL_STORAGE_REQUEST: 5G + + LAUNCHER_MICRONAUT_ENVIRONMENTS: "control-plane,oss" + WORKERS_MICRONAUT_ENVIRONMENTS: "control-plane" + CRON_MICRONAUT_ENVIRONMENTS: "control-plane" + SERVER_MICRONAUT_ENVIRONMENTS: "control-plane" + SHOULD_RUN_NOTIFY_WORKFLOWS: "true" + MAX_NOTIFY_WORKERS: {{ .Values.worker.maxNotifyWorkers | default "5" | quote }} + KUBERNETES_CLIENT_MAX_IDLE_CONNECTIONS: "" + WORKLOAD_LAUNCHER_PARALLELISM: "10" + CONNECTOR_BUILDER_SERVER_API_HOST: http://{{ .Release.Name }}-airbyte-connector-builder-server-svc:{{ index .Values "connector-builder-server" "service" "port" }} + PUB_SUB_ENABLED: "false" + PUB_SUB_TOPIC_NAME: "" + ENTERPRISE_SOURCE_STUBS_URL: {{ .Values.server.env_vars.ENTERPRISE_SOURCE_STUBS_URL | default "https://connectors.airbyte.com/files/resources/connector_stubs/v0/connector_stubs.json" }} diff --git a/helm/airbyte-v1/templates/gcs-log-creds-secret.yaml b/helm/airbyte-v1/templates/gcs-log-creds-secret.yaml new file mode 100644 index 00000000..acdc1f93 --- /dev/null +++ b/helm/airbyte-v1/templates/gcs-log-creds-secret.yaml @@ -0,0 +1,18 @@ +{{- if and + (eq .Values.global.deploymentMode "oss") + (eq (lower (default "" .Values.global.storage.type)) "gcs") + (not .Values.global.storage.secretName) + (not .Values.global.storage.storageSecretName) +}} +{{ $gcsConfig := required "You must set 'global.storage.gcs' when setting 'global.storage.type' to 'gcs'" .Values.global.storage.gcs }} +{{ $credentialsJson := required "You must set 'global.storage.gcs.credentialsJson' when 'global.storage.secretName' is not set" .Values.global.storage.gcs.credentialsJson }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Release.Name }}-gcs-log-creds + labels: + {{- include "airbyte.labels" . | nindent 4 }} +type: Opaque +data: + gcp.json: {{ $credentialsJson | default "" | quote }} +{{- end }} diff --git a/helm/airbyte-v1/templates/minio.yaml b/helm/airbyte-v1/templates/minio.yaml new file mode 100644 index 00000000..4c6bd8cb --- /dev/null +++ b/helm/airbyte-v1/templates/minio.yaml @@ -0,0 +1,185 @@ +{{- if (eq (lower (default "" .Values.global.storage.type)) "minio")}} +apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1 +kind: StatefulSet +metadata: + # This name uniquely identifies the Deployment + name: airbyte-minio + annotations: + helm.sh/hook: pre-install + helm.sh/hook-weight: "-1" + labels: + {{ include "airbyte.minioLabels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{ include "airbyte.minioSelectorLabels" . | nindent 6 }} + serviceName: airbyte-minio-svc + volumeClaimTemplates: + - metadata: + name: airbyte-minio-pv-claim + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: {{ .Values.minio.storage.volumeClaimValue }} + template: + metadata: + labels: + # Label is used as selector in the service. + {{ include "airbyte.minioSelectorLabels" . | nindent 8 }} + spec: + # Refer to the PVC created earlier + securityContext: + fsGroup: 1000 + containers: + - name: airbyte-minio + image: {{ include "imageUrl" (list .Values.minio.image $) }} + args: + - server + - /storage + env: + # Minio access key and secret key. This must match the S3_ACCESS_KEY_ID and S3_SECRET_ACCESS_KEY declared in /dev/.env. + - name: MINIO_ROOT_USER + valueFrom: + secretKeyRef: + name: {{ .Release.Name }}-airbyte-secrets + key: MINIO_ACCESS_KEY_ID + - name: MINIO_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Release.Name }}-airbyte-secrets + key: MINIO_SECRET_ACCESS_KEY + ports: + - containerPort: 9000 + resources: + requests: + memory: {{ .Values.minio.resources.requests.memory }} + cpu: {{ .Values.minio.resources.requests.cpu }} + limits: + memory: {{ .Values.minio.resources.limits.memory }} + cpu: {{ .Values.minio.resources.limits.cpu }} + # Mount the volume into the pod + securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + # uid=1000(airbyte) + runAsUser: 1000 + # gid=1000(airbyte) + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + volumeMounts: + - name: airbyte-minio-pv-claim # must match the volume name, above + mountPath: "/storage" + {{- with .Values.minio.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.minio.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.minio.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + +--- +apiVersion: v1 +kind: Service +metadata: + name: airbyte-minio-svc + labels: + {{ include "airbyte.minioLabels" . | nindent 4 }} + annotations: + helm.sh/hook: pre-install + helm.sh/hook-weight: "-1" +spec: + ports: + - port: 9000 + targetPort: 9000 + protocol: TCP + selector: + {{ include "airbyte.minioSelectorLabels" . | nindent 4 }} +--- +# This pod creates the state-storage bucket in the minio server, +# which the local cloud deployment requires to store its state. +apiVersion: v1 +kind: Pod +metadata: + name: airbyte-minio-create-bucket + annotations: + "helm.sh/hook": post-install, post-upgrade + "helm.sh/hook-delete-policy": hook-succeeded, before-hook-creation +spec: + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + restartPolicy: OnFailure + securityContext: + fsGroup: 1000 + containers: + - name: minio-mc + image: {{ include "imageUrl" (list .Values.minio.mcImage $) }} + command: ["/bin/sh", "-c", + "until (/usr/bin/mc config host add myminio $MINIO_ENDPOINT $MINIO_ACCESS_KEY $MINIO_SECRET_KEY) do echo '...waiting...' && sleep 1; done; + /usr/bin/mc mb --ignore-existing myminio/state-storage; + /usr/bin/mc policy set public myminio/state-storage; + /usr/bin/mc mb --ignore-existing myminio/airbyte-dev-logs; + /usr/bin/mc policy set public myminio/airbyte-dev-logs;"] + securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + # uid=1000(airbyte) + runAsUser: 1000 + # gid=1000(airbyte) + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + env: + {{- if and (eq (lower (default "" .Values.global.storage.type)) "minio") (((.Values.global).storage).minio) }} + - name: MINIO_ACCESS_KEY + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.storage.storageSecretName }} + key: {{ include "airbyte.minioAccessKeyIdSecretKey" .Values.global.storage.minio.accessKeyIdSecretKey }} + - name: MINIO_SECRET_KEY + valueFrom: + secretKeyRef: + name: {{ include "airbyte.secretStoreName" .Values.global.storage.storageSecretName }} + key: {{ include "airbyte.minioSecretAccessKeySecretKey" .Values.global.storage.minio.secretAccessKeySecretKey }} + {{- else }} + # this is for the internally deployed minio + - name: MINIO_ACCESS_KEY + valueFrom: + secretKeyRef: + name: {{ .Release.Name }}-airbyte-secrets + key: MINIO_ACCESS_KEY_ID + - name: MINIO_SECRET_KEY + valueFrom: + secretKeyRef: + name: {{ .Release.Name }}-airbyte-secrets + key: MINIO_SECRET_ACCESS_KEY + {{- end }} + - name: MINIO_ENDPOINT + valueFrom: + configMapKeyRef: + name: {{ .Release.Name }}-airbyte-env + key: MINIO_ENDPOINT +{{- end }} diff --git a/helm/airbyte-v1/templates/secret.yaml b/helm/airbyte-v1/templates/secret.yaml new file mode 100644 index 00000000..7d4230d0 --- /dev/null +++ b/helm/airbyte-v1/templates/secret.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Release.Name }}-airbyte-secrets + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-1" + labels: + {{- include "airbyte.labels" . | nindent 4 }} +type: Opaque +stringData: + {{- include "airbyte.database.secrets" . | nindent 2 }} + {{- include "airbyte.storage.secrets" . | nindent 2 }} + {{- if or (eq .Values.global.edition "pro") (eq .Values.global.edition "enterprise") }} + KEYCLOAK_ADMIN_USER: {{ .Values.keycloak.auth.adminUsername | quote }} + KEYCLOAK_ADMIN_PASSWORD: {{ .Values.keycloak.auth.adminPassword | quote }} + {{- end }} + WORKLOAD_API_BEARER_TOKEN: {{ index ".Values.workload-api.bearerToken" | quote }} diff --git a/helm/airbyte-v1/templates/serviceaccount.yaml b/helm/airbyte-v1/templates/serviceaccount.yaml new file mode 100644 index 00000000..7f7acd85 --- /dev/null +++ b/helm/airbyte-v1/templates/serviceaccount.yaml @@ -0,0 +1,77 @@ +{{- if eq .Values.global.deploymentMode "oss" }} +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "airbyte.serviceAccountName" . }} + labels: + {{- include "airbyte.labels" . | nindent 4 }} + annotations: + helm.sh/hook: pre-install + helm.sh/hook-weight: "-10" + {{- with .Values.serviceAccount.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ include "airbyte.serviceAccountName" . }}-role + labels: + {{- include "airbyte.labels" . | nindent 4 }} + annotations: + helm.sh/hook: pre-install + helm.sh/hook-weight: "-5" +rules: + - apiGroups: ["*"] +{{- if eq .Values.global.edition "community" }} + resources: ["jobs", "pods", "pods/log", "pods/exec", "pods/attach", "secrets"] +{{- else }} + resources: ["jobs", "pods", "pods/log", "pods/exec", "pods/attach"] +{{- end }} + verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] # over-permission for now +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ include "airbyte.serviceAccountName" . }}-binding + labels: + {{- include "airbyte.labels" . | nindent 4 }} + annotations: + helm.sh/hook: pre-install + helm.sh/hook-weight: "-3" +roleRef: + apiGroup: "" + kind: Role + name: {{ include "airbyte.serviceAccountName" . }}-role +subjects: + - kind: ServiceAccount + name: {{ include "airbyte.serviceAccountName" . }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + {{- include "airbyte.labels" . | nindent 4 }} + name: node-viewer +rules: + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + {{- include "airbyte.labels" . | nindent 4 }} + name: {{ include "airbyte.serviceAccountName" . }}-admin-node-viewer +subjects: + - kind: ServiceAccount + name: {{ include "airbyte.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: node-viewer + apiGroup: rbac.authorization.k8s.io +{{- end }} +{{- end }} diff --git a/helm/airbyte-v1/templates/tests/test-webapp.yaml b/helm/airbyte-v1/templates/tests/test-webapp.yaml new file mode 100644 index 00000000..8b33ae24 --- /dev/null +++ b/helm/airbyte-v1/templates/tests/test-webapp.yaml @@ -0,0 +1,29 @@ +--- +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "common.names.fullname" . }}-test-connection" + labels: + {{- include "airbyte.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range .Values.global.imagePullSecrets }} + {{- printf "- name: %s" .name | nindent 8 }} + {{- end }} + {{- end }} + containers: + - name: wget + image: {{ include "imageUrl" (list .Values.testWebapp.image $) }} + command: ['wget'] + args: ['{{ .Release.Name }}-airbyte-webapp-svc:{{ .Values.webapp.service.port }}'] + resources: + requests: + memory: "64Mi" + cpu: "100m" + limits: + memory: "128Mi" + cpu: "200m" + restartPolicy: Never diff --git a/helm/airbyte-v1/values.yaml b/helm/airbyte-v1/values.yaml new file mode 100644 index 00000000..36376a5a --- /dev/null +++ b/helm/airbyte-v1/values.yaml @@ -0,0 +1,2414 @@ +### Airbyte V1 Helm Chart + + +# Global params that are overwritten with umbrella chart +global: + # -- Service Account name override + serviceAccountName: &service-account-name "airbyte-admin" + # -- Deployment mode, whether or not render the default env vars and volumes in deployment spec + deploymentMode: "oss" + # -- Edition; "community" or "pro" + edition: "community" + + # --AWS keys + aws_access_key: "" + aws_secret_key: "" + # -- Blotout required configuration + resource_cpu_limit: "6" + resource_cpu_request: "0.5" + resource_memory_limit: "9Gi" + resource_memory_request: "1Gi" + + # -- Airbyte configuration + airbyteYml: "" + + enterprise: + # -- Secret name where an Airbyte license key is stored + secretName: "airbyte-v1-airbyte-secrets" + # -- The key within `licenseKeySecretName` where the Airbyte license key is stored + licenseKeySecretKey: "license-key" + + # -- The URL where Airbyte will be reached; This should match your Ingress host + airbyteUrl: "" + + # Docker image config that will apply to all images. + image: + # Docker registry to pull platform images from, e.g. http://my-registry:8000/ + registry: "" + # Image tag to use for airbyte images. + # Does not include non-airbyte images such as busybox, temporal, minio, etc. + tag: "1.3.0" + + # Docker image pull secret + imagePullSecrets: + - name: regcred + + # -- Auth configuration + auth: + # -- Whether auth is enabled + enabled: true + # -- Admin user configuration + instanceAdmin: + # -- Secret name where the instanceAdmin configuration is stored + secretName: "airbyte-v1-airbyte-secrets" + # -- The first name of the initial user + firstName: "" + # -- The last name of the initial user + lastName: "" + # -- The key within `emailSecretName` where the initial user's email is stored + emailSecretKey: "instance-admin-email" + # -- The key within `passwordSecretName` where the initial user's password is stored + passwordSecretKey: "instance-admin-password" + + # -- SSO Identify Provider configuration; (requires Enterprise) + #identityProvider: + # # -- Secret name where the OIDC configuration is stored + # secretName: "airbyte-v1-airbyte-secrets" + # # -- The identity provider type (e.g. oidc) + # type: "" + # # -- OIDC configuration (required if `auth.identityProvider.type` is "oidc") + # oidc: + # # -- OIDC application domain + # domain: "" + # # -- OIDC application name + # appName: "" + # # -- The key within `clientIdSecretName` where the OIDC client id is stored + # clientIdSecretKey: "client-id" + # # -- The key within `clientSecretSecretName` where the OIDC client secret is stored + # clientSecretSecretKey: "client-secret" + + # -- Environment variables + env_vars: {} + + # -- Database configuration + database: + type: "external" # "external" + + # -- Secret name where database credentials are stored + secretName: "airbyte-v1-airbyte-secrets" + + # -- The database host + host: "airbyte-host" + + # -- The database port + port: "3306" + + # -- The database name + database: "airbyte-v1" + + # -- The database user + user: "rds_admin" + # -- The key within `secretName` where the user is stored + #userSecretKey: "" # e.g. "database-user" + + # -- The database password + password: "pwd" + # -- The key within `secretName` where the password is stored + #passwordSecretKey: "" # e.g."database-password" + + + + storage: + # -- The storage backend type. Supports s3, gcs, azure, minio (default) + type: s3 # default storage used + # -- Secret name where storage provider credentials are stored + storageSecretName: "airbyte-v1-airbyte-secrets" + + # S3 + bucket: ## S3 bucket names that you've created. We recommend storing the following all in one bucket. + log: b-multitenantdev-dev-airbyte-v1-logs + state: b-multitenantdev-dev-airbyte-v1-logs + workloadOutput: b-multitenantdev-dev-airbyte-v1-logs + s3: + region: "us-east-1" ## e.g. us-east-1 + authenticationType: credentials ## Use "credentials" or "instanceProfile" + accessKeyId: "" + secretAccessKey: "" + + + # GCS + #bucket: ## GCS bucket names that you've created. We recommend storing the following all in one bucket. + # log: airbyte-bucket + # state: airbyte-bucket + # workloadOutput: airbyte-bucket + #gcs: + # projectId: + # credentialsJson: /secrets/gcs-log-creds/gcp.json + + # Azure + #bucket: ## Azure Blob Storage container names that you've created. We recommend storing the following all in one bucket. + # log: airbyte-bucket + # state: airbyte-bucket + # workloadOutput: airbyte-bucket + #azure: + # # one of the following: connectionString, connectionStringSecretKey + # connectionString: + # connectionStringSecretKey: + + metrics: + # -- The metric client to configure globally. Supports "otel" + metricClient: "" + # -- The open-telemetry-collector endpoint that metrics will be sent to + otelCollectorEndpoint: "" + + # Jobs resource requests and limits, see http://kubernetes.io/docs/user-guide/compute-resources/ + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. + jobs: + resources: + ## Example: + ## requests: + ## memory: 256Mi + ## cpu: 250m + # -- Job resource requests + requests: {} + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + # -- Job resource limits + limits: {} + + local: + volume: + enabled: false + + kube: + ## JOB_KUBE_ANNOTATIONS + # pod annotations of the sync job and the default pod annotations fallback for others jobs + # -- key/value annotations applied to kube jobs + annotations: {} + + ## JOB_KUBE_LABELS + ## pod labels of the sync job and the default pod labels fallback for others jobs + # -- key/value labels applied to kube jobs + labels: {} + + ## JOB_KUBE_NODE_SELECTORS + ## pod node selector of the sync job and the default pod node selector fallback for others jobs + # -- Node labels for pod assignment + nodeSelector: {} + + ## JOB_KUBE_TOLERATIONS + # -- Node tolerations for pod assignment + # Any boolean values should be quoted to ensure the value is passed through as a string. + tolerations: [] + + ## JOB_KUBE_MAIN_CONTAINER_IMAGE_PULL_SECRET + # -- image pull secret to use for job pod + main_container_image_pull_secret: "" + + images: + ## JOB_KUBE_BUSYBOX_IMAGE + # -- busybox image used by the job pod + busybox: "busybox:1.35" + ## JOB_KUBE_CURL_IMAGE + # -- curl image used by the job pod + curl: "curlimages/curl:8.1.1" + +## @section Common Parameters + +# -- String to partially override airbyte.fullname template with a string (will prepend the release name) +nameOverride: "" +# -- String to fully override airbyte.fullname template with a string +fullnameOverride: "" + +# Pods Service Account, see https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ +serviceAccount: + # -- Specifies whether a ServiceAccount should be created + create: true + # -- Annotations for service account. Evaluated as a template. Only used if `create` is `true`. + annotations: {} + # -- Name of the service account to use. If not set and create is true, a name is generated using the fullname template. + name: *service-account-name + +# -- Sets the AIRBYTE_VERSION environment variable. Defaults to Chart.AppVersion. +## If changing the image tags below, you should probably also update this. +version: "" + +## @section Webapp Parameters + +webapp: + enabled: true + # -- Number of webapp replicas + replicaCount: 1 + + ## webapp.image.repository + ## webapp.image.pullPolicy + ## webapp.image.tag The airbyte webapp image tag. Defaults to the chart's AppVersion + image: + # -- The repository to use for the airbyte webapp image + repository: airbyte/webapp + # -- The pull policy to use for the airbyte webapp image + pullPolicy: IfNotPresent + + # -- Add extra annotations to the webapp pods + podAnnotations: {} + + # -- webapp.podLabels [object] Add extra labels to the webapp pods + podLabels: {} + + # -- Security context for the container + podSecurityContext: + fsGroup: 1000 + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + runAsUser: 1000 + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + ## Configure extra options for the webapp containers' liveness and readiness probes, + ## see https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes + livenessProbe: + # -- Enable livenessProbe on the webapp + enabled: true + # -- Initial delay seconds for livenessProbe + initialDelaySeconds: 30 + # -- Period seconds for livenessProbe + periodSeconds: 10 + # -- Timeout seconds for livenessProbe + timeoutSeconds: 1 + # -- Failure threshold for livenessProbe + failureThreshold: 3 + # -- Success threshold for livenessProbe + successThreshold: 1 + + readinessProbe: + # -- Enable readinessProbe on the webapp + enabled: true + # -- Initial delay seconds for readinessProbe + initialDelaySeconds: 10 + # -- Period seconds for readinessProbe + periodSeconds: 10 + # -- Timeout seconds for readinessProbe + timeoutSeconds: 1 + # -- Failure threshold for readinessProbe + failureThreshold: 3 + # -- Success threshold for readinessProbe + successThreshold: 1 + + service: + # -- The service type to use for the webapp service + type: ClusterIP + # -- The service port to expose the webapp on + port: 80 + # -- Annotations for the webapp service resource + annotations: {} + + ## Web app resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + # -- The resources limits for the Web container + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + # -- The requested resources for the Web container + requests: {} + + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for webapp pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # -- Affinity and anti-affinity for webapp pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + + ## Configure the ingress resource that allows you to access the Airbyte installation. + ## ref: http://kubernetes.io/docs/user-guide/ingress/ + ingress: + # -- Set to true to enable ingress record generation + enabled: true + # -- Specifies ingressClassName for clusters >= 1.18+ + className: "nginx" + # -- Ingress annotations done as key:value pairs + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # -- The list of hostnames to be covered with this ingress record. + hosts: + - host: + paths: + - path: / + pathType: ImplementationSpecific + # -- Custom ingress TLS configuration + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + + api: + # -- The webapp API url + url: /api/v1/ + + connector-builder-server: + url: /connector-builder-api + + fullstory: + # -- Whether or not to enable fullstory + enabled: false + + ## Examples (when using `webapp.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumeMounts: + ## - name: var-run + ## mountPath: /var/run/ + ## - name: var-cache-nginx + ## mountPath: /var/cache/nginx + ## - mountPath: /etc/nginx/conf.d + ## name: nginx-conf-d + ## + # -- Additional volumeMounts for webapp containers + extraVolumeMounts: [] + + ## Examples (when using `webapp.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumes: + ## - name: var-run + ## emptyDir: {} + ## - name: var-cache-nginx + ## emptyDir: {} + ## - name: nginx-conf-d + ## emptyDir: {} + # -- Additional volumes for webapp pods + extraVolumes: [] + + ## Example: + # extraContainers: + # - name: otel_collector + # image: somerepo/someimage:sometag + # args: [ + # "--important-args" + # ] + # ports: + # - containerPort: 443 + # volumeMounts: + # - name: volumeMountCool + # mountPath: /some/path + # readOnly: true + # -- Additional container for server pods + extraContainers: [] + + ## Example: + # extraInitContainers: + # - name: sleepy + # image: alpine + # command: ['sleep', '60'] + # -- Additional init containers for server pods + extraInitContainers: [] + + ## Example: (With default env vars and values taken from generated config map) + # extraEnv: + # - name: POSTGRES_USER + # valueFrom: + # secretKeyRef: + # name: airbyte-secrets + # key: DATABASE_USER + # - name: POSTGRES_PWD + # valueFrom: + # secretKeyRef: + # name: airbyte-secrets + # key: DATABASE_PASSWORD + # - name: DYNAMIC_CONFIG_FILE_PATH + # value: "config/dynamicconfig/development.yaml" + # - name: DB + # value: "postgresql" + # - name: DB_PORT + # valueFrom: + # configMapKeyRef: + # name: airbyte-env + # key: DATABASE_PORT + # - name: POSTGRES_SEEDS + # valueFrom: + # configMapKeyRef: + # name: airbyte-env + # key: DATABASE_HOST + # -- Supply extra env variables to main container using full notation + extraEnv: [] + ## Example: + ## secrets: + ## DATABASE_PASSWORD: strong-password + ## DATABASE_USER: my-db-user + # -- Supply additional secrets to container + secrets: {} + + ## Example: + ## env_vars: + ## DATABASE_HOST: airbyte-db + ## DATABASE_PORT: 5432 + # -- Supply extra env variables to main container using simplified notation + env_vars: {} + +## @section Pod Sweeper parameters + +pod-sweeper: + enabled: true + image: + # -- The image repository to use for the pod sweeper + repository: bitnami/kubectl + # -- The pull policy for the pod sweeper image + pullPolicy: IfNotPresent + # -- The pod sweeper image tag to use + tag: 1.28.9 + + # -- Add extra annotations to the podSweeper pod + podAnnotations: {} + + # -- Add extra labels to the podSweeper pod + podLabels: {} + + # -- Security context for the container + podSecurityContext: + fsGroup: 1000 + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + runAsUser: 1000 + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + livenessProbe: + # -- Enable livenessProbe on the podSweeper + enabled: true + # -- Initial delay seconds for livenessProbe + initialDelaySeconds: 5 + # -- Period seconds for livenessProbe + periodSeconds: 30 + # -- Timeout seconds for livenessProbe + timeoutSeconds: 1 + # -- Failure threshold for livenessProbe + failureThreshold: 3 + # -- Success threshold for livenessProbe + successThreshold: 1 + + readinessProbe: + # -- Enable readinessProbe on the podSweeper + enabled: true + # -- Initial delay seconds for readinessProbe + initialDelaySeconds: 5 + # -- Period seconds for readinessProbe + periodSeconds: 30 + # -- Timeout seconds for readinessProbe + timeoutSeconds: 1 + # -- Failure threshold for readinessProbe + failureThreshold: 3 + # -- Success threshold for readinessProbe + successThreshold: 1 + + ## Pod Sweeper app resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + # -- The resources limits for the podSweeper container + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + # -- The requested resources for the podSweeper container + requests: {} + + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # -- Affinity and anti-affinity for pod assignment, see https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + + ## Examples: + ## extraVolumeMounts: + ## - name: tmpdir + ## mountPath: /tmp + # -- Additional volumeMounts for podSweeper container(s). + extraVolumeMounts: [] + + ## Examples: + ## extraVolumes: + ## - name: tmpdir + ## emptyDir: {} + # -- Additional volumes for podSweeper pod(s). + extraVolumes: [] + +## @section Server parameters + +server: + enabled: true + # -- Number of server replicas + replicaCount: 1 + + image: + # -- The repository to use for the airbyte server image. + repository: airbyte/server + # -- the pull policy to use for the airbyte server image + pullPolicy: IfNotPresent + + # -- Add extra annotations to the server pods + podAnnotations: {} + + # -- Add extra labels to the server pods + podLabels: {} + + # -- Security context for the container + podSecurityContext: + # gid=1000(airbyte) + fsGroup: 1000 + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + # uid=1000(airbyte) + runAsUser: 1000 + # gid=1000(airbyte) + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + ## Configure extra options for the server containers' liveness and readiness probes + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes + livenessProbe: + # -- Enable livenessProbe on the server + enabled: true + # -- Initial delay seconds for livenessProbe + initialDelaySeconds: 30 + # -- Period seconds for livenessProbe + periodSeconds: 10 + # -- Timeout seconds for livenessProbe + timeoutSeconds: 10 + # -- Failure threshold for livenessProbe + failureThreshold: 3 + # -- Success threshold for livenessProbe + successThreshold: 1 + + readinessProbe: + # -- Enable readinessProbe on the server + enabled: true + # -- Initial delay seconds for readinessProbe + initialDelaySeconds: 10 + # -- Period seconds for readinessProbe + periodSeconds: 10 + # -- Timeout seconds for readinessProbe + timeoutSeconds: 10 + # -- Failure threshold for readinessProbe + failureThreshold: 3 + # -- Success threshold for readinessProbe + successThreshold: 1 + + ## server resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + # -- The resources limits for the server container + limits: + cpu: 2 + memory: 6Gi + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + # -- The requested resources for the workload launcher container + requests: + cpu: 400m + memory: 1Gi + + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for server pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # -- Affinity and anti-affinity for server pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + + log: + # -- The log level to log at + level: "INFO" + + ## Examples (when using `server.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumeMounts: + ## - name: tmpdir + ## mountPath: /tmp + # -- Additional volumeMounts for server containers + extraVolumeMounts: [] + + ## Examples (when using `server.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumes: + ## - name: tmpdir + ## emptyDir: {} + # -- Additional volumes for server pods + extraVolumes: [] + + ## Example: + # extraContainers: + # - name: otel_collector + # image: somerepo/someimage:sometag + # args: [ + # "--important-args" + # ] + # ports: + # - containerPort: 443 + # volumeMounts: + # - name: volumeMountCool + # mountPath: /some/path + # readOnly: true + # -- Additional container for server pods + extraContainers: [] + + ## Example: + # extraInitContainers: + # - name: sleepy + # image: alpine + # command: ['sleep', '60'] + # -- Additional init containers for server pods + extraInitContainers: [] + + ## Example: (With default env vars and values taken from generated config map) + # extraEnv: + # - name: AIRBYTE_VERSION + # valueFrom: + # configMapKeyRef: + # name: airbyte-env + # key: AIRBYTE_VERSION + # - name: API_URL + # valueFrom: + # configMapKeyRef: + # name: airbyte-env + # key: API_URL + # - name: TRACKING_STRATEGY + # valueFrom: + # configMapKeyRef: + # name: airbyte-env + # key: TRACKING_STRATEGY + # - name: FULLSTORY + # valueFrom: + # configMapKeyRef: + # name: airbyte-env + # key: FULLSTORY + # - name: INTERNAL_API_HOST + # valueFrom: + # configMapKeyRef: + # name: airbyte-env + # key: INTERNAL_API_HOST + ## + # -- Supply extra env variables to main container using full notation + extraEnv: [] + ## Example: + ## secrets: + ## DATABASE_PASSWORD: strong-password + ## DATABASE_USER: my-db-user + # -- Supply additional secrets to container + secrets: {} + ## Example: + ## env_vars: + ## DATABASE_HOST: airbyte-db + ## DATABASE_PORT: 5432 + # -- Supply extra env variables to main container using simplified notation + env_vars: + BLOTOUT_AUTH_ENDPOINT: "" + BLOTOUT_BASE_URL: "" + +## @section Worker Parameters + +worker: + enabled: true + # -- Number of worker replicas + replicaCount: 1 + + image: + # -- The repository to use for the airbyte worker image. + repository: airbyte/worker + # -- the pull policy to use for the airbyte worker image + pullPolicy: IfNotPresent + + # -- Add extra annotations to the worker pods + podAnnotations: {} + + # -- Add extra labels to the worker pods + podLabels: {} + + # -- Security context for the container + podSecurityContext: + # gid=1000(airbyte) + fsGroup: 1000 + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + # uid=1000(airbyte) + runAsUser: 1000 + # gid=1000(airbyte) + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + livenessProbe: + # -- Enable livenessProbe on the worker + enabled: true + # -- Initial delay seconds for livenessProbe + initialDelaySeconds: 30 + # -- Period seconds for livenessProbe + periodSeconds: 10 + # -- Timeout seconds for livenessProbe + timeoutSeconds: 1 + # -- Failure threshold for livenessProbe + failureThreshold: 3 + # -- Success threshold for livenessProbe + successThreshold: 1 + + readinessProbe: + # -- Enable readinessProbe on the worker + enabled: true + # -- Initial delay seconds for readinessProbe + initialDelaySeconds: 10 + # -- Period seconds for readinessProbe + periodSeconds: 10 + # -- Timeout seconds for readinessProbe + timeoutSeconds: 1 + # -- Failure threshold for readinessProbe + failureThreshold: 3 + # -- Success threshold for readinessProbe + successThreshold: 1 + + ## worker resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + #! -- The resources limits for the worker container + limits: + cpu: 2 + memory: 6Gi + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + # -- The requested resources for the workload launcher container + requests: + cpu: 400m + memory: 1Gi + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for worker pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # -- Affinity and anti-affinity for worker pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + + log: + #! -- The log level to log at. + level: "INFO" + + ## Example: + ## + ## extraEnv: + ## - name: JOB_KUBE_TOLERATIONS + ## value: "key=airbyte-server,operator=Equals,value=true,effect=NoSchedule" + # -- Additional env vars for worker pods + extraEnv: [] + + ## Examples (when using `worker.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumeMounts: + ## - name: tmpdir + ## mountPath: /tmp + # -- Additional volumeMounts for worker containers + extraVolumeMounts: [] + + ## Examples (when using `worker.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumes: + ## - name: tmpdir + ## emptyDir: {} + # -- Additional volumes for worker pods + extraVolumes: [] + # -- Additional container for worker pods + extraContainers: [] + + hpa: + enabled: false + + debug: + enabled: false + + ## current no exist documentations + activityMaxAttempt: "" + activityInitialDelayBetweenAttemptsSeconds: "" + activityMaxDelayBetweenAttemptsSeconds: "" + maxNotifyWorkers: 5 + +## @section Workload Launcher Parameters + +workload-launcher: + enabled: true + # -- Number of workload launcher replicas + replicaCount: 1 + + image: + # -- The repository to use for the airbyte workload launcher image. + repository: airbyte/workload-launcher + # -- The pull policy to use for the airbyte workload launcher image + pullPolicy: IfNotPresent + + # -- Add extra annotations to the workload launcher pods + podAnnotations: {} + + # -- Add extra labels to the workload launcher pods + podLabels: {} + + # -- Security context for the container + podSecurityContext: + # gid=1000(airbyte) + fsGroup: 1000 + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + # uid=1000(airbyte) + runAsUser: 1000 + # gid=1000(airbyte) + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + livenessProbe: + # -- Enable livenessProbe on the workload launcher + enabled: true + # -- Initial delay seconds for livenessProbe + initialDelaySeconds: 30 + # -- Period seconds for livenessProbe + periodSeconds: 10 + # -- Timeout seconds for livenessProbe + timeoutSeconds: 1 + # -- Failure threshold for livenessProbe + failureThreshold: 3 + # -- Success threshold for livenessProbe + successThreshold: 1 + + readinessProbe: + # -- Enable readinessProbe on the workload launcher + enabled: true + # -- Initial delay seconds for readinessProbe + initialDelaySeconds: 10 + # -- Period seconds for readinessProbe + periodSeconds: 10 + # -- Timeout seconds for readinessProbe + timeoutSeconds: 1 + # -- Failure threshold for readinessProbe + failureThreshold: 3 + # -- Success threshold for readinessProbe + successThreshold: 1 + + ## workload launcher resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + # -- The resources limits for the workload launcher container + limits: + cpu: 2 + memory: 6Gi + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + # -- The requested resources for the workload launcher container + requests: + cpu: 400m + memory: 1Gi + + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for workload launcher pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # Affinity and anti-affinity for workload launcher pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + + log: + # -- The log level to log at + level: "INFO" + + ## Example: + ## + ## extraEnv: + ## - name: JOB_KUBE_TOLERATIONS + ## value: "key=airbyte-server,operator=Equals,value=true,effect=NoSchedule" + # -- Additional env vars for workload launcher pods + extraEnv: [] + + ## Examples (when using `workload launcher.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumeMounts: + ## - name: tmpdir + ## mountPath: /tmp + # -- Additional volumeMounts for workload launcher containers + extraVolumeMounts: [] + + ## Examples (when using `workload-launcher.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumes: + ## - name: tmpdir + ## emptyDir: {} + # -- Additional volumes for workload launcher pods + extraVolumes: [] + + extraContainers: [] + + hpa: + enabled: false + + debug: + enabled: false + + containerOrchestrator: + # -- Enable or disable Orchestrator + enabled: true + # -- Orchestrator image + # This is a template string that will be passed to the "tpl" helper. + image: "airbyte/container-orchestrator:{{ default .Chart.AppVersion .Values.global.image.tag }}" + + connectorSidecar: + # -- Connector Sidecar image + # This is a template string that will be passed to the "tpl" helper. + image: "airbyte/connector-sidecar:{{ default .Chart.AppVersion .Values.global.image.tag }}" + + workloadInit: + # -- Workload init image + # This is a template string that will be passed to the "tpl" helper. + image: "airbyte/workload-init-container:{{ default .Chart.AppVersion .Values.global.image.tag }}" + + ## current no exist documentations + activityMaxAttempt: "" + activityInitialDelayBetweenAttemptsSeconds: "" + activityMaxDelayBetweenAttemptsSeconds: "" + + maxNotifyWorkers: 5 + +## @section Rollout Worker Parameters + +connector-rollout-worker: + enabled: false + # -- Number of connector rollout worker replicas + replicaCount: 1 + + image: + # -- The repository to use for the airbyte connector rollout worker image. + repository: airbyte/connector-rollout-worker + # -- The pull policy to use for the airbyte connector rollout worker image + pullPolicy: IfNotPresent + + # -- Add extra annotations to the connector rollout worker pods + podAnnotations: {} + + # -- Add extra labels to the connector rollout worker pods + podLabels: {} + + # -- Security context for the container + podSecurityContext: + # gid=1000(airbyte) + fsGroup: 1000 + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + # uid=1000(airbyte) + runAsUser: 1000 + # gid=1000(airbyte) + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + livenessProbe: + # -- Enable livenessProbe on the connector rollout worker + enabled: true + # -- Initial delay seconds for livenessProbe + initialDelaySeconds: 30 + # -- Period seconds for livenessProbe + periodSeconds: 10 + # -- Timeout seconds for livenessProbe + timeoutSeconds: 1 + # -- Failure threshold for livenessProbe + failureThreshold: 3 + # -- Success threshold for livenessProbe + successThreshold: 1 + + readinessProbe: + # -- Enable readinessProbe on the connector rollout worker + enabled: true + # -- Initial delay seconds for readinessProbe + initialDelaySeconds: 10 + # -- Period seconds for readinessProbe + periodSeconds: 10 + # -- Timeout seconds for readinessProbe + timeoutSeconds: 1 + # -- Failure threshold for readinessProbe + failureThreshold: 3 + # -- Success threshold for readinessProbe + successThreshold: 1 + + ## connector rollout worker resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + resources: + requests: + memory: 1Gi + cpu: 350m + limits: + cpu: 2 + memory: 6Gi + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + # -- The resources limits for the connector rollout worker container + # limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + # -- The requested resources for the connector rollout worker container + # requests: {} + + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for connector rollout worker pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # Affinity and anti-affinity for connector rollout worker pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + + log: + # -- The log level to log at + level: "INFO" + + ## Example: + ## + ## extraEnv: + ## - name: JOB_KUBE_TOLERATIONS + ## value: "key=airbyte-server,operator=Equals,value=true,effect=NoSchedule" + # -- Additional env vars for connector rollout worker pods + extraEnv: [] + + ## Examples (when using `connector rollout worker.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumeMounts: + ## - name: tmpdir + ## mountPath: /tmp + # -- Additional volumeMounts for connector rollout worker containers + extraVolumeMounts: [] + + ## Examples (when using `connector-rollout-worker.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumes: + ## - name: tmpdir + ## emptyDir: {} + # -- Additional volumes for connector rollout worker pods + extraVolumes: [] + + extraContainers: [] + + hpa: + enabled: false + + debug: + enabled: false + + containerOrchestrator: + # -- Enable or disable Orchestrator + enabled: true + # -- Orchestrator image + image: "" + + ## current no exist documentations + activityMaxAttempt: "" + activityInitialDelayBetweenAttemptsSeconds: "" + activityMaxDelayBetweenAttemptsSeconds: "" + + maxNotifyWorkers: 5 + +## @section Metrics parameters +metrics: + enabled: false + + # -- Number of metrics-reporter replicas + replicaCount: 1 + + image: + # -- The repository to use for the airbyte metrics-reporter image. + repository: airbyte/metrics-reporter + # -- The pull policy to use for the airbyte metrics-reporter image + pullPolicy: IfNotPresent + + # -- Add extra annotations to the metrics-reporter pod + podAnnotations: {} + + # -- Add extra labels to the metrics-reporter pod + podLabels: {} + + # -- Security context for the container + podSecurityContext: + # gid=1000(airbyte) + fsGroup: 1000 + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + # uid=1000(airbyte) + runAsUser: 1000 + # gid=1000(airbyte) + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + ## metrics-reporter app resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + # -- The resources limits for the metrics-reporter container + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + # -- The requested resources for the metrics-reporter container + requests: {} + + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for metrics-reporter pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # -- Affinity and anti-affinity for metrics-reporter pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + + ## Example: + ## + ## extraEnv: + ## - name: SAMPLE_ENV_VAR + ## value: "key=sample-value" + # -- Additional env vars for metrics-reporter pods + extraEnv: [] + + ## Examples (when using `metrics.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumeMounts: + ## - name: tmpdir + ## mountPath: /tmp + # -- Additional volumeMounts for metrics-reporter containers + extraVolumeMounts: [] + + ## Examples (when using `metrics.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumes: + ## - name: tmpdir + ## emptyDir: {} + # -- Additional volumes for metrics-reporter pods + extraVolumes: [] + + extraContainers: [] + + secrets: {} + + env_vars: {} + +## @section Bootloader Parameters + +airbyte-bootloader: + enabled: true + image: + # -- The repository to use for the airbyte bootloader image. + repository: airbyte/bootloader + # -- The pull policy to use for the airbyte bootloader image + pullPolicy: IfNotPresent + + # -- Add extra annotations to the bootloader pod + podAnnotations: {} + + # -- Add extra labels to the bootloader pod + podLabels: {} + + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for worker pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + ## Bootloader resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + resources: + ## Example: + ## requests: + ## memory: 256Mi + ## cpu: 250m + # -- The requested resources for the airbyte bootloader image + requests: {} + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + # -- The resources limits for the airbyte bootloader image + limits: {} + + # -- Affinity and anti-affinity for bootloader pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + + # -- Security context for the container + podSecurityContext: + # gid=1000(airbyte) + fsGroup: 1000 + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + # uid=1000(airbyte) + runAsUser: 1000 + # gid=1000(airbyte) + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + ## Example: (With default env vars and values taken from generated config map) + ## extraEnv: + ## - name: AIRBYTE_VERSION + ## valueFrom: + ## configMapKeyRef: + ## name: airbyte-env + ## key: AIRBYTE_VERSION + ## - name: DATABASE_HOST + ## valueFrom: + ## configMapKeyRef: + ## name: airbyte-env + ## key: DATABASE_HOST + ## - name: DATABASE_PORT + ## valueFrom: + ## configMapKeyRef: + ## name: airbyte-env + ## key: DATABASE_PORT + ## - name: DATABASE_PASSWORD + ## valueFrom: + ## secretKeyRef: + ## name: airbyte-secrets + ## key: DATABASE_PASSWORD + ## - name: DATABASE_URL + ## valueFrom: + ## configMapKeyRef: + ## name: airbyte-env + ## key: DATABASE_URL + ## - name: DATABASE_USER + ## valueFrom: + ## secretKeyRef: + ## name: airbyte-secrets + ## key: DATABASE_USER + # -- Supply extra env variables to main container using full notation + extraEnv: [] + ## Example: + ## secrets: + ## DATABASE_PASSWORD: strong-password + ## DATABASE_USER: my-db-user + # -- Supply additional secrets to container + secrets: {} + + ## Example: + ## env_vars: + ## DATABASE_HOST: airbyte-db + ## DATABASE_PORT: 5432 + # -- Supply extra env variables to main container using simplified notation + env_vars: {} + ## Example: + # extraContainers: + # - name: otel_collector + # image: somerepo/someimage:sometag + # args: [ + # "--important-args" + # ] + # ports: + # - containerPort: 443 + # volumeMounts: + # - name: volumeMountCool + # mountPath: /some/path + # readOnly: true + # -- Additional container for server pod(s) + extraContainers: [] + + ## Example: + # extraInitContainers: + # - name: sleepy + # image: alpine + # command: ['sleep', '60'] + # -- Additional init containers for server pods + extraInitContainers: [] + + ## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumeMounts: + ## - name: tmpdir + ## mountPath: /tmp + # -- Additional volumeMounts for server containers + extraVolumeMounts: [] + + ## Examples (when using `containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumes: + ## - name: tmpdir + ## emptyDir: {} + # -- Additional volumes for server pods + extraVolumes: [] + +## @section Temporal parameters +## TODO: Move to consuming temporal from a dedicated helm chart + +temporal: + enabled: true + # -- The number of temporal replicas to deploy + replicaCount: 1 + + image: + # -- The temporal image repository to use + repository: temporalio/auto-setup + # -- The pull policy for the temporal image + pullPolicy: IfNotPresent + # -- The temporal image tag to use + tag: "1.23.0" + + service: + # -- The Kubernetes Service Type + type: ClusterIP + # -- The temporal port and exposed kubernetes port + port: 7233 + + # -- Add extra annotations to the temporal pod + podAnnotations: {} + + # -- Add extra labels to the temporal pod + podLabels: {} + + # -- Security context for the container + podSecurityContext: + # gid=1000(temporal) + fsGroup: 1000 + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + # uid=1000(temporal) + runAsUser: 1000 + # gid=1000(temporal) + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + ## Examples (when using `temporal.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraInitContainers: + ## - name: config-loader + ## image: temporalio/auto-setup:1.23 + ## command: + ## - /bin/sh + ## - -c + ## - >- + ## find /etc/temporal/config/ -maxdepth 1 -mindepth 1 -exec cp -ar {} /config/ \; + ## volumeMounts: + ## - name: config + ## mountPath: /config + # -- Additional InitContainers to initialize the pod + extraInitContainers: [] + + livenessProbe: + # -- Enable livenessProbe on the temporal + enabled: false + + readinessProbe: + # -- Enable readinessProbe on the temporal + enabled: false + + # -- Node labels for temporal pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for temporal pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # -- Affinity and anti-affinity for temporal pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + + ## Example: + ## + ## extraEnv: + ## - name: SAMPLE_ENV_VAR + ## value: "key=sample-value" + # -- Additional env vars for temporal pod(s). + extraEnv: [] + + ## Examples (when using `temporal.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumeMounts: + ## - name: tmpdir + ## mountPath: /tmp + ## - name: config + ## mountPath: /etc/temporal/config + # -- Additional volumeMounts for temporal containers + extraVolumeMounts: [] + + ## Examples (when using `temporal.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumes: + ## - name: tmpdir + ## emptyDir: {} + ## - name: config + ## emptyDir: {} + # -- Additional volumes for temporal pods + extraVolumes: [] + + ## Temporal resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + resources: + ## Example: + ## requests: + ## memory: 256Mi + ## cpu: 250m + # -- The requested resources for temporal pods + requests: {} + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + # -- The resources limits for temporal pods + limits: {} + + extraContainers: [] + +## @section Temporal parameters +## TODO: Move to consuming temporal from a dedicated helm chart + +temporal-ui: + enabled: false + # -- The number of temporal-ui replicas to deploy + replicaCount: 1 + + image: + # -- The temporal-ui image repository to use + repository: temporalio/ui + # -- The pull policy for the temporal-ui image + pullPolicy: IfNotPresent + tag: "2.30.1" + + service: + # -- The Kubernetes Service Type + type: ClusterIP + # -- The temporal-ui port and exposed kubernetes port + port: 8088 + + # -- Add extra annotations to the temporal-ui pod + podAnnotations: {} + + # -- Add extra labels to the temporal-ui pod + podLabels: {} + + # -- Security context for the container + podSecurityContext: + # gid=1000(temporal-ui) + fsGroup: 1000 + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: false + # uid=1000(temporal-ui) + runAsUser: 0 + # gid=1000(temporal-ui) + runAsGroup: 0 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + ## Examples (when using `temporal.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraInitContainers: + ## - name: config-loader + ## image: temporalio/ui:2.30.1 + ## command: + ## - /bin/sh + ## - -c + ## - >- + ## find /etc/temporal/config/ -maxdepth 1 -mindepth 1 -exec cp -ar {} /config/ \; + ## volumeMounts: + ## - name: config + ## mountPath: /config + # -- Additional InitContainers to initialize the pod + extraInitContainers: [] + + livenessProbe: + # -- Enable livenessProbe on the temporal-ui + enabled: false + + readinessProbe: + # -- Enable readinessProbe on the temporal-ui + enabled: false + + # -- Node labels for temporal-ui pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for temporal-ui pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # -- Affinity and anti-affinity for temporal-ui pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + + ## Example: + ## + ## extraEnv: + ## - name: SAMPLE_ENV_VAR + ## value: "key=sample-value" + # -- Additional env vars for temporal-ui pod(s). + extraEnv: [] + + ## Examples (when using `temporal.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumeMounts: + ## - name: tmpdir + ## mountPath: /tmp + ## - name: config + ## mountPath: /etc/temporal/config + # -- Additional volumeMounts for temporal containers + extraVolumeMounts: [] + + ## Examples (when using `temporal.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumes: + ## - name: tmpdir + ## emptyDir: {} + ## - name: config + ## emptyDir: {} + # -- Additional volumes for temporal-ui pods + extraVolumes: [] + + ## Temporal UI resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + resources: + ## Example: + ## requests: + ## memory: 256Mi + ## cpu: 250m + # -- The requested resources for temporal-ui pods + requests: {} + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + # -- The resources limits for temporal-ui pods + limits: {} + + extraContainers: [] + +## @section Airbyte Database parameters + +# PostgreSQL chart configuration, see https://github.com/bitnami/charts/blob/master/bitnami/postgresql/values.yaml +postgresql: + # -- Switch to enable or disable the PostgreSQL helm chart + enabled: false + + ## image.repository Repository for airbyte-db statefulset + image: + repository: airbyte/db + # -- Airbyte Postgresql username + postgresqlUsername: airbyte + # -- Airbyte Postgresql password + postgresqlPassword: airbyte + # -- Airbyte Postgresql database + postgresqlDatabase: db-airbyte + # fullnameOverride: *db-hostname + ## This secret is used in case of postgresql.enabled=true and we would like to specify password for newly created postgresql instance + # -- Name of an existing secret containing the PostgreSQL password ('postgresql-password' key) + existingSecret: "" + podSecurityContext: + # gid=70(postgres) + fsGroup: 70 + containerSecurityContext: + # -- Ensures the container will run with a non-root user + allowPrivilegeEscalation: false + runAsNonRoot: true + # uid=70(postgres) + runAsUser: 70 + # gid=70(postgres) + runAsGroup: 70 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + commonAnnotations: + # -- It will determine when the hook should be rendered + helm.sh/hook: pre-install + # -- The order in which the hooks are executed. If weight is lower, it has higher priority + helm.sh/hook-weight: "-1" + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for postgresql pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # -- Affinity and anti-affinity for postgresql pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + +# External PostgreSQL configuration, All of these values are only used when postgresql.enabled is set to false +externalDatabase: + # -- Database host + host: "" + # -- non-root Username for Airbyte Database + user: "" + # -- Database password + password: "" + # -- Name of an existing secret resource containing the DB password + existingSecret: "" + # -- Name of an existing secret key containing the DB password + existingSecretPasswordKey: "" + # -- Database name + database: "" + # -- Database port number + port: "" + # -- Database full JDBL URL (ex: jdbc:postgresql://host:port/db?parameters) + jdbcUrl: "" + +minio: + image: + # -- Minio image used by Minio helm chart + repository: minio/minio + # -- Minio tag image + tag: RELEASE.2023-11-20T22-40-07Z + + mcImage: + repository: airbyte/mc + tag: latest + + storage: + volumeClaimValue: 500Mi + + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + ## + nodeSelector: {} + + # -- Tolerations for minio pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + ## + tolerations: [] + + # -- Affinity and anti-affinity for minio pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + + resources: + requests: + memory: 1Gi + cpu: 250m + limits: + cpu: 1 + memory: 4Gi +## @section cron parameters +cron: + enabled: true + # -- Number of cron replicas + replicaCount: 1 + image: + # -- The repository to use for the airbyte cron image. + repository: airbyte/cron + # -- The pull policy to use for the airbyte cron image + pullPolicy: IfNotPresent + + # -- Add extra annotations to the cron pods + podAnnotations: {} + + # -- Add extra labels to the cron pods + podLabels: {} + + # -- Security context for the container + podSecurityContext: + # uid=1000(airbyte) + fsGroup: 1000 + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + # uid=1000(airbyte) + runAsUser: 1000 + # gid=1000(airbyte) + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + livenessProbe: + # -- Enable livenessProbe on the cron + enabled: true + # -- Initial delay seconds for livenessProbe + initialDelaySeconds: 30 + # -- Period seconds for livenessProbe + periodSeconds: 10 + # -- Timeout seconds for livenessProbe + timeoutSeconds: 1 + # -- Failure threshold for livenessProbe + failureThreshold: 3 + # -- Success threshold for livenessProbe + successThreshold: 1 + + readinessProbe: + # -- Enable readinessProbe on the cron + enabled: true + # -- Initial delay seconds for readinessProbe + initialDelaySeconds: 10 + # -- Period seconds for readinessProbe + periodSeconds: 10 + # -- Timeout seconds for readinessProbe + timeoutSeconds: 1 + # -- Failure threshold for readinessProbe + failureThreshold: 3 + # -- Success threshold for readinessProbe + successThreshold: 1 + + ## cron resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + # -- The resources limits for the cron container + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + # -- The requested resources for the cron container + requests: {} + + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for cron pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # -- Affinity and anti-affinity for cron pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + + log: + # -- The log level to log at. + level: "INFO" + + ## Examples (when using `cron.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumeMounts: + ## - name: tmpdir + ## mountPath: /tmp + # -- Additional volumeMounts for cron containers + extraVolumeMounts: [] + + ## Examples (when using `cron.containerSecurityContext.readOnlyRootFilesystem=true`): + ## extraVolumes: + ## - name: tmpdir + ## emptyDir: {} + # -- Additional volumes for cron pods + extraVolumes: [] + + ## Example: + # extraContainers: + # - name: otel_collector + # image: somerepo/someimage:sometag + # args: [ + # "--important-args" + # ] + # ports: + # - containerPort: 443 + # volumeMounts: + # - name: volumeMountCool + # mountPath: /some/path + # readOnly: true + # -- Additional container for cron pods + extraContainers: [] + + ## Example: + # extraInitContainers: + # - name: sleepy + # image: alpine + # command: ['sleep', '60'] + # -- Additional init containers for cron pods + extraInitContainers: [] + + ## Example: (With default env vars and values taken from generated config map) + # extraEnv: + # - name: AIRBYTE_VERSION + # valueFrom: + # configMapKeyRef: + # name: airbyte-env + # key: AIRBYTE_VERSION + # - name: API_URL + # valueFrom: + # configMapKeyRef: + # name: airbyte-env + # key: API_URL + # - name: TRACKING_STRATEGY + # valueFrom: + # configMapKeyRef: + # name: airbyte-env + # key: TRACKING_STRATEGY + # - name: FULLSTORY + # valueFrom: + # configMapKeyRef: + # name: airbyte-env + # key: FULLSTORY + # - name: INTERNAL_API_HOST + # valueFrom: + # configMapKeyRef: + # name: airbyte-env + # key: INTERNAL_API_HOST + # -- Supply extra env variables to main container using full notation + extraEnv: [] + ## Example: + ## secrets: + ## DATABASE_PASSWORD: strong-password + ## DATABASE_USER: my-db-user + # -- Supply additional secrets to container + secrets: {} + ## Example: + ## env_vars: + ## DATABASE_HOST: airbyte-db + ## DATABASE_PORT: 5432 + # -- Supply extra env variables to main container using simplified notation + env_vars: {} + +connector-builder-server: + enabled: true + # -- Number of connector-builder-server replicas + replicaCount: 1 + + image: + # -- The repository to use for the airbyte connector-builder-server image. + repository: airbyte/connector-builder-server + # -- The pull policy to use for the airbyte connector-builder-server image + pullPolicy: IfNotPresent + + # -- Security context for the container + podSecurityContext: + # gid=1000(airbyte) + fsGroup: 1000 + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + # uid=1000(airbyte) + runAsUser: 1000 + # gid=1000(airbyte) + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + livenessProbe: + # -- Enable livenessProbe on the server + enabled: true + # -- Initial delay seconds for livenessProbe + initialDelaySeconds: 30 + # -- Period seconds for livenessProbe + periodSeconds: 10 + # -- Timeout seconds for livenessProbe + timeoutSeconds: 10 + # -- Failure threshold for livenessProbe + failureThreshold: 3 + # -- Success threshold for livenessProbe + successThreshold: 1 + + readinessProbe: + # -- Enable readinessProbe on the server + enabled: true + # -- Initial delay seconds for readinessProbe + initialDelaySeconds: 10 + # -- Period seconds for readinessProbe + periodSeconds: 10 + # -- Timeout seconds for readinessProbe + timeoutSeconds: 10 + # -- Failure threshold for readinessProbe + failureThreshold: 3 + # -- Success threshold for readinessProbe + successThreshold: 1 + + ## connector-builder-server resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + # -- The resources limits for the connector-builder-server container + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + # -- The requested resources for the connector-builder-server container + requests: {} + + log: + # -- The log level to log at. + level: "INFO" + + env_vars: {} + service: + port: 80 + + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for webapp pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # -- Affinity and anti-affinity for webapp pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + +keycloak: + enabled: false + env_vars: {} + + auth: + adminUsername: airbyteAdmin + adminPassword: keycloak123 + + image: + repository: airbyte/keycloak + pullPolicy: IfNotPresent + + # -- Security context for the container + podSecurityContext: + fsGroup: 1000 + + initContainers: + initDb: + image: "postgres:13-alpine" + + initContainerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + runAsUser: 1000 + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + runAsUser: 1000 + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for webapp pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # -- Affinity and anti-affinity for webapp pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + +keycloak-setup: + enabled: false + env_vars: {} + + image: + repository: airbyte/keycloak-setup + pullPolicy: IfNotPresent + + # -- Security context for the container + podSecurityContext: + # gid=1000(airbyte) + fsGroup: 1000 + + initContainerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + runAsUser: 1000 + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + initContainers: + keycloakReadinessCheck: + image: "curlimages/curl:8.1.1" + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + # uid=1000(airbyte) + runAsUser: 1000 + # gid=1000(airbyte) + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for webapp pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # -- Affinity and anti-affinity for webapp pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + +workload-api-server: + enabled: true + + bearerToken: token + + # -- workload-api-server replicas + replicaCount: 1 + + image: + # -- The repository to use for the airbyte-workload-api-server image. + repository: airbyte/workload-api-server + # -- The pull policy to use for the airbyte-workload-api-server image + pullPolicy: IfNotPresent + + # -- Security context for the container + podSecurityContext: + # gid=1000(airbyte) + fsGroup: 1000 + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + # uid=1000(airbyte) + runAsUser: 1000 + # gid=1000(airbyte) + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + livenessProbe: + # -- Enable livenessProbe on the server + enabled: true + # -- Initial delay seconds for livenessProbe + initialDelaySeconds: 30 + # -- Period seconds for livenessProbe + periodSeconds: 10 + # -- Timeout seconds for livenessProbe + timeoutSeconds: 10 + # -- Failure threshold for livenessProbe + failureThreshold: 3 + # -- Success threshold for livenessProbe + successThreshold: 1 + + readinessProbe: + # -- Enable readinessProbe on the server + enabled: true + # -- Initial delay seconds for readinessProbe + initialDelaySeconds: 10 + # -- Period seconds for readinessProbe + periodSeconds: 10 + # -- Timeout seconds for readinessProbe + timeoutSeconds: 10 + # -- Failure threshold for readinessProbe + failureThreshold: 3 + # -- Success threshold for readinessProbe + successThreshold: 1 + + ## airbyte-workload-api-server resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + # -- The resources limits for the airbyte-workload-api-server container + limits: + cpu: 2 + memory: 6Gi + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + # -- The requested resources for the workload launcher container + requests: + cpu: 400m + memory: 1Gi + + log: + # -- The log level at which to log + level: "INFO" + + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for webapp pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # -- Affinity and anti-affinity for webapp pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + + env_vars: {} + service: + port: 8007 + + # Configure the ingress resource that allows you to access the Airbyte Workload API, see http://kubernetes.io/docs/user-guide/ingress/ + ingress: + # -- Set to true to enable ingress record generation + enabled: false + # -- Specifies ingressClassName for clusters >= 1.18+ + className: "" + # -- Ingress annotations done as key:value pairs + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # -- The list of hostnames to be covered with this ingress record + hosts: [] + # - host: chart-example.local + # paths: + # - path: / + # pathType: ImplementationSpecific + # -- Custom ingress TLS configuration + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +featureflag-server: + enabled: false + + # -- workload-api-server replicas + replicaCount: 1 + + image: + # -- The repository to use for the airbyte-workload-api-server image. + repository: airbyte/featureflag-server + # -- The pull policy to use for the airbyte-workload-api-server image + pullPolicy: IfNotPresent + + # -- Security context for the container + podSecurityContext: + # gid=1000(airbyte) + fsGroup: 1000 + + containerSecurityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + # uid=1000(airbyte) + runAsUser: 1000 + # gid=1000(airbyte) + runAsGroup: 1000 + readOnlyRootFilesystem: false + capabilities: + drop: ["ALL"] + seccompProfile: + type: RuntimeDefault + + livenessProbe: + # -- Enable livenessProbe on the server + enabled: true + # -- Initial delay seconds for livenessProbe + initialDelaySeconds: 30 + # -- Period seconds for livenessProbe + periodSeconds: 10 + # -- Timeout seconds for livenessProbe + timeoutSeconds: 10 + # -- Failure threshold for livenessProbe + failureThreshold: 3 + # -- Success threshold for livenessProbe + successThreshold: 1 + + readinessProbe: + # -- Enable readinessProbe on the server + enabled: true + # -- Initial delay seconds for readinessProbe + initialDelaySeconds: 10 + # -- Period seconds for readinessProbe + periodSeconds: 10 + # -- Timeout seconds for readinessProbe + timeoutSeconds: 10 + # -- Failure threshold for readinessProbe + failureThreshold: 3 + # -- Success threshold for readinessProbe + successThreshold: 1 + + ## airbyte-workload-api-server resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + resources: + ## Example: + ## limits: + ## cpu: 200m + ## memory: 1Gi + # -- The resources limits for the airbyte-workload-api-server container + limits: {} + ## Examples: + ## requests: + ## memory: 256Mi + ## cpu: 250m + # -- The requested resources for the airbyte-workload-api-server container + requests: {} + + log: + # -- The log level at which to log + level: "INFO" + + # -- Node labels for pod assignment, see https://kubernetes.io/docs/user-guide/node-selection/ + nodeSelector: {} + + # -- Tolerations for webapp pod assignment, see https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + tolerations: [] + + # -- Affinity and anti-affinity for webapp pod assignment, see + # https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + affinity: {} + + env_vars: {} + service: + port: 8007 + + # Configure the ingress resource that allows you to access the Airbyte Workload API, see http://kubernetes.io/docs/user-guide/ingress/ + ingress: + # -- Set to true to enable ingress record generation + enabled: false + # -- Specifies ingressClassName for clusters >= 1.18+ + className: "" + # -- Ingress annotations done as key:value pairs + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # -- The list of hostnames to be covered with this ingress record + hosts: [] + # - host: chart-example.local + # paths: + # - path: / + # pathType: ImplementationSpecific + # -- Custom ingress TLS configuration + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +testWebapp: + image: + repository: busybox + tag: latest diff --git a/helm/backend-sdk/Chart.yaml b/helm/backend-sdk/Chart.yaml index 0cc2e75d..889e2d26 100644 --- a/helm/backend-sdk/Chart.yaml +++ b/helm/backend-sdk/Chart.yaml @@ -15,7 +15,7 @@ type: application # 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: v0.26.0-alpha.4 +version: v0.27.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 diff --git a/helm/backend-sdk/templates/hpa.yaml b/helm/backend-sdk/templates/hpa.yaml index dc44c178..7361a4cc 100644 --- a/helm/backend-sdk/templates/hpa.yaml +++ b/helm/backend-sdk/templates/hpa.yaml @@ -1,5 +1,5 @@ {{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta2 +apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: {{ include "backend-sdk.fullname" . }} diff --git a/helm/dashboard-backend/Chart.yaml b/helm/dashboard-backend/Chart.yaml index da57e48f..04297a60 100644 --- a/helm/dashboard-backend/Chart.yaml +++ b/helm/dashboard-backend/Chart.yaml @@ -15,7 +15,7 @@ type: application # 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: v0.26.0-alpha.3 +version: v0.27.2 # 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 diff --git a/helm/dashboard-backend/templates/deployment.yaml b/helm/dashboard-backend/templates/deployment.yaml index 810750e1..5512c91d 100644 --- a/helm/dashboard-backend/templates/deployment.yaml +++ b/helm/dashboard-backend/templates/deployment.yaml @@ -38,8 +38,8 @@ spec: args: - -Xms512m - -Xmx3024m - - -XX:PermSize=64m - - -XX:MaxPermSize=500m + - -XX:MetaspaceSize=64m + - -XX:MaxMetaspaceSize=500m - -Xss1024k - -jar - blotout-0.0.1.jar diff --git a/helm/dashboard-backend/templates/hpa.yaml b/helm/dashboard-backend/templates/hpa.yaml index 36959440..d4bc6c1f 100644 --- a/helm/dashboard-backend/templates/hpa.yaml +++ b/helm/dashboard-backend/templates/hpa.yaml @@ -1,5 +1,5 @@ {{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta2 +apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: {{ include "dashboard-backend.fullname" . }} diff --git a/helm/dashboard-backend/templates/ingress.yaml b/helm/dashboard-backend/templates/ingress.yaml index af8f59ce..6106ae1b 100644 --- a/helm/dashboard-backend/templates/ingress.yaml +++ b/helm/dashboard-backend/templates/ingress.yaml @@ -44,7 +44,7 @@ spec: {{- range .paths }} - path: {{ .path }} {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} - pathType: {{ .pathType }} + pathType: ImplementationSpecific {{- end }} backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} @@ -58,4 +58,4 @@ spec: {{- end }} {{- end }} {{- end }} -{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/dashboard-backend/templates/swagger-ui-custom-html.yaml b/helm/dashboard-backend/templates/swagger-ui-custom-html.yaml index 2b8cb985..6db95b95 100644 --- a/helm/dashboard-backend/templates/swagger-ui-custom-html.yaml +++ b/helm/dashboard-backend/templates/swagger-ui-custom-html.yaml @@ -42,18 +42,19 @@ spec: http: paths: - path: /swagger-ui-custom.html(/|$)(.*) - {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} pathType: ImplementationSpecific + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: {{ $fullName }} - port: - number: {{ $svcPort }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} {{- else }} - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} {{- end }} {{- end }} - {{- end }} -{{- end }} \ No newline at end of file + {{- end }} \ No newline at end of file diff --git a/helm/dashboard-backend/templates/swagger-ui.yaml b/helm/dashboard-backend/templates/swagger-ui.yaml index 42e60d48..c70be868 100644 --- a/helm/dashboard-backend/templates/swagger-ui.yaml +++ b/helm/dashboard-backend/templates/swagger-ui.yaml @@ -42,18 +42,19 @@ spec: http: paths: - path: /swagger-ui(/|$)(.*) - {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} pathType: ImplementationSpecific + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: {{ $fullName }} - port: - number: {{ $svcPort }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} {{- else }} - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} {{- end }} {{- end }} - {{- end }} -{{- end }} \ No newline at end of file + {{- end }} \ No newline at end of file diff --git a/helm/dashboard-backend/templates/swagger-v3.yaml b/helm/dashboard-backend/templates/swagger-v3.yaml index ca4d1189..a354ed50 100644 --- a/helm/dashboard-backend/templates/swagger-v3.yaml +++ b/helm/dashboard-backend/templates/swagger-v3.yaml @@ -42,18 +42,19 @@ spec: http: paths: - path: /v3(/|$)(.*) - {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} pathType: ImplementationSpecific + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: {{ $fullName }} - port: - number: {{ $svcPort }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} {{- else }} - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} {{- end }} {{- end }} - {{- end }} -{{- end }} \ No newline at end of file + {{- end }} \ No newline at end of file diff --git a/helm/dashboard-frontend/Chart.yaml b/helm/dashboard-frontend/Chart.yaml index f3e43223..c70c98a3 100644 --- a/helm/dashboard-frontend/Chart.yaml +++ b/helm/dashboard-frontend/Chart.yaml @@ -15,7 +15,7 @@ type: application # 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: v0.26.0-alpha.3 +version: v0.27.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 diff --git a/helm/dashboard-frontend/templates/hpa.yaml b/helm/dashboard-frontend/templates/hpa.yaml index 4aa998c7..2c60d8a0 100644 --- a/helm/dashboard-frontend/templates/hpa.yaml +++ b/helm/dashboard-frontend/templates/hpa.yaml @@ -1,5 +1,5 @@ {{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta2 +apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: {{ include "dashboard-frontend.fullname" . }}