From d0cf5830771584c6183a44ff21b18dd5e969d80b Mon Sep 17 00:00:00 2001 From: Ronit Panda Date: Wed, 18 Oct 2023 07:10:32 +0530 Subject: [PATCH 01/11] feat: adds helm charts template and adds postgres deps --- helm-charts/.gitignore | 1 + helm-charts/.helmignore | 23 ++++ helm-charts/Chart.lock | 6 + helm-charts/Chart.yaml | 30 +++++ helm-charts/templates/NOTES.txt | 22 ++++ helm-charts/templates/_helpers.tpl | 62 ++++++++++ helm-charts/templates/deployment.yaml | 73 ++++++++++++ helm-charts/templates/hpa.yaml | 32 +++++ helm-charts/templates/ingress.yaml | 61 ++++++++++ helm-charts/templates/service.yaml | 15 +++ helm-charts/templates/serviceaccount.yaml | 13 ++ .../templates/tests/test-connection.yaml | 15 +++ helm-charts/values.yaml | 111 ++++++++++++++++++ 13 files changed, 464 insertions(+) create mode 100644 helm-charts/.gitignore create mode 100644 helm-charts/.helmignore create mode 100644 helm-charts/Chart.lock create mode 100644 helm-charts/Chart.yaml create mode 100644 helm-charts/templates/NOTES.txt create mode 100644 helm-charts/templates/_helpers.tpl create mode 100644 helm-charts/templates/deployment.yaml create mode 100644 helm-charts/templates/hpa.yaml create mode 100644 helm-charts/templates/ingress.yaml create mode 100644 helm-charts/templates/service.yaml create mode 100644 helm-charts/templates/serviceaccount.yaml create mode 100644 helm-charts/templates/tests/test-connection.yaml create mode 100644 helm-charts/values.yaml diff --git a/helm-charts/.gitignore b/helm-charts/.gitignore new file mode 100644 index 00000000000..711a39c541a --- /dev/null +++ b/helm-charts/.gitignore @@ -0,0 +1 @@ +charts/ \ No newline at end of file diff --git a/helm-charts/.helmignore b/helm-charts/.helmignore new file mode 100644 index 00000000000..0e8a0eb36f4 --- /dev/null +++ b/helm-charts/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm-charts/Chart.lock b/helm-charts/Chart.lock new file mode 100644 index 00000000000..b21a8b38f26 --- /dev/null +++ b/helm-charts/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 13.1.5 +digest: sha256:ff57915ccf07a2ea54e3fae652ec9d320e7145cc00b6a8bf7ec81d793416ae42 +generated: "2023-10-18T06:47:42.592418+05:30" diff --git a/helm-charts/Chart.yaml b/helm-charts/Chart.yaml new file mode 100644 index 00000000000..3c829e742fd --- /dev/null +++ b/helm-charts/Chart.yaml @@ -0,0 +1,30 @@ +apiVersion: v2 +name: helm-charts +description: A Helm chart for a full Trigger application stack + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: 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: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" + +dependencies: + - name: postgresql + version: "~13.1.5" + repository: https://charts.bitnami.com/bitnami + condition: postgresql.enabled diff --git a/helm-charts/templates/NOTES.txt b/helm-charts/templates/NOTES.txt new file mode 100644 index 00000000000..ee704331c63 --- /dev/null +++ b/helm-charts/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "helm-charts.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.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 "helm-charts.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "helm-charts.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "helm-charts.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -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-charts/templates/_helpers.tpl b/helm-charts/templates/_helpers.tpl new file mode 100644 index 00000000000..eab42fcdec3 --- /dev/null +++ b/helm-charts/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "helm-charts.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 "helm-charts.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 "helm-charts.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "helm-charts.labels" -}} +helm.sh/chart: {{ include "helm-charts.chart" . }} +{{ include "helm-charts.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "helm-charts.selectorLabels" -}} +app.kubernetes.io/name: {{ include "helm-charts.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "helm-charts.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "helm-charts.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/helm-charts/templates/deployment.yaml b/helm-charts/templates/deployment.yaml new file mode 100644 index 00000000000..997ad7a1d7c --- /dev/null +++ b/helm-charts/templates/deployment.yaml @@ -0,0 +1,73 @@ +{{- $trigger := .Values.trigger -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "helm-charts.fullname" . }} + labels: + {{- include "helm-charts.labels" . | nindent 4 }} +spec: + {{- if not .trigger.autoscaling.enabled }} + replicas: {{ .trigger.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "helm-charts.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "helm-charts.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "helm-charts.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/helm-charts/templates/hpa.yaml b/helm-charts/templates/hpa.yaml new file mode 100644 index 00000000000..5b0cac66cb8 --- /dev/null +++ b/helm-charts/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "helm-charts.fullname" . }} + labels: + {{- include "helm-charts.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "helm-charts.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/helm-charts/templates/ingress.yaml b/helm-charts/templates/ingress.yaml new file mode 100644 index 00000000000..eda351d18d4 --- /dev/null +++ b/helm-charts/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "helm-charts.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 "helm-charts.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: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/helm-charts/templates/service.yaml b/helm-charts/templates/service.yaml new file mode 100644 index 00000000000..933827306b0 --- /dev/null +++ b/helm-charts/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "helm-charts.fullname" . }} + labels: + {{- include "helm-charts.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "helm-charts.selectorLabels" . | nindent 4 }} diff --git a/helm-charts/templates/serviceaccount.yaml b/helm-charts/templates/serviceaccount.yaml new file mode 100644 index 00000000000..e471795b18f --- /dev/null +++ b/helm-charts/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "helm-charts.serviceAccountName" . }} + labels: + {{- include "helm-charts.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/helm-charts/templates/tests/test-connection.yaml b/helm-charts/templates/tests/test-connection.yaml new file mode 100644 index 00000000000..cbb60c7243c --- /dev/null +++ b/helm-charts/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "helm-charts.fullname" . }}-test-connection" + labels: + {{- include "helm-charts.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "helm-charts.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/helm-charts/values.yaml b/helm-charts/values.yaml new file mode 100644 index 00000000000..3862a1c5a8f --- /dev/null +++ b/helm-charts/values.yaml @@ -0,0 +1,111 @@ +# Default values for helm-charts. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +trigger: + replicaCount: 1 + + image: + repository: nginx + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + + imagePullSecrets: [] + nameOverride: "" + fullnameOverride: "" + + serviceAccount: + # Specifies whether a service account should be created + create: true + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + + podAnnotations: {} + podLabels: {} + + podSecurityContext: + {} + # fsGroup: 2000 + + securityContext: + {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + + service: + type: ClusterIP + port: 80 + + 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 + + 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:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + + # Additional volumes on the output Deployment definition. + volumes: [] + # - name: foo + # secret: + # secretName: mysecret + # optional: false + + # Additional volumeMounts on the output Deployment definition. + volumeMounts: [] + # - name: foo + # mountPath: "/etc/foo" + # readOnly: true + + nodeSelector: {} + + tolerations: [] + + affinity: {} + +postgresql: + enabled: true + global: + postgresql: + postgresqlDatabase: "usersdb" + postgresqlPassword: "Hello@123" + postgresqlUsername: "userservice-pguser" + servicePort: "5432" From 22ff2ce1cc690e20ce2ac3089c337804e3a3a102 Mon Sep 17 00:00:00 2001 From: Ronit Panda Date: Wed, 18 Oct 2023 09:56:12 +0530 Subject: [PATCH 02/11] feat: adds all depl (barebones) --- helm-charts/templates/NOTES.txt | 22 ----- helm-charts/templates/_helpers.tpl | 14 +-- helm-charts/templates/deployment.yaml | 73 -------------- helm-charts/templates/hpa.yaml | 32 ------ helm-charts/templates/ingress.yaml | 61 ------------ helm-charts/templates/service.yaml | 15 --- helm-charts/templates/serviceaccount.yaml | 13 --- .../templates/tests/test-connection.yaml | 15 --- helm-charts/templates/trigger.yaml | 98 +++++++++++++++++++ helm-charts/values.yaml | 31 ++++-- random.yaml | 1 + 11 files changed, 129 insertions(+), 246 deletions(-) delete mode 100644 helm-charts/templates/NOTES.txt delete mode 100644 helm-charts/templates/deployment.yaml delete mode 100644 helm-charts/templates/hpa.yaml delete mode 100644 helm-charts/templates/ingress.yaml delete mode 100644 helm-charts/templates/service.yaml delete mode 100644 helm-charts/templates/serviceaccount.yaml delete mode 100644 helm-charts/templates/tests/test-connection.yaml create mode 100644 helm-charts/templates/trigger.yaml create mode 100644 random.yaml diff --git a/helm-charts/templates/NOTES.txt b/helm-charts/templates/NOTES.txt deleted file mode 100644 index ee704331c63..00000000000 --- a/helm-charts/templates/NOTES.txt +++ /dev/null @@ -1,22 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "helm-charts.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.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 "helm-charts.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "helm-charts.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "helm-charts.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -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-charts/templates/_helpers.tpl b/helm-charts/templates/_helpers.tpl index eab42fcdec3..bf88c1a00a9 100644 --- a/helm-charts/templates/_helpers.tpl +++ b/helm-charts/templates/_helpers.tpl @@ -2,7 +2,7 @@ Expand the name of the chart. */}} {{- define "helm-charts.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- default .Chart.Name .Values.trigger.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} {{/* @@ -11,10 +11,10 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this If release name contains chart name it will be used as a full name. */}} {{- define "helm-charts.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- if .Values.trigger.fullnameOverride }} +{{- .Values.trigger.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} +{{- $name := default .Chart.Name .Values.trigger.nameOverride }} {{- if contains $name .Release.Name }} {{- .Release.Name | trunc 63 | trimSuffix "-" }} {{- else }} @@ -54,9 +54,9 @@ app.kubernetes.io/instance: {{ .Release.Name }} Create the name of the service account to use */}} {{- define "helm-charts.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "helm-charts.fullname" .) .Values.serviceAccount.name }} +{{- if .Values.trigger.serviceAccount.create }} +{{- default (include "helm-charts.fullname" .) .Values.trigger.serviceAccount.name }} {{- else }} -{{- default "default" .Values.serviceAccount.name }} +{{- default "default" .Values.trigger.serviceAccount.name }} {{- end }} {{- end }} diff --git a/helm-charts/templates/deployment.yaml b/helm-charts/templates/deployment.yaml deleted file mode 100644 index 997ad7a1d7c..00000000000 --- a/helm-charts/templates/deployment.yaml +++ /dev/null @@ -1,73 +0,0 @@ -{{- $trigger := .Values.trigger -}} -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "helm-charts.fullname" . }} - labels: - {{- include "helm-charts.labels" . | nindent 4 }} -spec: - {{- if not .trigger.autoscaling.enabled }} - replicas: {{ .trigger.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "helm-charts.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "helm-charts.labels" . | nindent 8 }} - {{- with .Values.podLabels }} - {{- toYaml . | nindent 8 }} - {{- end }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "helm-charts.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http - containerPort: {{ .Values.service.port }} - protocol: TCP - livenessProbe: - httpGet: - path: / - port: http - readinessProbe: - httpGet: - path: / - port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.volumeMounts }} - volumeMounts: - {{- toYaml . | nindent 12 }} - {{- end }} - {{- with .Values.volumes }} - volumes: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/helm-charts/templates/hpa.yaml b/helm-charts/templates/hpa.yaml deleted file mode 100644 index 5b0cac66cb8..00000000000 --- a/helm-charts/templates/hpa.yaml +++ /dev/null @@ -1,32 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "helm-charts.fullname" . }} - labels: - {{- include "helm-charts.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "helm-charts.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - target: - type: Utilization - averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/helm-charts/templates/ingress.yaml b/helm-charts/templates/ingress.yaml deleted file mode 100644 index eda351d18d4..00000000000 --- a/helm-charts/templates/ingress.yaml +++ /dev/null @@ -1,61 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "helm-charts.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 "helm-charts.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: {{ $fullName }} - port: - number: {{ $svcPort }} - {{- else }} - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/helm-charts/templates/service.yaml b/helm-charts/templates/service.yaml deleted file mode 100644 index 933827306b0..00000000000 --- a/helm-charts/templates/service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "helm-charts.fullname" . }} - labels: - {{- include "helm-charts.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "helm-charts.selectorLabels" . | nindent 4 }} diff --git a/helm-charts/templates/serviceaccount.yaml b/helm-charts/templates/serviceaccount.yaml deleted file mode 100644 index e471795b18f..00000000000 --- a/helm-charts/templates/serviceaccount.yaml +++ /dev/null @@ -1,13 +0,0 @@ -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "helm-charts.serviceAccountName" . }} - labels: - {{- include "helm-charts.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -automountServiceAccountToken: {{ .Values.serviceAccount.automount }} -{{- end }} diff --git a/helm-charts/templates/tests/test-connection.yaml b/helm-charts/templates/tests/test-connection.yaml deleted file mode 100644 index cbb60c7243c..00000000000 --- a/helm-charts/templates/tests/test-connection.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "helm-charts.fullname" . }}-test-connection" - labels: - {{- include "helm-charts.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "helm-charts.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never diff --git a/helm-charts/templates/trigger.yaml b/helm-charts/templates/trigger.yaml new file mode 100644 index 00000000000..0c666382352 --- /dev/null +++ b/helm-charts/templates/trigger.yaml @@ -0,0 +1,98 @@ +{{- $trigger := .Values.trigger -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "helm-charts.fullname" . }} + labels: + {{- include "helm-charts.labels" . | nindent 4 }} +spec: + {{- if not $trigger.autoscaling.enabled }} + replicas: {{ $trigger.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "helm-charts.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with $trigger.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "helm-charts.labels" . | nindent 8 }} + {{- with $trigger.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with $trigger.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "helm-charts.serviceAccountName" . }} + securityContext: + {{- toYaml $trigger.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml $trigger.securityContext | nindent 12 }} + image: "{{ $trigger.image.repository }}:{{ $trigger.image.tag | default "latest" }}" + imagePullPolicy: {{ $trigger.image.pullPolicy }} + ports: + - name: http + containerPort: 3030 + protocol: TCP + readinessProbe: + httpGet: + path: / + port: http + envFrom: + - secretRef: + name: {{ $trigger.kubeSecretRef | default (include "helm-charts.fullname" .) }} + {{- if $trigger.resources }} + resources: {{- toYaml $trigger.resources | nindent 12 }} + {{- end }} +--- + +apiVersion: v1 +kind: Service +metadata: + name: {{ include "helm-charts.fullname" . }} + labels: + {{- include "helm-charts.labels" . | nindent 4 }} +spec: + type: {{ $trigger.service.type }} + ports: + - port: 3030 + targetPort: 3030 + protocol: TCP + {{- if eq $trigger.service.type "NodePort" }} + nodePort: {{ $trigger.service.nodePort }} + {{- end }} + selector: + {{- include "helm-charts.selectorLabels" . | nindent 4 }} + +--- + +{{ if not $trigger.kubeSecretRef }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "helm-charts.fullname" . }} + annotations: + "helm.sh/resource-policy": "keep" +type: Opaque +stringData: + {{- $requiredVars := dict "MAGIC_LINK_SECRET" (randAlphaNum 32 | lower) + "SESSION_SECRET" (randAlphaNum 32 | lower) + "ENCRYPTION_KEY" (randAlphaNum 32 | lower) + "DIRECT_URL" ("postgresql://user:password@triggerdotdev-database:5432/dbname") }} + {{- $secretObj := (lookup "v1" "Secret" .Release.Namespace (include "helm-charts.fullname" .)) | default dict }} + {{- $secretData := (get $secretObj "data") | default dict }} + {{ range $key, $value := $trigger.envVars }} + {{- println $key -}} + {{- $default := get $requiredVars $key -}} + {{- $current := get $secretData $key | b64dec -}} + {{- $v := $value | default ($current | default $default) -}} + {{ $key }}: {{ $v | quote }} + {{ end -}} +{{- end }} \ No newline at end of file diff --git a/helm-charts/values.yaml b/helm-charts/values.yaml index 3862a1c5a8f..a5172e2191a 100644 --- a/helm-charts/values.yaml +++ b/helm-charts/values.yaml @@ -2,13 +2,15 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. trigger: - replicaCount: 1 + replicaCount: 2 image: - repository: nginx + repository: ghcr.io/triggerdotdev/trigger.dev pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: "" + tag: "latest" + + kubeSecretRef: "" imagePullSecrets: [] nameOverride: "" @@ -42,8 +44,8 @@ trigger: # runAsUser: 1000 service: - type: ClusterIP - port: 80 + type: NodePort + nodePort: 30002 ingress: enabled: false @@ -101,11 +103,24 @@ trigger: affinity: {} + envVars: + - ENCRYPTION_KEY: "" + - MAGIC_LINK_SECRET: "" + - SESSION_SECRET: "" + - LOGIN_ORIGIN: "" + - APP_ORIGIN: "" + - DIRECT_URL: "" + - FROM_EMAIL: "" + - REPLY_TO_EMAIL: "" + - RESEND_API_KEY: "" + - AUTH_GITHUB_CLIENT_ID: "" + - AUTH_GITHUB_CLIENT_SECRET: "" + postgresql: enabled: true global: postgresql: - postgresqlDatabase: "usersdb" - postgresqlPassword: "Hello@123" - postgresqlUsername: "userservice-pguser" + postgresqlDatabase: "dbname" + postgresqlPassword: "password" + postgresqlUsername: "user" servicePort: "5432" diff --git a/random.yaml b/random.yaml new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/random.yaml @@ -0,0 +1 @@ + From 3bc44393d3efc807a31cf67a995966be0e746c83 Mon Sep 17 00:00:00 2001 From: Ronit Panda Date: Wed, 18 Oct 2023 09:56:24 +0530 Subject: [PATCH 03/11] feat: adds all depl (barebones) --- random.yaml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 random.yaml diff --git a/random.yaml b/random.yaml deleted file mode 100644 index 8b137891791..00000000000 --- a/random.yaml +++ /dev/null @@ -1 +0,0 @@ - From 4e88502d14d2fc07a7bd08025d1f24fe0cad4cd5 Mon Sep 17 00:00:00 2001 From: Ronit Panda Date: Wed, 18 Oct 2023 10:00:29 +0530 Subject: [PATCH 04/11] fix: removes print --- helm-charts/templates/trigger.yaml | 1 - helm-charts/values.yaml | 22 +- random.yaml | 328 +++++++++++++++++++++++++++++ 3 files changed, 339 insertions(+), 12 deletions(-) create mode 100644 random.yaml diff --git a/helm-charts/templates/trigger.yaml b/helm-charts/templates/trigger.yaml index 0c666382352..2b8bf6cf55a 100644 --- a/helm-charts/templates/trigger.yaml +++ b/helm-charts/templates/trigger.yaml @@ -89,7 +89,6 @@ stringData: {{- $secretObj := (lookup "v1" "Secret" .Release.Namespace (include "helm-charts.fullname" .)) | default dict }} {{- $secretData := (get $secretObj "data") | default dict }} {{ range $key, $value := $trigger.envVars }} - {{- println $key -}} {{- $default := get $requiredVars $key -}} {{- $current := get $secretData $key | b64dec -}} {{- $v := $value | default ($current | default $default) -}} diff --git a/helm-charts/values.yaml b/helm-charts/values.yaml index a5172e2191a..e3fe2685efe 100644 --- a/helm-charts/values.yaml +++ b/helm-charts/values.yaml @@ -104,17 +104,17 @@ trigger: affinity: {} envVars: - - ENCRYPTION_KEY: "" - - MAGIC_LINK_SECRET: "" - - SESSION_SECRET: "" - - LOGIN_ORIGIN: "" - - APP_ORIGIN: "" - - DIRECT_URL: "" - - FROM_EMAIL: "" - - REPLY_TO_EMAIL: "" - - RESEND_API_KEY: "" - - AUTH_GITHUB_CLIENT_ID: "" - - AUTH_GITHUB_CLIENT_SECRET: "" + ENCRYPTION_KEY: "" + MAGIC_LINK_SECRET: "" + SESSION_SECRET: "" + LOGIN_ORIGIN: "" + APP_ORIGIN: "" + DIRECT_URL: "" + FROM_EMAIL: "" + REPLY_TO_EMAIL: "" + RESEND_API_KEY: "" + AUTH_GITHUB_CLIENT_ID: "" + AUTH_GITHUB_CLIENT_SECRET: "" postgresql: enabled: true diff --git a/random.yaml b/random.yaml new file mode 100644 index 00000000000..948115ec817 --- /dev/null +++ b/random.yaml @@ -0,0 +1,328 @@ +--- +# Source: helm-charts/charts/postgresql/templates/secrets.yaml +apiVersion: v1 +kind: Secret +metadata: + name: release-name-postgresql + namespace: "default" + labels: + app.kubernetes.io/instance: release-name + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: postgresql + app.kubernetes.io/version: 16.0.0 + helm.sh/chart: postgresql-13.1.5 +type: Opaque +data: + postgres-password: "eXU4T1gzeTR4Uw==" + # We don't auto-generate LDAP password when it's not provided as we do for other passwords +--- +# Source: helm-charts/templates/trigger.yaml +apiVersion: v1 +kind: Secret +metadata: + name: release-name-helm-charts + annotations: + "helm.sh/resource-policy": "keep" +type: Opaque +stringData: + APP_ORIGIN: "" + AUTH_GITHUB_CLIENT_ID: "" + AUTH_GITHUB_CLIENT_SECRET: "" + DIRECT_URL: "postgresql://user:password@triggerdotdev-database:5432/dbname" + ENCRYPTION_KEY: "cigjfu6ggkgevzqdz39o0257zsk18ezx" + FROM_EMAIL: "" + LOGIN_ORIGIN: "" + MAGIC_LINK_SECRET: "obrj3zkpccsvcojja1dqionscrxpy5fw" + REPLY_TO_EMAIL: "" + RESEND_API_KEY: "" + SESSION_SECRET: "vgqsfdb5vg8pc6eonrquhvurxzfz4f1r" +--- +# Source: helm-charts/charts/postgresql/templates/primary/svc-headless.yaml +apiVersion: v1 +kind: Service +metadata: + name: release-name-postgresql-hl + namespace: "default" + labels: + app.kubernetes.io/instance: release-name + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: postgresql + app.kubernetes.io/version: 16.0.0 + helm.sh/chart: postgresql-13.1.5 + app.kubernetes.io/component: primary + annotations: + # Use this annotation in addition to the actual publishNotReadyAddresses + # field below because the annotation will stop being respected soon but the + # field is broken in some versions of Kubernetes: + # https://github.com/kubernetes/kubernetes/issues/58662 + service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" +spec: + type: ClusterIP + clusterIP: None + # We want all pods in the StatefulSet to have their addresses published for + # the sake of the other Postgresql pods even before they're ready, since they + # have to be able to talk to each other in order to become ready. + publishNotReadyAddresses: true + ports: + - name: tcp-postgresql + port: 5432 + targetPort: tcp-postgresql + selector: + app.kubernetes.io/instance: release-name + app.kubernetes.io/name: postgresql + app.kubernetes.io/component: primary +--- +# Source: helm-charts/charts/postgresql/templates/primary/svc.yaml +apiVersion: v1 +kind: Service +metadata: + name: release-name-postgresql + namespace: "default" + labels: + app.kubernetes.io/instance: release-name + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: postgresql + app.kubernetes.io/version: 16.0.0 + helm.sh/chart: postgresql-13.1.5 + app.kubernetes.io/component: primary +spec: + type: ClusterIP + sessionAffinity: None + ports: + - name: tcp-postgresql + port: 5432 + targetPort: tcp-postgresql + nodePort: null + selector: + app.kubernetes.io/instance: release-name + app.kubernetes.io/name: postgresql + app.kubernetes.io/component: primary +--- +# Source: helm-charts/templates/trigger.yaml +apiVersion: v1 +kind: Service +metadata: + name: release-name-helm-charts + labels: + helm.sh/chart: helm-charts-0.1.0 + app.kubernetes.io/name: helm-charts + app.kubernetes.io/instance: release-name + app.kubernetes.io/version: "1.16.0" + app.kubernetes.io/managed-by: Helm +spec: + type: NodePort + ports: + - port: 3030 + targetPort: 3030 + protocol: TCP + nodePort: 30002 + selector: + app.kubernetes.io/name: helm-charts + app.kubernetes.io/instance: release-name +--- +# Source: helm-charts/templates/trigger.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: release-name-helm-charts + labels: + helm.sh/chart: helm-charts-0.1.0 + app.kubernetes.io/name: helm-charts + app.kubernetes.io/instance: release-name + app.kubernetes.io/version: "1.16.0" + app.kubernetes.io/managed-by: Helm +spec: + replicas: 2 + selector: + matchLabels: + app.kubernetes.io/name: helm-charts + app.kubernetes.io/instance: release-name + template: + metadata: + labels: + helm.sh/chart: helm-charts-0.1.0 + app.kubernetes.io/name: helm-charts + app.kubernetes.io/instance: release-name + app.kubernetes.io/version: "1.16.0" + app.kubernetes.io/managed-by: Helm + spec: + serviceAccountName: release-name-helm-charts + securityContext: {} + containers: + - name: helm-charts + securityContext: {} + image: "ghcr.io/triggerdotdev/trigger.dev:latest" + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 3030 + protocol: TCP + readinessProbe: + httpGet: + path: / + port: http + envFrom: + - secretRef: + name: release-name-helm-charts +--- +# Source: helm-charts/charts/postgresql/templates/primary/statefulset.yaml +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: release-name-postgresql + namespace: "default" + labels: + app.kubernetes.io/instance: release-name + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: postgresql + app.kubernetes.io/version: 16.0.0 + helm.sh/chart: postgresql-13.1.5 + app.kubernetes.io/component: primary +spec: + replicas: 1 + serviceName: release-name-postgresql-hl + updateStrategy: + rollingUpdate: {} + type: RollingUpdate + selector: + matchLabels: + app.kubernetes.io/instance: release-name + app.kubernetes.io/name: postgresql + app.kubernetes.io/component: primary + template: + metadata: + name: release-name-postgresql + labels: + app.kubernetes.io/instance: release-name + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: postgresql + app.kubernetes.io/version: 16.0.0 + helm.sh/chart: postgresql-13.1.5 + app.kubernetes.io/component: primary + spec: + serviceAccountName: default + + affinity: + podAffinity: + + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchLabels: + app.kubernetes.io/instance: release-name + app.kubernetes.io/name: postgresql + app.kubernetes.io/component: primary + topologyKey: kubernetes.io/hostname + weight: 1 + nodeAffinity: + + securityContext: + fsGroup: 1001 + hostNetwork: false + hostIPC: false + containers: + - name: postgresql + image: docker.io/bitnami/postgresql:16.0.0-debian-11-r13 + imagePullPolicy: "IfNotPresent" + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + runAsGroup: 0 + runAsNonRoot: true + runAsUser: 1001 + seccompProfile: + type: RuntimeDefault + env: + - name: BITNAMI_DEBUG + value: "false" + - name: POSTGRESQL_PORT_NUMBER + value: "5432" + - name: POSTGRESQL_VOLUME_DIR + value: "/bitnami/postgresql" + - name: PGDATA + value: "/bitnami/postgresql/data" + # Authentication + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: release-name-postgresql + key: postgres-password + # Replication + # Initdb + # Standby + # LDAP + - name: POSTGRESQL_ENABLE_LDAP + value: "no" + # TLS + - name: POSTGRESQL_ENABLE_TLS + value: "no" + # Audit + - name: POSTGRESQL_LOG_HOSTNAME + value: "false" + - name: POSTGRESQL_LOG_CONNECTIONS + value: "false" + - name: POSTGRESQL_LOG_DISCONNECTIONS + value: "false" + - name: POSTGRESQL_PGAUDIT_LOG_CATALOG + value: "off" + # Others + - name: POSTGRESQL_CLIENT_MIN_MESSAGES + value: "error" + - name: POSTGRESQL_SHARED_PRELOAD_LIBRARIES + value: "pgaudit" + ports: + - name: tcp-postgresql + containerPort: 5432 + livenessProbe: + failureThreshold: 6 + initialDelaySeconds: 30 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + exec: + command: + - /bin/sh + - -c + - exec pg_isready -U "postgres" -h 127.0.0.1 -p 5432 + readinessProbe: + failureThreshold: 6 + initialDelaySeconds: 5 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + exec: + command: + - /bin/sh + - -c + - -e + - | + exec pg_isready -U "postgres" -h 127.0.0.1 -p 5432 + [ -f /opt/bitnami/postgresql/tmp/.initialized ] || [ -f /bitnami/postgresql/.initialized ] + resources: + limits: {} + requests: + cpu: 250m + memory: 256Mi + volumeMounts: + - name: dshm + mountPath: /dev/shm + - name: data + mountPath: /bitnami/postgresql + volumes: + - name: dshm + emptyDir: + medium: Memory + volumeClaimTemplates: + - apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: data + spec: + accessModes: + - "ReadWriteOnce" + resources: + requests: + storage: "8Gi" From 8a9de1c952b03722f470f68c363aaadd24bf55c7 Mon Sep 17 00:00:00 2001 From: Ronit Panda Date: Wed, 18 Oct 2023 11:00:46 +0530 Subject: [PATCH 05/11] fix: image pulling issue --- helm-charts/templates/trigger.yaml | 2 +- helm-charts/values.yaml | 2 +- random.yaml | 328 ----------------------------- 3 files changed, 2 insertions(+), 330 deletions(-) delete mode 100644 random.yaml diff --git a/helm-charts/templates/trigger.yaml b/helm-charts/templates/trigger.yaml index 2b8bf6cf55a..1e284e125dd 100644 --- a/helm-charts/templates/trigger.yaml +++ b/helm-charts/templates/trigger.yaml @@ -47,7 +47,7 @@ spec: port: http envFrom: - secretRef: - name: {{ $trigger.kubeSecretRef | default (include "helm-charts.fullname" .) }} + name: {{ $trigger.kubeSecretRef | default (include "helm-charts.fullname" .) }} {{- if $trigger.resources }} resources: {{- toYaml $trigger.resources | nindent 12 }} {{- end }} diff --git a/helm-charts/values.yaml b/helm-charts/values.yaml index e3fe2685efe..a64013a62d0 100644 --- a/helm-charts/values.yaml +++ b/helm-charts/values.yaml @@ -2,7 +2,7 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. trigger: - replicaCount: 2 + replicaCount: 1 image: repository: ghcr.io/triggerdotdev/trigger.dev diff --git a/random.yaml b/random.yaml deleted file mode 100644 index 948115ec817..00000000000 --- a/random.yaml +++ /dev/null @@ -1,328 +0,0 @@ ---- -# Source: helm-charts/charts/postgresql/templates/secrets.yaml -apiVersion: v1 -kind: Secret -metadata: - name: release-name-postgresql - namespace: "default" - labels: - app.kubernetes.io/instance: release-name - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: postgresql - app.kubernetes.io/version: 16.0.0 - helm.sh/chart: postgresql-13.1.5 -type: Opaque -data: - postgres-password: "eXU4T1gzeTR4Uw==" - # We don't auto-generate LDAP password when it's not provided as we do for other passwords ---- -# Source: helm-charts/templates/trigger.yaml -apiVersion: v1 -kind: Secret -metadata: - name: release-name-helm-charts - annotations: - "helm.sh/resource-policy": "keep" -type: Opaque -stringData: - APP_ORIGIN: "" - AUTH_GITHUB_CLIENT_ID: "" - AUTH_GITHUB_CLIENT_SECRET: "" - DIRECT_URL: "postgresql://user:password@triggerdotdev-database:5432/dbname" - ENCRYPTION_KEY: "cigjfu6ggkgevzqdz39o0257zsk18ezx" - FROM_EMAIL: "" - LOGIN_ORIGIN: "" - MAGIC_LINK_SECRET: "obrj3zkpccsvcojja1dqionscrxpy5fw" - REPLY_TO_EMAIL: "" - RESEND_API_KEY: "" - SESSION_SECRET: "vgqsfdb5vg8pc6eonrquhvurxzfz4f1r" ---- -# Source: helm-charts/charts/postgresql/templates/primary/svc-headless.yaml -apiVersion: v1 -kind: Service -metadata: - name: release-name-postgresql-hl - namespace: "default" - labels: - app.kubernetes.io/instance: release-name - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: postgresql - app.kubernetes.io/version: 16.0.0 - helm.sh/chart: postgresql-13.1.5 - app.kubernetes.io/component: primary - annotations: - # Use this annotation in addition to the actual publishNotReadyAddresses - # field below because the annotation will stop being respected soon but the - # field is broken in some versions of Kubernetes: - # https://github.com/kubernetes/kubernetes/issues/58662 - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" -spec: - type: ClusterIP - clusterIP: None - # We want all pods in the StatefulSet to have their addresses published for - # the sake of the other Postgresql pods even before they're ready, since they - # have to be able to talk to each other in order to become ready. - publishNotReadyAddresses: true - ports: - - name: tcp-postgresql - port: 5432 - targetPort: tcp-postgresql - selector: - app.kubernetes.io/instance: release-name - app.kubernetes.io/name: postgresql - app.kubernetes.io/component: primary ---- -# Source: helm-charts/charts/postgresql/templates/primary/svc.yaml -apiVersion: v1 -kind: Service -metadata: - name: release-name-postgresql - namespace: "default" - labels: - app.kubernetes.io/instance: release-name - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: postgresql - app.kubernetes.io/version: 16.0.0 - helm.sh/chart: postgresql-13.1.5 - app.kubernetes.io/component: primary -spec: - type: ClusterIP - sessionAffinity: None - ports: - - name: tcp-postgresql - port: 5432 - targetPort: tcp-postgresql - nodePort: null - selector: - app.kubernetes.io/instance: release-name - app.kubernetes.io/name: postgresql - app.kubernetes.io/component: primary ---- -# Source: helm-charts/templates/trigger.yaml -apiVersion: v1 -kind: Service -metadata: - name: release-name-helm-charts - labels: - helm.sh/chart: helm-charts-0.1.0 - app.kubernetes.io/name: helm-charts - app.kubernetes.io/instance: release-name - app.kubernetes.io/version: "1.16.0" - app.kubernetes.io/managed-by: Helm -spec: - type: NodePort - ports: - - port: 3030 - targetPort: 3030 - protocol: TCP - nodePort: 30002 - selector: - app.kubernetes.io/name: helm-charts - app.kubernetes.io/instance: release-name ---- -# Source: helm-charts/templates/trigger.yaml -apiVersion: apps/v1 -kind: Deployment -metadata: - name: release-name-helm-charts - labels: - helm.sh/chart: helm-charts-0.1.0 - app.kubernetes.io/name: helm-charts - app.kubernetes.io/instance: release-name - app.kubernetes.io/version: "1.16.0" - app.kubernetes.io/managed-by: Helm -spec: - replicas: 2 - selector: - matchLabels: - app.kubernetes.io/name: helm-charts - app.kubernetes.io/instance: release-name - template: - metadata: - labels: - helm.sh/chart: helm-charts-0.1.0 - app.kubernetes.io/name: helm-charts - app.kubernetes.io/instance: release-name - app.kubernetes.io/version: "1.16.0" - app.kubernetes.io/managed-by: Helm - spec: - serviceAccountName: release-name-helm-charts - securityContext: {} - containers: - - name: helm-charts - securityContext: {} - image: "ghcr.io/triggerdotdev/trigger.dev:latest" - imagePullPolicy: IfNotPresent - ports: - - name: http - containerPort: 3030 - protocol: TCP - readinessProbe: - httpGet: - path: / - port: http - envFrom: - - secretRef: - name: release-name-helm-charts ---- -# Source: helm-charts/charts/postgresql/templates/primary/statefulset.yaml -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: release-name-postgresql - namespace: "default" - labels: - app.kubernetes.io/instance: release-name - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: postgresql - app.kubernetes.io/version: 16.0.0 - helm.sh/chart: postgresql-13.1.5 - app.kubernetes.io/component: primary -spec: - replicas: 1 - serviceName: release-name-postgresql-hl - updateStrategy: - rollingUpdate: {} - type: RollingUpdate - selector: - matchLabels: - app.kubernetes.io/instance: release-name - app.kubernetes.io/name: postgresql - app.kubernetes.io/component: primary - template: - metadata: - name: release-name-postgresql - labels: - app.kubernetes.io/instance: release-name - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: postgresql - app.kubernetes.io/version: 16.0.0 - helm.sh/chart: postgresql-13.1.5 - app.kubernetes.io/component: primary - spec: - serviceAccountName: default - - affinity: - podAffinity: - - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - podAffinityTerm: - labelSelector: - matchLabels: - app.kubernetes.io/instance: release-name - app.kubernetes.io/name: postgresql - app.kubernetes.io/component: primary - topologyKey: kubernetes.io/hostname - weight: 1 - nodeAffinity: - - securityContext: - fsGroup: 1001 - hostNetwork: false - hostIPC: false - containers: - - name: postgresql - image: docker.io/bitnami/postgresql:16.0.0-debian-11-r13 - imagePullPolicy: "IfNotPresent" - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - runAsGroup: 0 - runAsNonRoot: true - runAsUser: 1001 - seccompProfile: - type: RuntimeDefault - env: - - name: BITNAMI_DEBUG - value: "false" - - name: POSTGRESQL_PORT_NUMBER - value: "5432" - - name: POSTGRESQL_VOLUME_DIR - value: "/bitnami/postgresql" - - name: PGDATA - value: "/bitnami/postgresql/data" - # Authentication - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: release-name-postgresql - key: postgres-password - # Replication - # Initdb - # Standby - # LDAP - - name: POSTGRESQL_ENABLE_LDAP - value: "no" - # TLS - - name: POSTGRESQL_ENABLE_TLS - value: "no" - # Audit - - name: POSTGRESQL_LOG_HOSTNAME - value: "false" - - name: POSTGRESQL_LOG_CONNECTIONS - value: "false" - - name: POSTGRESQL_LOG_DISCONNECTIONS - value: "false" - - name: POSTGRESQL_PGAUDIT_LOG_CATALOG - value: "off" - # Others - - name: POSTGRESQL_CLIENT_MIN_MESSAGES - value: "error" - - name: POSTGRESQL_SHARED_PRELOAD_LIBRARIES - value: "pgaudit" - ports: - - name: tcp-postgresql - containerPort: 5432 - livenessProbe: - failureThreshold: 6 - initialDelaySeconds: 30 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 5 - exec: - command: - - /bin/sh - - -c - - exec pg_isready -U "postgres" -h 127.0.0.1 -p 5432 - readinessProbe: - failureThreshold: 6 - initialDelaySeconds: 5 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 5 - exec: - command: - - /bin/sh - - -c - - -e - - | - exec pg_isready -U "postgres" -h 127.0.0.1 -p 5432 - [ -f /opt/bitnami/postgresql/tmp/.initialized ] || [ -f /bitnami/postgresql/.initialized ] - resources: - limits: {} - requests: - cpu: 250m - memory: 256Mi - volumeMounts: - - name: dshm - mountPath: /dev/shm - - name: data - mountPath: /bitnami/postgresql - volumes: - - name: dshm - emptyDir: - medium: Memory - volumeClaimTemplates: - - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: data - spec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: "8Gi" From b047fe4397baf76fafbfe03bdcac7b898db32fe6 Mon Sep 17 00:00:00 2001 From: Ronit Panda Date: Wed, 18 Oct 2023 16:44:36 +0530 Subject: [PATCH 06/11] fix: templatisation complete --- helm-charts/Chart.yaml | 2 +- helm-charts/templates/_helpers.tpl | 87 ++++---- helm-charts/templates/trigger.yaml | 64 +++--- helm-charts/values.yaml | 346 +++++++++++++++++++---------- random.yaml | 335 ++++++++++++++++++++++++++++ 5 files changed, 641 insertions(+), 193 deletions(-) create mode 100644 random.yaml diff --git a/helm-charts/Chart.yaml b/helm-charts/Chart.yaml index 3c829e742fd..aa3f665adb0 100644 --- a/helm-charts/Chart.yaml +++ b/helm-charts/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: helm-charts +name: trigger description: A Helm chart for a full Trigger application stack # A chart can be either an 'application' or a 'library' chart. diff --git a/helm-charts/templates/_helpers.tpl b/helm-charts/templates/_helpers.tpl index bf88c1a00a9..4792c1f6168 100644 --- a/helm-charts/templates/_helpers.tpl +++ b/helm-charts/templates/_helpers.tpl @@ -1,62 +1,55 @@ {{/* Expand the name of the chart. */}} -{{- define "helm-charts.name" -}} -{{- default .Chart.Name .Values.trigger.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 "helm-charts.fullname" -}} -{{- if .Values.trigger.fullnameOverride }} -{{- .Values.trigger.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.trigger.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} +{{- define "trigger.name" -}} +{{- default .Chart.Name | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Create chart name and version as used by the chart label. */}} -{{- define "helm-charts.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} +{{- define "trigger.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} {{/* -Common labels +Create unified labels for trigger components */}} -{{- define "helm-charts.labels" -}} -helm.sh/chart: {{ include "helm-charts.chart" . }} -{{ include "helm-charts.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} +{{- define "trigger.common.matchLabels" -}} +app: {{ template "trigger.name" . }} +release: {{ .Release.Name }} +{{- end -}} + +{{- define "trigger.common.metaLabels" -}} +chart: {{ template "trigger.chart" . }} +heritage: {{ .Release.Service }} +{{- end -}} + +{{- define "trigger.common.labels" -}} +{{ include "trigger.common.matchLabels" . }} +{{ include "trigger.common.metaLabels" . }} +{{- end -}} + +{{- define "trigger.labels" -}} +{{ include "trigger.matchLabels" . }} +{{ include "trigger.common.metaLabels" . }} +{{- end -}} + +{{- define "trigger.matchLabels" -}} +component: {{ .Values.trigger.name | quote }} +{{ include "trigger.common.matchLabels" . }} +{{- end -}} -{{/* -Selector labels -*/}} -{{- define "helm-charts.selectorLabels" -}} -app.kubernetes.io/name: {{ include "helm-charts.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} {{/* -Create the name of the service account to use +Create the mongodb connection string. */}} -{{- define "helm-charts.serviceAccountName" -}} -{{- if .Values.trigger.serviceAccount.create }} -{{- default (include "helm-charts.fullname" .) .Values.trigger.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.trigger.serviceAccount.name }} -{{- end }} -{{- end }} +{{- define "trigger.postgresql.connectionString" -}} +{{- $host := "triggerdotdev" -}} +{{- $port := 5432 -}} +{{- $username := .Values.postgresql.global.postgresql.postgresqlUsername | default "postgres" -}} +{{- $password := .Values.postgresql.global.postgresql.postgresqlPassword | default "password" -}} +{{- $database := .Values.postgresql.global.postgresql.postgresqlDatabase | default "trigger" -}} +{{- $connectionString := printf "postgresql://%s:%s@%s:%d/%s" $username $password $host $port $database -}} +{{- printf "%s" $connectionString -}} +{{- end -}} \ No newline at end of file diff --git a/helm-charts/templates/trigger.yaml b/helm-charts/templates/trigger.yaml index 1e284e125dd..711fa570304 100644 --- a/helm-charts/templates/trigger.yaml +++ b/helm-charts/templates/trigger.yaml @@ -2,39 +2,35 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "helm-charts.fullname" . }} + name: {{ include "trigger.name" . }} + annotations: + updatedAt: {{ now | date "2006-01-01 MST 15:04:05" | quote }} + {{- with $trigger.deploymentAnnotations }} + {{- toYaml . | nindent 4 }} + {{- end }} labels: - {{- include "helm-charts.labels" . | nindent 4 }} + {{- include "trigger.labels" . | nindent 4 }} spec: - {{- if not $trigger.autoscaling.enabled }} replicas: {{ $trigger.replicaCount }} - {{- end }} selector: matchLabels: - {{- include "helm-charts.selectorLabels" . | nindent 6 }} + {{- include "trigger.matchLabels" . | nindent 6 }} template: metadata: - {{- with $trigger.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} labels: - {{- include "helm-charts.labels" . | nindent 8 }} - {{- with $trigger.podLabels }} + {{- include "trigger.matchLabels" . | nindent 8 }} + annotations: + updatedAt: {{ now | date "2006-01-01 MST 15:04:05" | quote }} + {{- with $trigger.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} spec: - {{- with $trigger.imagePullSecrets }} - imagePullSecrets: + {{- with $trigger.affinity }} + affinity: {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "helm-charts.serviceAccountName" . }} - securityContext: - {{- toYaml $trigger.podSecurityContext | nindent 8 }} + {{- end }} containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml $trigger.securityContext | nindent 12 }} + - name: {{ $trigger.name }} image: "{{ $trigger.image.repository }}:{{ $trigger.image.tag | default "latest" }}" imagePullPolicy: {{ $trigger.image.pullPolicy }} ports: @@ -47,20 +43,26 @@ spec: port: http envFrom: - secretRef: - name: {{ $trigger.kubeSecretRef | default (include "helm-charts.fullname" .) }} - {{- if $trigger.resources }} - resources: {{- toYaml $trigger.resources | nindent 12 }} - {{- end }} + name: {{ $trigger.kubeSecretRef | default (include "trigger.name" .) }} + {{- if $trigger.resources }} + resources: {{- toYaml $trigger.resources | nindent 12 }} + {{- end }} --- apiVersion: v1 kind: Service metadata: - name: {{ include "helm-charts.fullname" . }} + name: {{ include "trigger.name" . }} labels: - {{- include "helm-charts.labels" . | nindent 4 }} + {{- include "trigger.labels" . | nindent 4 }} + {{- with $trigger.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: type: {{ $trigger.service.type }} + selector: + {{- include "trigger.matchLabels" . | nindent 8 }} ports: - port: 3030 targetPort: 3030 @@ -68,8 +70,6 @@ spec: {{- if eq $trigger.service.type "NodePort" }} nodePort: {{ $trigger.service.nodePort }} {{- end }} - selector: - {{- include "helm-charts.selectorLabels" . | nindent 4 }} --- @@ -77,7 +77,7 @@ spec: apiVersion: v1 kind: Secret metadata: - name: {{ include "helm-charts.fullname" . }} + name: {{ include "trigger.name" . }} annotations: "helm.sh/resource-policy": "keep" type: Opaque @@ -85,10 +85,10 @@ stringData: {{- $requiredVars := dict "MAGIC_LINK_SECRET" (randAlphaNum 32 | lower) "SESSION_SECRET" (randAlphaNum 32 | lower) "ENCRYPTION_KEY" (randAlphaNum 32 | lower) - "DIRECT_URL" ("postgresql://user:password@triggerdotdev-database:5432/dbname") }} - {{- $secretObj := (lookup "v1" "Secret" .Release.Namespace (include "helm-charts.fullname" .)) | default dict }} + "DIRECT_URL" (include "trigger.postgresql.connectionString" .) }} + {{- $secretObj := (lookup "v1" "Secret" .Release.Namespace (include "trigger.name" .)) | default dict }} {{- $secretData := (get $secretObj "data") | default dict }} - {{ range $key, $value := $trigger.envVars }} + {{ range $key, $value := .Values.envVars }} {{- $default := get $requiredVars $key -}} {{- $current := get $secretData $key | b64dec -}} {{- $v := $value | default ($current | default $default) -}} diff --git a/helm-charts/values.yaml b/helm-charts/values.yaml index a64013a62d0..c99d4b7411a 100644 --- a/helm-charts/values.yaml +++ b/helm-charts/values.yaml @@ -2,125 +2,245 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. trigger: - replicaCount: 1 - + ## @param trigger.name + name: trigger + ## @param trigger.podAnnotations trigger pod annotations + ## + podAnnotations: {} + ## @param trigger.deploymentAnnotations trigger deployment annotations + ## + deploymentAnnotations: {} + ## @param trigger.replicaCount trigger replica count + ## + replicaCount: 2 + ## trigger image parameters + ## image: + ## @param trigger.image.repository trigger image repository + ## repository: ghcr.io/triggerdotdev/trigger.dev - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. + ## @param trigger.image.tag trigger image tag + ## tag: "latest" - - kubeSecretRef: "" - - imagePullSecrets: [] - nameOverride: "" - fullnameOverride: "" - - serviceAccount: - # Specifies whether a service account should be created - create: true - # Automatically mount a ServiceAccount's API credentials? - automount: true - # Annotations to add to the service account - annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: "" - - podAnnotations: {} - podLabels: {} - - podSecurityContext: - {} - # fsGroup: 2000 - - securityContext: - {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - - service: - type: NodePort - nodePort: 30002 - - 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 - + ## @param trigger.image.pullPolicy trigger image pullPolicy + ## + pullPolicy: Always + ## @param trigger.resources.limits.memory container memory limit [check the offical kubernetes documentations](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) + ## @param trigger.resources.requests.cpu container CPU request [check the offical kubernetes documentations](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) + ## 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:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - - autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - - # Additional volumes on the output Deployment definition. - volumes: [] - # - name: foo - # secret: - # secretName: mysecret - # optional: false - - # Additional volumeMounts on the output Deployment definition. - volumeMounts: [] - # - name: foo - # mountPath: "/etc/foo" - # readOnly: true - - nodeSelector: {} - - tolerations: [] - + limits: + memory: 200Mi + requests: + cpu: 150m + ## @param trigger.affinity Backend pod affinity + ## affinity: {} - - envVars: - ENCRYPTION_KEY: "" - MAGIC_LINK_SECRET: "" - SESSION_SECRET: "" - LOGIN_ORIGIN: "" - APP_ORIGIN: "" - DIRECT_URL: "" - FROM_EMAIL: "" - REPLY_TO_EMAIL: "" - RESEND_API_KEY: "" - AUTH_GITHUB_CLIENT_ID: "" - AUTH_GITHUB_CLIENT_SECRET: "" + ## @param trigger.kubeSecretRef trigger secret resource reference name + ## + kubeSecretRef: "" + ## trigger service + ## + service: + ## @param trigger.service.annotations trigger service annotations + ## + annotations: {} + ## @param trigger.service.type trigger service type + ## + type: ClusterIP + ## @param trigger.service.nodePort trigger service nodePort (used if above type is `NodePort`) + ## + nodePort: "" + +## trigger environment variables configuration +envVars: + ENCRYPTION_KEY: "" + MAGIC_LINK_SECRET: "" + SESSION_SECRET: "" + LOGIN_ORIGIN: "" + APP_ORIGIN: "" + DIRECT_URL: "" + FROM_EMAIL: "" + REPLY_TO_EMAIL: "" + RESEND_API_KEY: "" + AUTH_GITHUB_CLIENT_ID: "" + AUTH_GITHUB_CLIENT_SECRET: "" + +## @section Postgresql(®) parameters +## Documentation : https://github.com/bitnami/charts/tree/main/bitnami/postgresql-ha +## + +# global: +# postgresql: +# postgresqlDatabase: "trigger" +# postgresqlPassword: "password" +# postgresqlUsername: "postgres" +# servicePort: "5432" postgresql: - enabled: true global: postgresql: - postgresqlDatabase: "dbname" - postgresqlPassword: "password" - postgresqlUsername: "user" - servicePort: "5432" + ## @param global.postgresql.auth.postgresPassword Password for the "postgres" admin user (overrides `auth.postgresPassword`) + ## @param global.postgresql.auth.username Name for a custom user to create (overrides `auth.username`) + ## @param global.postgresql.auth.password Password for the custom user to create (overrides `auth.password`) + ## @param global.postgresql.auth.database Name for a custom database to create (overrides `auth.database`) + ## @param global.postgresql.auth.existingSecret Name of existing secret to use for PostgreSQL credentials (overrides `auth.existingSecret`). + ## @param global.postgresql.auth.secretKeys.adminPasswordKey Name of key in existing secret to use for PostgreSQL credentials (overrides `auth.secretKeys.adminPasswordKey`). Only used when `global.postgresql.auth.existingSecret` is set. + ## @param global.postgresql.auth.secretKeys.userPasswordKey Name of key in existing secret to use for PostgreSQL credentials (overrides `auth.secretKeys.userPasswordKey`). Only used when `global.postgresql.auth.existingSecret` is set. + ## @param global.postgresql.auth.secretKeys.replicationPasswordKey Name of key in existing secret to use for PostgreSQL credentials (overrides `auth.secretKeys.replicationPasswordKey`). Only used when `global.postgresql.auth.existingSecret` is set. + ## + auth: + postgresPassword: "password" + username: "postgres" + password: "password" + database: "trigger" + ## @param global.postgresql.service.ports.postgresql PostgreSQL service port (overrides `service.ports.postgresql`) + ## + service: + ports: + postgresql: "5432" + + ## @section Common parameters + ## + nameOverride: "postgresql" + ## @param fullnameOverride String to fully override common.names.fullname template + ## + fullnameOverride: "postgresql" + + ## @section PostgreSQL common parameters + ## + + ## Bitnami PostgreSQL image version + ## ref: https://hub.docker.com/r/bitnami/postgresql/tags/ + ## @param image.registry PostgreSQL image registry + ## @param image.repository PostgreSQL image repository + ## @param image.tag PostgreSQL image tag (immutable tags are recommended) + ## @param image.digest PostgreSQL image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag + ## @param image.pullPolicy PostgreSQL image pull policy + ## @param image.pullSecrets Specify image pull secrets + ## @param image.debug Specify if debug values should be set + ## + image: + registry: docker.io + repository: bitnami/postgresql + tag: 16.0.0-debian-11-r13 + + architecture: standalone + ## Replication configuration + ## Ignored if `architecture` is `standalone` + ## + ## @param containerPorts.postgresql PostgreSQL container port + ## + containerPorts: + postgresql: 5432 + + postgresqlDataDir: /bitnami/postgresql/data + ## @param postgresqlSharedPreloadLibraries Shared preload libraries (comma-separated list) + ## + postgresqlSharedPreloadLibraries: "pgaudit" + ## Start PostgreSQL pod(s) without limitations on shm memory. + ## By default docker and containerd (and possibly other container runtimes) limit `/dev/shm` to `64M` + ## ref: https://github.com/docker-library/postgres/issues/416 + ## ref: https://github.com/containerd/containerd/issues/3654 + ## + shmVolume: + ## @param shmVolume.enabled Enable emptyDir volume for /dev/shm for PostgreSQL pod(s) + ## + enabled: true + ## @param shmVolume.sizeLimit Set this to enable a size limit on the shm tmpfs + ## Note: the size of the tmpfs counts against container's memory limit + ## e.g: + ## sizeLimit: 1Gi + ## + sizeLimit: "" + ## TLS configuration + ## + tls: + ## @param tls.enabled Enable TLS traffic support + ## + enabled: false + ## @param tls.autoGenerated Generate automatically self-signed TLS certificates + ## + autoGenerated: false + ## @param tls.preferServerCiphers Whether to use the server's TLS cipher preferences rather than the client's + ## + preferServerCiphers: true + ## @param tls.certificatesSecret Name of an existing secret that contains the certificates + ## + certificatesSecret: "" + ## @param tls.certFilename Certificate filename + ## + certFilename: "" + ## @param tls.certKeyFilename Certificate key filename + ## + certKeyFilename: "" + ## @param tls.certCAFilename CA Certificate filename + ## If provided, PostgreSQL will authenticate TLS/SSL clients by requesting them a certificate + ## ref: https://www.postgresql.org/docs/9.6/auth-methods.html + ## + certCAFilename: "" + ## @param tls.crlFilename File containing a Certificate Revocation List + ## + crlFilename: "" + + ## @section PostgreSQL Primary parameters + ## + primary: + ## Configure extra options for PostgreSQL Primary containers' liveness, readiness and startup probes + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes + ## @param primary.livenessProbe.enabled Enable livenessProbe on PostgreSQL Primary containers + ## @param primary.livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe + ## @param primary.livenessProbe.periodSeconds Period seconds for livenessProbe + ## @param primary.livenessProbe.timeoutSeconds Timeout seconds for livenessProbe + ## @param primary.livenessProbe.failureThreshold Failure threshold for livenessProbe + ## @param primary.livenessProbe.successThreshold Success threshold for livenessProbe + ## + livenessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + ## @param primary.readinessProbe.enabled Enable readinessProbe on PostgreSQL Primary containers + ## @param primary.readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe + ## @param primary.readinessProbe.periodSeconds Period seconds for readinessProbe + ## @param primary.readinessProbe.timeoutSeconds Timeout seconds for readinessProbe + ## @param primary.readinessProbe.failureThreshold Failure threshold for readinessProbe + ## @param primary.readinessProbe.successThreshold Success threshold for readinessProbe + ## + readinessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + ## @param primary.startupProbe.enabled Enable startupProbe on PostgreSQL Primary containers + ## @param primary.startupProbe.initialDelaySeconds Initial delay seconds for startupProbe + ## @param primary.startupProbe.periodSeconds Period seconds for startupProbe + ## @param primary.startupProbe.timeoutSeconds Timeout seconds for startupProbe + ## @param primary.startupProbe.failureThreshold Failure threshold for startupProbe + ## @param primary.startupProbe.successThreshold Success threshold for startupProbe + ## + startupProbe: + enabled: false + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 15 + successThreshold: 1 + persistence: + ## @param primary.persistence.enabled Enable PostgreSQL Primary data persistence using PVC + ## + enabled: true + ## @param primary.persistence.existingClaim Name of an existing PVC to use + ## + existingClaim: "" + ## @param primary.persistence.accessModes PVC Access Mode for PostgreSQL volume + ## + accessModes: + - ReadWriteOnce + ## @param primary.persistence.size PVC Storage Request for PostgreSQL volume + ## + size: 8Gi diff --git a/random.yaml b/random.yaml new file mode 100644 index 00000000000..990223936f0 --- /dev/null +++ b/random.yaml @@ -0,0 +1,335 @@ +--- +# Source: trigger/charts/postgresql/templates/secrets.yaml +apiVersion: v1 +kind: Secret +metadata: + name: postgresql + namespace: "default" + labels: + app.kubernetes.io/instance: release-name + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: postgresql + app.kubernetes.io/version: 16.0.0 + helm.sh/chart: postgresql-13.1.5 +type: Opaque +data: + postgres-password: "cGFzc3dvcmQ=" + # We don't auto-generate LDAP password when it's not provided as we do for other passwords +--- +# Source: trigger/templates/trigger.yaml +apiVersion: v1 +kind: Secret +metadata: + name: trigger + annotations: + "helm.sh/resource-policy": "keep" +type: Opaque +stringData: + APP_ORIGIN: "" + AUTH_GITHUB_CLIENT_ID: "" + AUTH_GITHUB_CLIENT_SECRET: "" + DIRECT_URL: "postgresql://postgres:password@triggerdotdev:5432/trigger" + ENCRYPTION_KEY: "yiciifbjhaseyiqkjdlwuyhgpk2eaewk" + FROM_EMAIL: "" + LOGIN_ORIGIN: "" + MAGIC_LINK_SECRET: "wjt45vknogeaffifllaklkwgmaackyg3" + REPLY_TO_EMAIL: "" + RESEND_API_KEY: "" + SESSION_SECRET: "ur1vchzkjvcjdwzimohu9zdlkmaf1ozr" +--- +# Source: trigger/charts/postgresql/templates/primary/svc-headless.yaml +apiVersion: v1 +kind: Service +metadata: + name: postgresql-hl + namespace: "default" + labels: + app.kubernetes.io/instance: release-name + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: postgresql + app.kubernetes.io/version: 16.0.0 + helm.sh/chart: postgresql-13.1.5 + app.kubernetes.io/component: primary + annotations: + # Use this annotation in addition to the actual publishNotReadyAddresses + # field below because the annotation will stop being respected soon but the + # field is broken in some versions of Kubernetes: + # https://github.com/kubernetes/kubernetes/issues/58662 + service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" +spec: + type: ClusterIP + clusterIP: None + # We want all pods in the StatefulSet to have their addresses published for + # the sake of the other Postgresql pods even before they're ready, since they + # have to be able to talk to each other in order to become ready. + publishNotReadyAddresses: true + ports: + - name: tcp-postgresql + port: 5432 + targetPort: tcp-postgresql + selector: + app.kubernetes.io/instance: release-name + app.kubernetes.io/name: postgresql + app.kubernetes.io/component: primary +--- +# Source: trigger/charts/postgresql/templates/primary/svc.yaml +apiVersion: v1 +kind: Service +metadata: + name: postgresql + namespace: "default" + labels: + app.kubernetes.io/instance: release-name + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: postgresql + app.kubernetes.io/version: 16.0.0 + helm.sh/chart: postgresql-13.1.5 + app.kubernetes.io/component: primary +spec: + type: ClusterIP + sessionAffinity: None + ports: + - name: tcp-postgresql + port: 5432 + targetPort: tcp-postgresql + nodePort: null + selector: + app.kubernetes.io/instance: release-name + app.kubernetes.io/name: postgresql + app.kubernetes.io/component: primary +--- +# Source: trigger/templates/trigger.yaml +apiVersion: v1 +kind: Service +metadata: + name: trigger + labels: + component: "trigger" + app: trigger + release: release-name + chart: trigger-0.1.0 + heritage: Helm +spec: + type: ClusterIP + selector: + component: "trigger" + app: trigger + release: release-name + ports: + - port: 3030 + targetPort: 3030 + protocol: TCP +--- +# Source: trigger/templates/trigger.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: trigger + annotations: + updatedAt: "2023-10-10 IST 16:43:56" + labels: + component: "trigger" + app: trigger + release: release-name + chart: trigger-0.1.0 + heritage: Helm +spec: + replicas: 2 + selector: + matchLabels: + component: "trigger" + app: trigger + release: release-name + template: + metadata: + labels: + component: "trigger" + app: trigger + release: release-name + annotations: + updatedAt: "2023-10-10 IST 16:43:56" + spec: + containers: + - name: trigger + image: "ghcr.io/triggerdotdev/trigger.dev:latest" + imagePullPolicy: Always + ports: + - name: http + containerPort: 3030 + protocol: TCP + readinessProbe: + httpGet: + path: / + port: http + envFrom: + - secretRef: + name: trigger + resources: + limits: + memory: 200Mi + requests: + cpu: 150m +--- +# Source: trigger/charts/postgresql/templates/primary/statefulset.yaml +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: postgresql + namespace: "default" + labels: + app.kubernetes.io/instance: release-name + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: postgresql + app.kubernetes.io/version: 16.0.0 + helm.sh/chart: postgresql-13.1.5 + app.kubernetes.io/component: primary +spec: + replicas: 1 + serviceName: postgresql-hl + updateStrategy: + rollingUpdate: {} + type: RollingUpdate + selector: + matchLabels: + app.kubernetes.io/instance: release-name + app.kubernetes.io/name: postgresql + app.kubernetes.io/component: primary + template: + metadata: + name: postgresql + labels: + app.kubernetes.io/instance: release-name + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: postgresql + app.kubernetes.io/version: 16.0.0 + helm.sh/chart: postgresql-13.1.5 + app.kubernetes.io/component: primary + spec: + serviceAccountName: default + + affinity: + podAffinity: + + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchLabels: + app.kubernetes.io/instance: release-name + app.kubernetes.io/name: postgresql + app.kubernetes.io/component: primary + topologyKey: kubernetes.io/hostname + weight: 1 + nodeAffinity: + + securityContext: + fsGroup: 1001 + hostNetwork: false + hostIPC: false + containers: + - name: postgresql + image: docker.io/bitnami/postgresql:16.0.0-debian-11-r13 + imagePullPolicy: "IfNotPresent" + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + runAsGroup: 0 + runAsNonRoot: true + runAsUser: 1001 + seccompProfile: + type: RuntimeDefault + env: + - name: BITNAMI_DEBUG + value: "false" + - name: POSTGRESQL_PORT_NUMBER + value: "5432" + - name: POSTGRESQL_VOLUME_DIR + value: "/bitnami/postgresql" + - name: PGDATA + value: "/bitnami/postgresql/data" + # Authentication + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: postgresql + key: postgres-password + - name: POSTGRES_DATABASE + value: "trigger" + # Replication + # Initdb + # Standby + # LDAP + - name: POSTGRESQL_ENABLE_LDAP + value: "no" + # TLS + - name: POSTGRESQL_ENABLE_TLS + value: "no" + # Audit + - name: POSTGRESQL_LOG_HOSTNAME + value: "false" + - name: POSTGRESQL_LOG_CONNECTIONS + value: "false" + - name: POSTGRESQL_LOG_DISCONNECTIONS + value: "false" + - name: POSTGRESQL_PGAUDIT_LOG_CATALOG + value: "off" + # Others + - name: POSTGRESQL_CLIENT_MIN_MESSAGES + value: "error" + - name: POSTGRESQL_SHARED_PRELOAD_LIBRARIES + value: "pgaudit" + ports: + - name: tcp-postgresql + containerPort: 5432 + livenessProbe: + failureThreshold: 6 + initialDelaySeconds: 30 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + exec: + command: + - /bin/sh + - -c + - exec pg_isready -U "postgres" -d "dbname=trigger" -h 127.0.0.1 -p 5432 + readinessProbe: + failureThreshold: 6 + initialDelaySeconds: 5 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + exec: + command: + - /bin/sh + - -c + - -e + - | + exec pg_isready -U "postgres" -d "dbname=trigger" -h 127.0.0.1 -p 5432 + [ -f /opt/bitnami/postgresql/tmp/.initialized ] || [ -f /bitnami/postgresql/.initialized ] + resources: + limits: {} + requests: + cpu: 250m + memory: 256Mi + volumeMounts: + - name: dshm + mountPath: /dev/shm + - name: data + mountPath: /bitnami/postgresql + volumes: + - name: dshm + emptyDir: + medium: Memory + volumeClaimTemplates: + - apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: data + spec: + accessModes: + - "ReadWriteOnce" + resources: + requests: + storage: "8Gi" From e79cae2dfeecddeacaeb4360a71f878b1a2f0945 Mon Sep 17 00:00:00 2001 From: Ronit Panda Date: Wed, 18 Oct 2023 16:45:16 +0530 Subject: [PATCH 07/11] style: cleanup --- random.yaml | 335 ---------------------------------------------------- 1 file changed, 335 deletions(-) delete mode 100644 random.yaml diff --git a/random.yaml b/random.yaml deleted file mode 100644 index 990223936f0..00000000000 --- a/random.yaml +++ /dev/null @@ -1,335 +0,0 @@ ---- -# Source: trigger/charts/postgresql/templates/secrets.yaml -apiVersion: v1 -kind: Secret -metadata: - name: postgresql - namespace: "default" - labels: - app.kubernetes.io/instance: release-name - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: postgresql - app.kubernetes.io/version: 16.0.0 - helm.sh/chart: postgresql-13.1.5 -type: Opaque -data: - postgres-password: "cGFzc3dvcmQ=" - # We don't auto-generate LDAP password when it's not provided as we do for other passwords ---- -# Source: trigger/templates/trigger.yaml -apiVersion: v1 -kind: Secret -metadata: - name: trigger - annotations: - "helm.sh/resource-policy": "keep" -type: Opaque -stringData: - APP_ORIGIN: "" - AUTH_GITHUB_CLIENT_ID: "" - AUTH_GITHUB_CLIENT_SECRET: "" - DIRECT_URL: "postgresql://postgres:password@triggerdotdev:5432/trigger" - ENCRYPTION_KEY: "yiciifbjhaseyiqkjdlwuyhgpk2eaewk" - FROM_EMAIL: "" - LOGIN_ORIGIN: "" - MAGIC_LINK_SECRET: "wjt45vknogeaffifllaklkwgmaackyg3" - REPLY_TO_EMAIL: "" - RESEND_API_KEY: "" - SESSION_SECRET: "ur1vchzkjvcjdwzimohu9zdlkmaf1ozr" ---- -# Source: trigger/charts/postgresql/templates/primary/svc-headless.yaml -apiVersion: v1 -kind: Service -metadata: - name: postgresql-hl - namespace: "default" - labels: - app.kubernetes.io/instance: release-name - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: postgresql - app.kubernetes.io/version: 16.0.0 - helm.sh/chart: postgresql-13.1.5 - app.kubernetes.io/component: primary - annotations: - # Use this annotation in addition to the actual publishNotReadyAddresses - # field below because the annotation will stop being respected soon but the - # field is broken in some versions of Kubernetes: - # https://github.com/kubernetes/kubernetes/issues/58662 - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" -spec: - type: ClusterIP - clusterIP: None - # We want all pods in the StatefulSet to have their addresses published for - # the sake of the other Postgresql pods even before they're ready, since they - # have to be able to talk to each other in order to become ready. - publishNotReadyAddresses: true - ports: - - name: tcp-postgresql - port: 5432 - targetPort: tcp-postgresql - selector: - app.kubernetes.io/instance: release-name - app.kubernetes.io/name: postgresql - app.kubernetes.io/component: primary ---- -# Source: trigger/charts/postgresql/templates/primary/svc.yaml -apiVersion: v1 -kind: Service -metadata: - name: postgresql - namespace: "default" - labels: - app.kubernetes.io/instance: release-name - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: postgresql - app.kubernetes.io/version: 16.0.0 - helm.sh/chart: postgresql-13.1.5 - app.kubernetes.io/component: primary -spec: - type: ClusterIP - sessionAffinity: None - ports: - - name: tcp-postgresql - port: 5432 - targetPort: tcp-postgresql - nodePort: null - selector: - app.kubernetes.io/instance: release-name - app.kubernetes.io/name: postgresql - app.kubernetes.io/component: primary ---- -# Source: trigger/templates/trigger.yaml -apiVersion: v1 -kind: Service -metadata: - name: trigger - labels: - component: "trigger" - app: trigger - release: release-name - chart: trigger-0.1.0 - heritage: Helm -spec: - type: ClusterIP - selector: - component: "trigger" - app: trigger - release: release-name - ports: - - port: 3030 - targetPort: 3030 - protocol: TCP ---- -# Source: trigger/templates/trigger.yaml -apiVersion: apps/v1 -kind: Deployment -metadata: - name: trigger - annotations: - updatedAt: "2023-10-10 IST 16:43:56" - labels: - component: "trigger" - app: trigger - release: release-name - chart: trigger-0.1.0 - heritage: Helm -spec: - replicas: 2 - selector: - matchLabels: - component: "trigger" - app: trigger - release: release-name - template: - metadata: - labels: - component: "trigger" - app: trigger - release: release-name - annotations: - updatedAt: "2023-10-10 IST 16:43:56" - spec: - containers: - - name: trigger - image: "ghcr.io/triggerdotdev/trigger.dev:latest" - imagePullPolicy: Always - ports: - - name: http - containerPort: 3030 - protocol: TCP - readinessProbe: - httpGet: - path: / - port: http - envFrom: - - secretRef: - name: trigger - resources: - limits: - memory: 200Mi - requests: - cpu: 150m ---- -# Source: trigger/charts/postgresql/templates/primary/statefulset.yaml -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: postgresql - namespace: "default" - labels: - app.kubernetes.io/instance: release-name - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: postgresql - app.kubernetes.io/version: 16.0.0 - helm.sh/chart: postgresql-13.1.5 - app.kubernetes.io/component: primary -spec: - replicas: 1 - serviceName: postgresql-hl - updateStrategy: - rollingUpdate: {} - type: RollingUpdate - selector: - matchLabels: - app.kubernetes.io/instance: release-name - app.kubernetes.io/name: postgresql - app.kubernetes.io/component: primary - template: - metadata: - name: postgresql - labels: - app.kubernetes.io/instance: release-name - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: postgresql - app.kubernetes.io/version: 16.0.0 - helm.sh/chart: postgresql-13.1.5 - app.kubernetes.io/component: primary - spec: - serviceAccountName: default - - affinity: - podAffinity: - - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - podAffinityTerm: - labelSelector: - matchLabels: - app.kubernetes.io/instance: release-name - app.kubernetes.io/name: postgresql - app.kubernetes.io/component: primary - topologyKey: kubernetes.io/hostname - weight: 1 - nodeAffinity: - - securityContext: - fsGroup: 1001 - hostNetwork: false - hostIPC: false - containers: - - name: postgresql - image: docker.io/bitnami/postgresql:16.0.0-debian-11-r13 - imagePullPolicy: "IfNotPresent" - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - runAsGroup: 0 - runAsNonRoot: true - runAsUser: 1001 - seccompProfile: - type: RuntimeDefault - env: - - name: BITNAMI_DEBUG - value: "false" - - name: POSTGRESQL_PORT_NUMBER - value: "5432" - - name: POSTGRESQL_VOLUME_DIR - value: "/bitnami/postgresql" - - name: PGDATA - value: "/bitnami/postgresql/data" - # Authentication - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: postgresql - key: postgres-password - - name: POSTGRES_DATABASE - value: "trigger" - # Replication - # Initdb - # Standby - # LDAP - - name: POSTGRESQL_ENABLE_LDAP - value: "no" - # TLS - - name: POSTGRESQL_ENABLE_TLS - value: "no" - # Audit - - name: POSTGRESQL_LOG_HOSTNAME - value: "false" - - name: POSTGRESQL_LOG_CONNECTIONS - value: "false" - - name: POSTGRESQL_LOG_DISCONNECTIONS - value: "false" - - name: POSTGRESQL_PGAUDIT_LOG_CATALOG - value: "off" - # Others - - name: POSTGRESQL_CLIENT_MIN_MESSAGES - value: "error" - - name: POSTGRESQL_SHARED_PRELOAD_LIBRARIES - value: "pgaudit" - ports: - - name: tcp-postgresql - containerPort: 5432 - livenessProbe: - failureThreshold: 6 - initialDelaySeconds: 30 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 5 - exec: - command: - - /bin/sh - - -c - - exec pg_isready -U "postgres" -d "dbname=trigger" -h 127.0.0.1 -p 5432 - readinessProbe: - failureThreshold: 6 - initialDelaySeconds: 5 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 5 - exec: - command: - - /bin/sh - - -c - - -e - - | - exec pg_isready -U "postgres" -d "dbname=trigger" -h 127.0.0.1 -p 5432 - [ -f /opt/bitnami/postgresql/tmp/.initialized ] || [ -f /bitnami/postgresql/.initialized ] - resources: - limits: {} - requests: - cpu: 250m - memory: 256Mi - volumeMounts: - - name: dshm - mountPath: /dev/shm - - name: data - mountPath: /bitnami/postgresql - volumes: - - name: dshm - emptyDir: - medium: Memory - volumeClaimTemplates: - - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: data - spec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: "8Gi" From fbb20a84c4cc9b09df4029a60904e1f9a1c172d1 Mon Sep 17 00:00:00 2001 From: Ronit Panda Date: Fri, 20 Oct 2023 11:12:47 +0530 Subject: [PATCH 08/11] feat: works --- helm-charts/templates/_helpers.tpl | 22 ++++++- helm-charts/templates/trigger.yaml | 11 ++-- helm-charts/values.yaml | 95 +++++++++--------------------- 3 files changed, 52 insertions(+), 76 deletions(-) diff --git a/helm-charts/templates/_helpers.tpl b/helm-charts/templates/_helpers.tpl index 4792c1f6168..5d060c43345 100644 --- a/helm-charts/templates/_helpers.tpl +++ b/helm-charts/templates/_helpers.tpl @@ -2,7 +2,7 @@ Expand the name of the chart. */}} {{- define "trigger.name" -}} -{{- default .Chart.Name | trunc 63 | trimSuffix "-" }} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} {{/* @@ -40,12 +40,28 @@ component: {{ .Values.trigger.name | quote }} {{ include "trigger.common.matchLabels" . }} {{- end -}} +{{/* +Create a fully qualified postgresql name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "trigger.postgresql.hostname" -}} +{{- if .Values.postgresql.fullnameOverride -}} +{{- .Values.postgresql.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- printf "%s-%s" .Release.Name .Values.postgresql.name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s-%s" .Release.Name $name .Values.postgresql.name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} {{/* -Create the mongodb connection string. +Create the postgresql connection string. */}} {{- define "trigger.postgresql.connectionString" -}} -{{- $host := "triggerdotdev" -}} +{{- $host := include "trigger.postgresql.hostname" . -}} {{- $port := 5432 -}} {{- $username := .Values.postgresql.global.postgresql.postgresqlUsername | default "postgres" -}} {{- $password := .Values.postgresql.global.postgresql.postgresqlPassword | default "password" -}} diff --git a/helm-charts/templates/trigger.yaml b/helm-charts/templates/trigger.yaml index 711fa570304..03900e65842 100644 --- a/helm-charts/templates/trigger.yaml +++ b/helm-charts/templates/trigger.yaml @@ -35,12 +35,12 @@ spec: imagePullPolicy: {{ $trigger.image.pullPolicy }} ports: - name: http - containerPort: 3030 + containerPort: 3000 protocol: TCP readinessProbe: httpGet: path: / - port: http + port: 3000 envFrom: - secretRef: name: {{ $trigger.kubeSecretRef | default (include "trigger.name" .) }} @@ -64,8 +64,8 @@ spec: selector: {{- include "trigger.matchLabels" . | nindent 8 }} ports: - - port: 3030 - targetPort: 3030 + - port: 3000 + targetPort: 3000 protocol: TCP {{- if eq $trigger.service.type "NodePort" }} nodePort: {{ $trigger.service.nodePort }} @@ -85,7 +85,8 @@ stringData: {{- $requiredVars := dict "MAGIC_LINK_SECRET" (randAlphaNum 32 | lower) "SESSION_SECRET" (randAlphaNum 32 | lower) "ENCRYPTION_KEY" (randAlphaNum 32 | lower) - "DIRECT_URL" (include "trigger.postgresql.connectionString" .) }} + "DIRECT_URL" (include "trigger.postgresql.connectionString" .) + "DATABASE_URL" (include "trigger.postgresql.connectionString" .) }} {{- $secretObj := (lookup "v1" "Secret" .Release.Namespace (include "trigger.name" .)) | default dict }} {{- $secretData := (get $secretObj "data") | default dict }} {{ range $key, $value := .Values.envVars }} diff --git a/helm-charts/values.yaml b/helm-charts/values.yaml index c99d4b7411a..c9aa50a6b11 100644 --- a/helm-charts/values.yaml +++ b/helm-charts/values.yaml @@ -1,6 +1,17 @@ # Default values for helm-charts. # This is a YAML-formatted file. -# Declare variables to be passed into your templates. +## @section Common parameters +## + +## @param nameOverride Override release name +## +nameOverride: "" +## @param fullnameOverride Override release fullname +## +fullnameOverride: "" + +## @section trigger -- main app +## trigger: ## @param trigger.name name: trigger @@ -30,9 +41,9 @@ trigger: ## resources: limits: - memory: 200Mi + memory: 800Mi requests: - cpu: 150m + cpu: 250m ## @param trigger.affinity Backend pod affinity ## affinity: {} @@ -47,10 +58,10 @@ trigger: annotations: {} ## @param trigger.service.type trigger service type ## - type: ClusterIP + type: NodePort ## @param trigger.service.nodePort trigger service nodePort (used if above type is `NodePort`) ## - nodePort: "" + nodePort: "30008" ## trigger environment variables configuration envVars: @@ -60,6 +71,7 @@ envVars: LOGIN_ORIGIN: "" APP_ORIGIN: "" DIRECT_URL: "" + DATABASE_URL: "" FROM_EMAIL: "" REPLY_TO_EMAIL: "" RESEND_API_KEY: "" @@ -69,15 +81,17 @@ envVars: ## @section Postgresql(®) parameters ## Documentation : https://github.com/bitnami/charts/tree/main/bitnami/postgresql-ha ## - -# global: -# postgresql: -# postgresqlDatabase: "trigger" -# postgresqlPassword: "password" -# postgresqlUsername: "postgres" -# servicePort: "5432" - postgresql: + ## @param postgresql.name Name used to build variables (deprecated) + ## + name: "postgresql" + ## @param postgresql.nameOverride Name override + ## + nameOverride: "postgresql" + ## @param fullnameOverride String to fully override common.names.fullname template + ## + fullnameOverride: "postgresql" + global: postgresql: ## @param global.postgresql.auth.postgresPassword Password for the "postgres" admin user (overrides `auth.postgresPassword`) @@ -100,16 +114,6 @@ postgresql: ports: postgresql: "5432" - ## @section Common parameters - ## - nameOverride: "postgresql" - ## @param fullnameOverride String to fully override common.names.fullname template - ## - fullnameOverride: "postgresql" - - ## @section PostgreSQL common parameters - ## - ## Bitnami PostgreSQL image version ## ref: https://hub.docker.com/r/bitnami/postgresql/tags/ ## @param image.registry PostgreSQL image registry @@ -138,51 +142,6 @@ postgresql: ## @param postgresqlSharedPreloadLibraries Shared preload libraries (comma-separated list) ## postgresqlSharedPreloadLibraries: "pgaudit" - ## Start PostgreSQL pod(s) without limitations on shm memory. - ## By default docker and containerd (and possibly other container runtimes) limit `/dev/shm` to `64M` - ## ref: https://github.com/docker-library/postgres/issues/416 - ## ref: https://github.com/containerd/containerd/issues/3654 - ## - shmVolume: - ## @param shmVolume.enabled Enable emptyDir volume for /dev/shm for PostgreSQL pod(s) - ## - enabled: true - ## @param shmVolume.sizeLimit Set this to enable a size limit on the shm tmpfs - ## Note: the size of the tmpfs counts against container's memory limit - ## e.g: - ## sizeLimit: 1Gi - ## - sizeLimit: "" - ## TLS configuration - ## - tls: - ## @param tls.enabled Enable TLS traffic support - ## - enabled: false - ## @param tls.autoGenerated Generate automatically self-signed TLS certificates - ## - autoGenerated: false - ## @param tls.preferServerCiphers Whether to use the server's TLS cipher preferences rather than the client's - ## - preferServerCiphers: true - ## @param tls.certificatesSecret Name of an existing secret that contains the certificates - ## - certificatesSecret: "" - ## @param tls.certFilename Certificate filename - ## - certFilename: "" - ## @param tls.certKeyFilename Certificate key filename - ## - certKeyFilename: "" - ## @param tls.certCAFilename CA Certificate filename - ## If provided, PostgreSQL will authenticate TLS/SSL clients by requesting them a certificate - ## ref: https://www.postgresql.org/docs/9.6/auth-methods.html - ## - certCAFilename: "" - ## @param tls.crlFilename File containing a Certificate Revocation List - ## - crlFilename: "" - ## @section PostgreSQL Primary parameters ## primary: From ffe8def537d75680a2687d2b7b0ba6df3c235175 Mon Sep 17 00:00:00 2001 From: Ronit Panda Date: Fri, 20 Oct 2023 15:14:51 +0530 Subject: [PATCH 09/11] feat: adds ingress and some docs --- .../guides/self-hosting/kubernetes.mdx | 61 +++++++++++++++++++ docs/mint.json | 1 + helm-charts/Chart.lock | 7 ++- helm-charts/Chart.yaml | 4 ++ helm-charts/templates/ingress.yaml | 43 +++++++++++++ helm-charts/values.yaml | 44 ++++++++++++- 6 files changed, 156 insertions(+), 4 deletions(-) create mode 100644 docs/documentation/guides/self-hosting/kubernetes.mdx create mode 100644 helm-charts/templates/ingress.yaml diff --git a/docs/documentation/guides/self-hosting/kubernetes.mdx b/docs/documentation/guides/self-hosting/kubernetes.mdx new file mode 100644 index 00000000000..a37ff6fd006 --- /dev/null +++ b/docs/documentation/guides/self-hosting/kubernetes.mdx @@ -0,0 +1,61 @@ +--- +title: "Deploy to Kubernetes" +description: "Deploy self hosted version of [Trigger.dev](https://trigger.dev) to your kubernetes cluster using our helm chart" +--- +**Prerequisites** +- You have understanding of [Kubernetes](https://kubernetes.io/) +- Installed [Helm package manager](https://helm.sh/) version v3.11.3 or greater +- You have [kubectl](https://kubernetes.io/docs/reference/kubectl/kubectl/) installed and connected to your kubernetes cluster + +By deploying Trigger.dev on Kubernetes, you can take advantage of its features to ensure that the application is fault-tolerant, highly available, and scalable. +To make the installation process easier and more streamlined, we have created a Helm chart that you can use to install Trigger.dev on Kubernetes. + +Helm is a package manager for Kubernetes that simplifies the installation and management of Kubernetes applications. +With our Helm chart, you can easily install Trigger.dev on Kubernetes, configure it to your liking, and scale it up or down as needed. + +## Install Trigger.dev Helm repository + +```bash +TODO: Add helm repo to artifact hub or cloudsmith +``` + +## Add Helm values + +Create a values.yaml file to configure various installation settings, such as the docker image tags and environment variables. To explore all configurable properties for your values file, [visit this page](TODO: add this). + +#### Set image tags + +By default, the application will use the latest tag to retrieve the required Docker images, which may be appropriate for most cases. +However, we recommend that you use a specific version of the Docker image to avoid unexpected changes to the application. + + + To find the latest version number of Trigger.dev, follow the link below + - [Trigger.dev image on github packaes](https://github.com/triggerdotdev/trigger.dev/pkgs/container/trigger.dev) + + +```yaml simple-values-example.yaml +trigger: + name: trigger + replicaCount: 2 + image: + repository: ghcr.io/triggerdotdev/trigger.dev + tag: "latest" # <--- frontend version + pullPolicy: Always +``` + +#### Configure environment variables + +You can configure environment variables for trigger in your Helm values file under the property `envVars`. View configurable [environment variables](../configuration/envars). + +Infisical requires the following backend environment variables to be defined: _`MAGIC_LINK_SECRET`_, _`SESSION_SECRET`_, _`ENCRYPTION_KEY`_, _`DIRECT_URL`_, and _`DATABASE_URL`_ . + +However, when the above environment variables are not defined, the Helm chart +will automatically generate these environment variables for you. The generated environment variables will be saved to a Kubernetes secret and will be preserved between upgrades or uninstalls. + +```yaml simple-values-example.yaml +... +envVars: + ENCRYPTION_KEY: "b1ebe43a6a6e24b2aa8fa0707d3890e3" + MAGIC_LINK_SECRET: "842727396bcee22da68518f959c5730b" + ... +``` diff --git a/docs/mint.json b/docs/mint.json index ef5e50bcad0..98ba3365e42 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -206,6 +206,7 @@ "documentation/guides/self-hosting", "documentation/guides/self-hosting/flyio", "documentation/guides/self-hosting/render", + "documentation/guides/self-hosting/kubernetes", "documentation/guides/self-hosting/supabase", "documentation/guides/tunneling-platform" ] diff --git a/helm-charts/Chart.lock b/helm-charts/Chart.lock index b21a8b38f26..25db8abe68b 100644 --- a/helm-charts/Chart.lock +++ b/helm-charts/Chart.lock @@ -2,5 +2,8 @@ dependencies: - name: postgresql repository: https://charts.bitnami.com/bitnami version: 13.1.5 -digest: sha256:ff57915ccf07a2ea54e3fae652ec9d320e7145cc00b6a8bf7ec81d793416ae42 -generated: "2023-10-18T06:47:42.592418+05:30" +- name: ingress-nginx + repository: https://kubernetes.github.io/ingress-nginx + version: 4.0.13 +digest: sha256:e439e4b30ba18357defec97ba080973743a4724c423b78913990409f78f1ebd8 +generated: "2023-10-20T14:22:57.044126+05:30" diff --git a/helm-charts/Chart.yaml b/helm-charts/Chart.yaml index aa3f665adb0..04ff9e562ef 100644 --- a/helm-charts/Chart.yaml +++ b/helm-charts/Chart.yaml @@ -28,3 +28,7 @@ dependencies: version: "~13.1.5" repository: https://charts.bitnami.com/bitnami condition: postgresql.enabled + - name: ingress-nginx + version: 4.0.13 + repository: https://kubernetes.github.io/ingress-nginx + condition: ingress.nginx.enabled diff --git a/helm-charts/templates/ingress.yaml b/helm-charts/templates/ingress.yaml new file mode 100644 index 00000000000..3f4e73f6ecd --- /dev/null +++ b/helm-charts/templates/ingress.yaml @@ -0,0 +1,43 @@ +{{ if .Values.ingress.enabled }} +{{- $ingress := .Values.ingress }} +{{- if and $ingress.ingressClassName (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey $ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set $ingress.annotations "kubernetes.io/ingress.class" $ingress.ingressClassName}} + {{- end }} +{{- end }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: trigger-ingress + {{- with $ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and $ingress.ingressClassName (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ $ingress.ingressClassName | default "nginx" }} + {{- end }} +{{- if $ingress.tls }} + tls: + {{- range $ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + - http: + paths: + - path: {{ $ingress.trigger.path }} + pathType: {{ $ingress.trigger.pathType }} + backend: + service: + name: {{ include "trigger.name" . }} + port: + number: 3000 + {{- if $ingress.hostName }} + host: {{ $ingress.hostName }} + {{- end }} +{{ end }} \ No newline at end of file diff --git a/helm-charts/values.yaml b/helm-charts/values.yaml index c9aa50a6b11..463b05263fb 100644 --- a/helm-charts/values.yaml +++ b/helm-charts/values.yaml @@ -15,6 +15,9 @@ fullnameOverride: "" trigger: ## @param trigger.name name: trigger + ## @param trigger.fullnameOverride trigger fullnameOverride + ## + fullnameOverride: "" ## @param trigger.podAnnotations trigger pod annotations ## podAnnotations: {} @@ -58,10 +61,10 @@ trigger: annotations: {} ## @param trigger.service.type trigger service type ## - type: NodePort + type: ClusterIP ## @param trigger.service.nodePort trigger service nodePort (used if above type is `NodePort`) ## - nodePort: "30008" + nodePort: "" ## trigger environment variables configuration envVars: @@ -203,3 +206,40 @@ postgresql: ## @param primary.persistence.size PVC Storage Request for PostgreSQL volume ## size: 8Gi + +## @section Ingress parameters +## +ingress: + ## @param ingress.enabled Enable ingress + ## + enabled: true + ## @param ingress.ingressClassName Ingress class name + ## + ingressClassName: nginx + ## @param ingress.nginx.enabled Ingress controller + ## + nginx: + enabled: false + ## @param ingress.annotations Ingress annotations + ## + annotations: + {} + # kubernetes.io/ingress.class: "nginx" + # cert-manager.io/issuer: letsencrypt-nginx + ## @param ingress.hostName Ingress hostname (your custom domain name, e.g. `infisical.example.org`) + ## Replace with your own domain + ## + hostName: "" + ## @skip ingress.frontend + ## + trigger: + path: /?(.*) + pathType: Prefix + ## @param ingress.tls Ingress TLS hosts (matching above hostName) + ## Replace with your own domain + ## + tls: + [] + # - secretName: letsencrypt-nginx + # hosts: + # - infisical.local From 7d59f3611884fed197c96b9344f670f9073d5855 Mon Sep 17 00:00:00 2001 From: Ronit Panda Date: Fri, 20 Oct 2023 15:36:39 +0530 Subject: [PATCH 10/11] fix: ingress bug --> routing to cluster works --- helm-charts/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-charts/values.yaml b/helm-charts/values.yaml index 463b05263fb..98f556086ad 100644 --- a/helm-charts/values.yaml +++ b/helm-charts/values.yaml @@ -233,7 +233,7 @@ ingress: ## @skip ingress.frontend ## trigger: - path: /?(.*) + path: / pathType: Prefix ## @param ingress.tls Ingress TLS hosts (matching above hostName) ## Replace with your own domain From 5129d8b3b73a4d550870476cd59f669cc0bce8b5 Mon Sep 17 00:00:00 2001 From: Ronit Panda Date: Fri, 20 Oct 2023 16:21:20 +0530 Subject: [PATCH 11/11] feat: completes docs v1 todo --> needs hosting of the helm chart on chosen platform --- .../guides/self-hosting/kubernetes.mdx | 112 +++++++++++++++++- helm-charts/values.yaml | 3 + 2 files changed, 114 insertions(+), 1 deletion(-) diff --git a/docs/documentation/guides/self-hosting/kubernetes.mdx b/docs/documentation/guides/self-hosting/kubernetes.mdx index a37ff6fd006..20982eb66d8 100644 --- a/docs/documentation/guides/self-hosting/kubernetes.mdx +++ b/docs/documentation/guides/self-hosting/kubernetes.mdx @@ -21,7 +21,7 @@ TODO: Add helm repo to artifact hub or cloudsmith ## Add Helm values -Create a values.yaml file to configure various installation settings, such as the docker image tags and environment variables. To explore all configurable properties for your values file, [visit this page](TODO: add this). +Create a values.yaml file to configure various installation settings, such as the docker image tags and environment variables. To explore all configurable properties for your values file, [visit this page](https://github.com/triggerdotdev/trigger.dev/tree/main/helm-charts/). #### Set image tags @@ -59,3 +59,113 @@ envVars: MAGIC_LINK_SECRET: "842727396bcee22da68518f959c5730b" ... ``` +#### Routing external traffic +By default, Trigger.dev takes all traffic coming to your external load balancer's IP address and routes them Trigger.dev's services. +Infisical uses Nginx to route external traffic. You can install Nginx along with Trigger by setting `ingress.enabled` to `true` in the Helm values file. View all [properties for ingress](https://github.com/triggerdotdev/trigger.dev/tree/main/helm-charts/). + +```yaml simple-values-example.yaml +... +ingress: + nginx: + enabled: true #<-- if you would like to install nginx along with Trigger.dev +``` + +#### Database +Trigger.dev uses a SQL database as its persistence layer. With this Helm chart, you spin up a PostgreSQL instance powered by Bitnami along side other Trigger.dev services in your cluster. +When persistence is enabled, the data will be stored as Kubernetes Persistence Volume. View all [properties for postgresql](https://github.com/triggerdotdev/trigger.dev/tree/main/helm-charts/). + +```yaml simple-values-example.yaml +postgresql: + enabled: true + persistence: + enabled: true +``` + +#### Example helm values +```yaml simple-values-example.yaml +trigger: + name: trigger + replicaCount: 2 + image: + repository: ghcr.io/triggerdotdev/trigger.dev + tag: "latest" + pullPolicy: Always + +envVars: + ENCRYPTION_KEY: "b1ebe43a6a6e24b2aa8fa0707d3890e3" + MAGIC_LINK_SECRET: "842727396bcee22da68518f959c5730b" + +ingress: + nginx: + enabled: true #<-- if you would like to install nginx along with Infisical + +``` + + + ```yaml values.yaml + ingress: + nginx: + enabled: true + + trigger: + enabled: true + name: trigger + podAnnotations: {} + deploymentAnnotations: {} + replicaCount: 4 + image: + repository: ghcr.io/triggerdotdev/trigger.dev + tag: "latest" + pullPolicy: IfNotPresent + kubeSecretRef: null + service: + annotations: {} + type: ClusterIP + nodePort: "" + + # View all environment variables TODO: Docs for all env vars + envVars: + DATABASE_URL: <> + DIRECT_URL: <> + ENCRYPTION_KEY: <> + + + ## Postgresql DB persistence + postgresql: + enabled: true + persistence: + enabled: true + + ingress: + enabled: true + annotations: + cert-manager.io/cluster-issuer: "letsencrypt-prod" # <-- if you are setting up HTTPS + hostName: app.yourdomain.com ## <- Replace with your own domain + trigger: + path: / + pathType: Prefix + tls: # <-- if you are setting up HTTPS + - secretName: echo-tls + hosts: + - app.yourdomain.com + + ``` + + +## Install the Helm chart + +By default, the helm chart will be installed on your default namespace. If you wish to install the Chart on a different namespace, you may specify +that by adding the `--namespace ` to your `helm install` command. + +```bash +## Installs to default namespace +TODO: not published +``` + +## Access Trigger.dev +Allow 3-5 minutes for the deployment to complete. Once done, you should now be able to access Trigger.dev on the IP address exposed via Ingress on your load balancer. If you are not sure what the IP address is run `kubectl get ingress` to view the external IP address exposing Trigger.dev. + + +Once installation is complete, you will have to create the first account. No default account is provided. + + diff --git a/helm-charts/values.yaml b/helm-charts/values.yaml index 98f556086ad..0a62e8718a8 100644 --- a/helm-charts/values.yaml +++ b/helm-charts/values.yaml @@ -85,6 +85,9 @@ envVars: ## Documentation : https://github.com/bitnami/charts/tree/main/bitnami/postgresql-ha ## postgresql: + ## @param postgresql.enabled Enable Postgresql(®) + ## + enabled: true ## @param postgresql.name Name used to build variables (deprecated) ## name: "postgresql"