diff --git a/kestra/Pluralfile b/kestra/Pluralfile new file mode 100644 index 000000000..18a2bf7d9 --- /dev/null +++ b/kestra/Pluralfile @@ -0,0 +1,6 @@ +REPO kestra +ATTRIBUTES kestra repository.yaml + +TF terraform/* +HELM helm/* +RECIPE plural/recipes/* diff --git a/kestra/helm/kestra/.helmignore b/kestra/helm/kestra/.helmignore new file mode 100644 index 000000000..50af03172 --- /dev/null +++ b/kestra/helm/kestra/.helmignore @@ -0,0 +1,22 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/kestra/helm/kestra/Chart.yaml b/kestra/helm/kestra/Chart.yaml new file mode 100644 index 000000000..6451d1996 --- /dev/null +++ b/kestra/helm/kestra/Chart.yaml @@ -0,0 +1,40 @@ +name: kestra +description: Infinitely scalable, event-driven, language-agnostic orchestration and scheduling platform to manage millions of workflows declaratively in code. +home: https://kestra.io +version: 0.13.0 +appVersion: "0.13.0" +apiVersion: v1 +keywords: + - orchestrator + - scheduler + - workflow +icon: https://kestra.io/favicon-192x192.png +sources: + - https://github.com/kestra-io/helm-charts +maintainers: + - name: tchiotludo + email: tchiot.ludo@gmail.com +type: application +annotations: + artifacthub.io/links: | + - name: Documentation + url: https://kestra.io/docs/ + artifacthub.io/screenshots: | + - title: Home page + url: https://raw.githubusercontent.com/kestra-io/kestra.io/main/public/docs/user-interface-guide/02-Homepage-Empty.png + - title: Flows list + url: https://raw.githubusercontent.com/kestra-io/kestra.io/main/public/docs/user-interface-guide/04-Flows.png + - title: Flow page + url: https://raw.githubusercontent.com/kestra-io/kestra.io/main/public/docs/user-interface-guide/05-Flows-Flow.png + - title: Execution list + url: https://raw.githubusercontent.com/kestra-io/kestra.io/main/public/docs/user-interface-guide/08-Executions.png + - title: Execution page + url: https://raw.githubusercontent.com/kestra-io/kestra.io/main/public/docs/user-interface-guide/09-Executions-Execution.png + - title: Execution gantt + url: https://raw.githubusercontent.com/kestra-io/kestra.io/main/public/docs/user-interface-guide/27-Executions-Gantt.png + - title: Namespaces list + url: https://raw.githubusercontent.com/kestra-io/kestra.io/main/public/docs/user-interface-guide/14-EE-Namespace.png + - title: Global logs + url: https://raw.githubusercontent.com/kestra-io/kestra.io/main/public/docs/user-interface-guide/10-Logs.png + - title: Documentation + url: https://raw.githubusercontent.com/kestra-io/kestra.io/main/public/docs/user-interface-guide/12-Documentations-Plugins-Plugin.png diff --git a/kestra/helm/kestra/README.md b/kestra/helm/kestra/README.md new file mode 100644 index 000000000..64fabd91a --- /dev/null +++ b/kestra/helm/kestra/README.md @@ -0,0 +1 @@ +A helm chart for kestra \ No newline at end of file diff --git a/kestra/helm/kestra/charts/elasticsearch-7.17.3.tgz b/kestra/helm/kestra/charts/elasticsearch-7.17.3.tgz new file mode 100644 index 000000000..7f7e84fa0 Binary files /dev/null and b/kestra/helm/kestra/charts/elasticsearch-7.17.3.tgz differ diff --git a/kestra/helm/kestra/charts/kafka-18.5.0.tgz b/kestra/helm/kestra/charts/kafka-18.5.0.tgz new file mode 100644 index 000000000..b59465a41 Binary files /dev/null and b/kestra/helm/kestra/charts/kafka-18.5.0.tgz differ diff --git a/kestra/helm/kestra/charts/kestra-0.13.0.tgz b/kestra/helm/kestra/charts/kestra-0.13.0.tgz new file mode 100644 index 000000000..ad9fdc4ad Binary files /dev/null and b/kestra/helm/kestra/charts/kestra-0.13.0.tgz differ diff --git a/kestra/helm/kestra/charts/minio-4.1.0.tgz b/kestra/helm/kestra/charts/minio-4.1.0.tgz new file mode 100644 index 000000000..0911284bb Binary files /dev/null and b/kestra/helm/kestra/charts/minio-4.1.0.tgz differ diff --git a/kestra/helm/kestra/charts/postgresql-11.9.13.tgz b/kestra/helm/kestra/charts/postgresql-11.9.13.tgz new file mode 100644 index 000000000..2d3ac623a Binary files /dev/null and b/kestra/helm/kestra/charts/postgresql-11.9.13.tgz differ diff --git a/kestra/helm/kestra/deps.yaml b/kestra/helm/kestra/deps.yaml new file mode 100644 index 000000000..b0e0d23b8 --- /dev/null +++ b/kestra/helm/kestra/deps.yaml @@ -0,0 +1,33 @@ +apiVersion: plural.sh/v1alpha1 +kind: Dependencies +metadata: + application: true + description: Deploys kestra crafted for the target cloud +spec: + dependencies: + - type: helm + name: bootstrap + repo: bootstrap + version: '>= 0.5.1' + + + - type: helm + name: postgres + repo: postgres + version: ">= 0.1.6" + + - type: terraform + name: aws + repo: kestra + version: '>= 0.1.0' + optional: true + - type: terraform + name: azure + repo: kestra + version: '>= 0.1.0' + optional: true + - type: terraform + name: gcp + repo: kestra + version: '>= 0.1.0' + optional: true \ No newline at end of file diff --git a/kestra/helm/kestra/requirements.lock b/kestra/helm/kestra/requirements.lock new file mode 100644 index 000000000..077cdb86d --- /dev/null +++ b/kestra/helm/kestra/requirements.lock @@ -0,0 +1,15 @@ +dependencies: +- name: elasticsearch + repository: https://helm.elastic.co + version: 7.17.3 +- name: kafka + repository: https://charts.bitnami.com/bitnami + version: 18.5.0 +- name: minio + repository: https://charts.min.io/ + version: 4.1.0 +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 11.9.13 +digest: sha256:f410fc312054189ac6f62fbf5ce08293a980f3116eec79f17dab8be11cbf3be6 +generated: "2023-12-13T08:05:50.479227+01:00" diff --git a/kestra/helm/kestra/requirements.yaml b/kestra/helm/kestra/requirements.yaml new file mode 100644 index 000000000..321b06d07 --- /dev/null +++ b/kestra/helm/kestra/requirements.yaml @@ -0,0 +1,17 @@ +dependencies: + - name: elasticsearch + version: ^7.17.3 + repository: https://helm.elastic.co + condition: elasticsearch.enabled + - name: kafka + version: ^18.3.1 + repository: https://charts.bitnami.com/bitnami + condition: kafka.enabled + - name: minio + version: ^4.0.13 + repository: https://charts.min.io/ + condition: minio.enabled + - name: postgresql + condition: postgresql.enabled + repository: https://charts.bitnami.com/bitnami + version: "~11.9.2" diff --git a/kestra/helm/kestra/templates/NOTES.txt b/kestra/helm/kestra/templates/NOTES.txt new file mode 100644 index 000000000..40dbef336 --- /dev/null +++ b/kestra/helm/kestra/templates/NOTES.txt @@ -0,0 +1,21 @@ +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 }}{{ . }} + {{- 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 "kestra.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 "kestra.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "kestra.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + 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 "kestra.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component={{ ternary "webserver" "standalone" (.Values.deployments.webserver.enabled) }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:8080 +{{- end }} diff --git a/kestra/helm/kestra/templates/_helpers.tpl b/kestra/helm/kestra/templates/_helpers.tpl new file mode 100644 index 000000000..94b6f8b7a --- /dev/null +++ b/kestra/helm/kestra/templates/_helpers.tpl @@ -0,0 +1,351 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "kestra.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 "kestra.fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- printf "%s-%s" .Release.Name .Component | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s-%s" .Release.Name .Chart.Name .Component | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "kestra.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "kestra.labels" -}} +app.kubernetes.io/name: {{ include "kestra.name" . }} +app.kubernetes.io/component: {{ .Component }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .WorkerGroup }} +app.kubernetes.io/worker-group: {{ .WorkerGroup }} +{{- end }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +helm.sh/chart: {{ include "kestra.chart" . }} +{{- end -}} + + +{{/* +Selectors labels +*/}} +{{- define "kestra.selectorsLabels" -}} +app.kubernetes.io/name: {{ include "kestra.name" . }} +app.kubernetes.io/component: {{ .Component }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + + +{{/* +Form the Elasticsearch URL. +*/}} +{{- define "kestra.elasticsearch.url" }} +{{- $port := .Values.elasticsearch.httpPort | toString }} +{{- printf "%s://%s:%s" .Values.elasticsearch.protocol (include "elasticsearch.uname" (dict "Values" $.Values.elasticsearch)) $port }} +{{- end -}} + +{{/* +Form the Kafka URL. +*/}} +{{- define "kestra.kafka.url" }} +{{- printf "%s-%s:%s" .Release.Name "kafka" "9092" -}} +{{- end -}} + +{{/* +Form the Minio URL. +*/}} +{{- define "kestra.minio.url" }} +{{- printf "%s-%s" .Release.Name "minio" -}} +{{- end -}} + +{{/* +Form the Postgres URL. +*/}} +{{- define "kestra.postgres.url" }} +{{- $port := $.Values.postgresql.primary.service.ports.postgresql | toString }} +{{- printf "%s-%s:%s" .Release.Name "postgresql" $port -}} +{{- end -}} + +{{/* +k8s-config vars +*/}} +{{- define "kestra.k8s-config" -}} +{{- if .Values.postgresql.enabled }} +datasources: + postgres: + url: jdbc:postgresql://{{ include "kestra.postgres.url" . }}/{{ .Values.postgresql.auth.database }} + driverClassName: org.postgresql.Driver + username: {{ .Values.postgresql.auth.username }} + password: {{ .Values.postgresql.auth.password }} +{{ end }} +{{- if or .Values.elasticsearch.enabled .Values.kafka.enabled .Values.postgresql.enabled .Values.minio.enabled -}} +kestra: +{{- if .Values.elasticsearch.enabled }} + repository: + type: elasticsearch + elasticsearch: + client: + http-hosts: {{ include "kestra.elasticsearch.url" . }} +{{- end }} +{{- if .Values.kafka.enabled }} + queue: + type: kafka + kafka: + client: + properties: + bootstrap.servers: {{ include "kestra.kafka.url" . }} +{{- end }} +{{- if .Values.postgresql.enabled }} + queue: + type: postgres + repository: + type: postgres +{{- end }} +{{- if .Values.minio.enabled }} + storage: + type: minio + minio: + endpoint: {{ include "kestra.minio.url" . }} + port: 9000 + access-key: {{ .Values.minio.rootUser }} + secret-key: {{ .Values.minio.rootPassword }} + secure: false + bucket: kestra +{{- end }} +{{- end -}} +{{- end -}} + +{{/* +Env vars +*/}} +{{- define "kestra.configurationPath" -}} +{{- $configurations := list -}} + +{{- if .Values.configurationPath -}} +{{- $configurations = append $configurations $.Values.configurationPath }} +{{- else }} + {{- if $.Values.configuration }}{{ $configurations = append $configurations "/app/confs/application.yml" }}{{- end }} + {{- if $.Values.secrets }}{{ $configurations = append $configurations "/app/secrets/application-secrets.yml" }}{{- end }} + {{- if include "kestra.k8s-config" $ }}{{ $configurations = append $configurations "/app/secrets/application-k8s.yml" }}{{- end }} +{{- end -}} + +- name: MICRONAUT_CONFIG_FILES + value: {{ join "," $configurations }} + +{{- end -}} + + +{{/* +Deployment template +*/}} +{{- define "kestra.deployment" -}} +{{- $name := .Name -}} +{{- $type := .Type -}} +{{- $deployment := .Deployment -}} +{{- $merged := (merge (dict "Component" $name) $) -}} +{{- $dind := and ($.Values.dind.enabled) (or (eq $type "worker") (eq $type "standalone")) -}} +apiVersion: apps/v1 +kind: {{ $deployment.kind }} +metadata: + name: {{ include "kestra.fullname" $merged }} + labels: + {{- include "kestra.labels" $merged | nindent 4 }} + {{- with $.Values.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if eq $deployment.kind "Deployment" }} + replicas: {{ $deployment.replicaCount | default 1 }} + {{- end }} + {{- if $deployment.strategy }} + strategy: + {{- toYaml $deployment.strategy | nindent 4 }} + {{ if eq $deployment.strategy.type "Recreate" }}rollingUpdate: null{{ end }} + {{- end }} + selector: + matchLabels: + {{- include "kestra.selectorsLabels" $merged | nindent 6 }} + template: + metadata: + labels: + {{- include "kestra.selectorsLabels" $merged | nindent 8 }} + + annotations: + checksum/secrets: {{ include (print $.Template.BasePath "/secret.yaml") $ | sha256sum }} + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") $ | sha256sum }} + {{- with $.Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- if $.Values.serviceAccountName }} + serviceAccountName: {{ $.Values.serviceAccountName }} + {{- end }} + {{- with $.Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if $.Values.initContainers }} + initContainers: + {{- toYaml $.Values.initContainers | nindent 8 }} + {{- end }} + terminationGracePeriodSeconds: {{ default $.Values.terminationGracePeriodSeconds $deployment.terminationGracePeriodSeconds }} + {{- if $dind }} + securityContext: + {{- toYaml (default $.Values.podSecurityContext $deployment.podSecurityContext) | nindent 8 }} + {{- end }} + containers: + - name: {{ $.Chart.Name }}-{{ $name }} + securityContext: + {{- toYaml (default $.Values.securityContext $deployment.securityContext) | nindent 12 }} + image: "{{ $.Values.image.image }}:{{ $.Values.image.tag }}" + imagePullPolicy: {{ $.Values.image.pullPolicy }} + command: + - sh + - -c + - "exec {{ $.Values.executable }} {{ tpl $deployment.command $ }}" + env: + {{- if $.Values.extraEnv }}{{ toYaml $.Values.extraEnv | trim | nindent 12 }}{{ end }} + {{- include "kestra.configurationPath" $ | nindent 12 }} + volumeMounts: + {{- if $.Values.extraVolumeMounts }}{{ toYaml $.Values.extraVolumeMounts | trim | nindent 12 }}{{ end }} + {{- if $.Values.configuration }} + - name: config + mountPath: /app/confs/ + {{- end }} + {{- if or $.Values.secrets (include "kestra.k8s-config" $) }} + - name: secrets + mountPath: /app/secrets/ + {{- end }} + {{- if $dind }} + - name: docker-dind-socket + mountPath: /dind + - name: docker-tmp + mountPath: {{ $.Values.dind.tmpPath }} + {{- end }} + ports: + - name: http + containerPort: 8080 + protocol: TCP + - name: management + containerPort: 8081 + protocol: TCP + {{- if $.Values.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: {{ $.Values.livenessProbe.path }} + port: {{ $.Values.livenessProbe.port }} + {{- if $.Values.livenessProbe.httpGetExtra }}{{ toYaml $.Values.livenessProbe.httpGetExtra | trim | nindent 14 }}{{ end }} + initialDelaySeconds: {{ $.Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ $.Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ $.Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ $.Values.livenessProbe.successThreshold }} + failureThreshold: {{ $.Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if $.Values.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: {{ $.Values.readinessProbe.path }} + port: {{ $.Values.readinessProbe.port }} + {{- if $.Values.readinessProbe.httpGetExtra }}{{ toYaml $.Values.readinessProbe.httpGetExtra | trim | nindent 14 }}{{ end }} + initialDelaySeconds: {{ $.Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ $.Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ $.Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ $.Values.readinessProbe.successThreshold }} + failureThreshold: {{ $.Values.readinessProbe.failureThreshold }} + {{- end }} + resources: + {{- toYaml (default $.Values.resources $deployment.resources) | nindent 12 }} + {{- if $dind }} + - name: {{ $.Chart.Name }}-{{ $name }}-docker-dind + image: "{{ $.Values.dind.image.image }}:{{ $.Values.dind.image.tag }}" + imagePullPolicy: {{ $.Values.dind.image.pullPolicy }} + args: + {{- toYaml $.Values.dind.args | nindent 12 }} + env: + {{- if $.Values.dind.extraEnv }}{{ toYaml $.Values.dind.extraEnv | trim | nindent 12 }}{{ end }} + - name: DOCKER_HOST + value: unix://{{ $.Values.dind.socketPath }}/docker.sock + securityContext: + privileged: true + {{- if $.Values.dind.securityContext }} + {{- toYaml $.Values.dind.securityContext | nindent 12 }} + {{- end }} + volumeMounts: + {{- if $.Values.dind.extraVolumeMounts }}{{ toYaml $.Values.dind.extraVolumeMounts | trim | nindent 12 }}{{ end }} + - name: docker-dind-socket + mountPath: {{ $.Values.dind.socketPath }} + - name: docker-tmp + mountPath: {{ $.Values.dind.tmpPath }} + resources: + {{- toYaml $.Values.dind.resources | nindent 12 }} + {{- end }} + {{- with default $.Values.extraContainers $deployment.extraContainers }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with default $.Values.nodeSelector $deployment.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with default $.Values.affinity $deployment.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with default $.Values.tolerations $deployment.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + {{- if $.Values.extraVolumes }}{{ toYaml $.Values.extraVolumes | trim | nindent 8 }}{{ end }} + {{- if $.Values.configuration }} + - name: config + configMap: + name: {{ template "kestra.fullname" (merge (dict "Component" "configmap") $) }} + items: + {{- if $.Values.configuration }} + - key: application.yml + path: application.yml + {{- end }} + {{- end }} + {{- if or $.Values.secrets (include "kestra.k8s-config" $) }} + - name: secrets + secret: + secretName: {{ template "kestra.fullname" (merge (dict "Component" "secret") $) }} + items: + {{- if $.Values.secrets }} + - key: application-secrets.yml + path: application-secrets.yml + {{- end }} + {{- if (include "kestra.k8s-config" $) }} + - key: application-k8s.yml + path: application-k8s.yml + {{- end }} + {{- end }} + {{- if $dind }} + - name: docker-dind-socket + emptyDir: {} + - name: docker-tmp + emptyDir: {} + {{- end }} +{{- end -}} + + diff --git a/kestra/helm/kestra/templates/autoscaler.yaml b/kestra/helm/kestra/templates/autoscaler.yaml new file mode 100644 index 000000000..8790f7909 --- /dev/null +++ b/kestra/helm/kestra/templates/autoscaler.yaml @@ -0,0 +1,28 @@ +{{ range $name, $deployment := .Values.deployments }} + {{- if $deployment.autoscaler -}} + {{- if $deployment.autoscaler.enabled -}} +{{- if semverCompare ">=1.23-0" $.Capabilities.KubeVersion.GitVersion -}} +apiVersion: autoscaling/v2 +{{- else -}} +apiVersion: autoscaling/v2beta2 +{{- end }} +{{ $merged := (merge (dict "Component" $name) $) -}} +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "kestra.fullname" $merged }}-autoscaler +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: {{ $deployment.kind }} + name: {{ include "kestra.fullname" $merged }} + minReplicas: {{ $deployment.autoscaler.minReplicas | default 1 }} + maxReplicas: {{ $deployment.autoscaler.maxReplicas | default 1 }} + {{- if $deployment.autoscaler.extra }}{{ toYaml $deployment.autoscaler.extra | trim | nindent 2 }}{{ end }} + {{- if $deployment.autoscaler.metrics }} + metrics: + {{- toYaml $deployment.autoscaler.metrics | nindent 4 }} + {{- end }} +--- + {{- end }} + {{- end }} +{{ end }} diff --git a/kestra/helm/kestra/templates/configmap.yaml b/kestra/helm/kestra/templates/configmap.yaml new file mode 100644 index 000000000..47dc7f418 --- /dev/null +++ b/kestra/helm/kestra/templates/configmap.yaml @@ -0,0 +1,14 @@ +{{- if or .Values.elasticsearch.enabled .Values.kafka.enabled .Values.configuration -}} +{{ $merged := (merge (dict "Component" "configmap") $) -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "kestra.fullname" $merged }} + labels: + {{- include "kestra.labels" $merged | nindent 4 }} +data: +{{- if .Values.configuration }} + application.yml: | +{{ .Values.configuration | toYaml | indent 4}} +{{- end }} +{{- end }} diff --git a/kestra/helm/kestra/templates/deployment.yaml b/kestra/helm/kestra/templates/deployment.yaml new file mode 100644 index 000000000..7c09987ba --- /dev/null +++ b/kestra/helm/kestra/templates/deployment.yaml @@ -0,0 +1,13 @@ + +{{ range $name, $deployment := .Values.deployments }} + {{- if $deployment.enabled -}} + {{- include "kestra.deployment" (merge (dict "Name" $name "Type" $name "Deployment" $deployment) $) }} +--- + {{- end }} +{{ end }} +{{ range $name, $deployment := .Values.workerGroup }} + {{- if $deployment.enabled -}} + {{- include "kestra.deployment" (merge (dict "Name" (print "workergroup-" $name) "Type" "worker" "Deployment" $deployment "WorkerGroup" $name) $) }} +--- + {{- end }} +{{ end }} diff --git a/kestra/helm/kestra/templates/ingress.yaml b/kestra/helm/kestra/templates/ingress.yaml new file mode 100644 index 000000000..d0b4c46db --- /dev/null +++ b/kestra/helm/kestra/templates/ingress.yaml @@ -0,0 +1,63 @@ +{{- if .Values.ingress.enabled -}} +{{ $merged := (merge (dict "Component" "ingress") $) -}} +{{- $fullName := include "kestra.fullname" (merge (dict "Component" "ingress") $) -}} +{{- $fullNameService := include "kestra.fullname" (merge (dict "Component" "service") $) -}} +{{- $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 "kestra.labels" $merged | indent 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: {{ $fullNameService }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullNameService }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/kestra/helm/kestra/templates/secret.yaml b/kestra/helm/kestra/templates/secret.yaml new file mode 100644 index 000000000..b21852b3d --- /dev/null +++ b/kestra/helm/kestra/templates/secret.yaml @@ -0,0 +1,17 @@ +{{- if or .Values.secrets (include "kestra.k8s-config" $) }} +{{ $merged := (merge (dict "Component" "secret") $) -}} +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "kestra.fullname" $merged }} + labels: + {{- include "kestra.labels" $merged | nindent 4 }} +type: Opaque +data: +{{- if .Values.secrets }} + application-secrets.yml: {{.Values.secrets | toYaml | b64enc | quote }} +{{- end }} +{{- if include "kestra.k8s-config" $ }} + application-k8s.yml: {{ include "kestra.k8s-config" $ | b64enc | quote }} +{{- end }} +{{- end }} diff --git a/kestra/helm/kestra/templates/service.yaml b/kestra/helm/kestra/templates/service.yaml new file mode 100644 index 000000000..36c828028 --- /dev/null +++ b/kestra/helm/kestra/templates/service.yaml @@ -0,0 +1,21 @@ +{{ $merged := (merge (dict "Component" "service") $) -}} +{{ $selector := ternary "standalone" "webserver" $.Values.deployments.standalone.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "kestra.fullname" $merged }} + labels: +{{ include "kestra.labels" $merged | indent 4 }} + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "kestra.selectorsLabels" (merge (dict "Component" $selector) $) | nindent 6 }} diff --git a/kestra/helm/kestra/values.yaml b/kestra/helm/kestra/values.yaml new file mode 100644 index 000000000..7f45fd4d5 --- /dev/null +++ b/kestra/helm/kestra/values.yaml @@ -0,0 +1,267 @@ +### Image +image: + image: kestra/kestra + tag: latest-full + pullPolicy: Always + +imagePullSecrets: [] + + +### Configurations for deployments +configuration: {} + + +### Secrets for deployments +secrets: {} + + +### configuration files +configurationPath: + + +### Kestra executable +executable: /app/kestra + + +### Deployments +deployments: + webserver: + enabled: false + kind: Deployment + replicaCount: 1 + command: "server webserver" + resources: {} + nodeSelector: {} + tolerations: [] + affinity: {} + strategy: {} + podSecurityContext: {} + securityContext: {} + terminationGracePeriodSeconds: 30 + extraContainers: [] + autoscaler: + enabled: false + minReplicas: 1 + maxReplicas: 3 + extra: {} + metrics: [] + # - type: Resource + # resource: + # name: cpu + # target: + # type: Utilization + # averageUtilization: 50 + # - type: Resource + # resource: + # name: memory + # target: + # type: AverageValue + # averageValue: 100Mi + + executor: + enabled: false + kind: Deployment + command: "server executor" + + indexer: + enabled: false + kind: Deployment + command: "server indexer" + + scheduler: + enabled: false + kind: Deployment + command: "server scheduler" + + worker: + enabled: false + kind: Deployment + command: "server worker --thread={{ .Values.deployments.worker.workerThreads }}" + terminationGracePeriodSeconds: 60 + workerThreads: 128 + + standalone: + enabled: true + kind: Deployment + command: "server standalone --worker-thread={{ .Values.deployments.standalone.workerThreads }}" + terminationGracePeriodSeconds: 60 + workerThreads: 128 + +# EE only - Define additional group of workers. +# Must be used in addition to default workers (in standalone or separate worker deployment). +workerGroup: + workergroupname: # name of the worker group + enabled: false + kind: Deployment + command: "server worker --thread={{ .Values.workerGroup.workergroupname.workerThreads }} --worker-group={{ .WorkerGroup }}" + terminationGracePeriodSeconds: 60 + workerThreads: 128 + +# for io.kestra.core.tasks.scripts.Bash task or io.kestra.plugin.scripts.*, attach a docker dind container in order to isolate in a container +# every command launch +dind: + enabled: true + image: + image: docker + tag: dind-rootless + pullPolicy: IfNotPresent + socketPath: /dind/ + tmpPath: /tmp/ + resources: {} + args: + - --log-level=fatal + - --group=1000 + securityContext: + runAsUser: 1000 + runAsGroup: 1000 + extraVolumeMounts: [] + extraEnv: [] + +### Kafka +kafka: + enabled: false + +### ElasticSearch +elasticsearch: + enabled: false + clusterName: "es-kestra" + + esConfig: + elasticsearch.yml: | + xpack: + security: + enabled: false + + antiAffinity: "soft" + + roles: + ml: "false" + + +### Minio +minio: + enabled: true + rootUser: please-change-me + rootPassword: its-not-a-secret + mode: standalone + persistence: + size: 8Gi + buckets: + - name: kestra + policy: none + purge: false + resources: + requests: + memory: 512Mi + +### Postgresql +postgresql: + enabled: true + auth: + database: kestra + username: kestra + password: kestra + + primary: + persistence: + enabled: true + size: 8Gi + +### Service +service: + type: ClusterIP + port: 8080 + annotations: {} + + +### Ingress +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 + + +### Global Deployement +nameOverride: "" +serviceAccountName: "" + + +### Annotations for deployments +annotations: {} +podAnnotations: {} +initContainers: [] + +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 + +terminationGracePeriodSeconds: 30 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +extraVolumeMounts: [] + +extraVolumes: [] + +extraEnv: [] + +extraContainers: [] + +podSecurityContext: {} +# fsGroup: 2000 + +securityContext: + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + runAsUser: 1000 + runAsGroup: 1000 + +### Readiness / Liveness probe config. +### ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/ +readinessProbe: + enabled: true + path: /health + port: management + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 5 + successThreshold: 1 + failureThreshold: 3 + httpGetExtra: {} + +livenessProbe: + enabled: true + path: /health + port: management + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 5 + successThreshold: 1 + failureThreshold: 3 + httpGetExtra: {} diff --git a/kestra/plural/icons/kestra.png b/kestra/plural/icons/kestra.png new file mode 100644 index 000000000..d573507c0 Binary files /dev/null and b/kestra/plural/icons/kestra.png differ diff --git a/kestra/plural/notes.tpl b/kestra/plural/notes.tpl new file mode 100644 index 000000000..f07fda093 --- /dev/null +++ b/kestra/plural/notes.tpl @@ -0,0 +1 @@ +Use `plural watch kestra` to track the status of your application \ No newline at end of file diff --git a/kestra/plural/recipes/kestra-aws.yaml b/kestra/plural/recipes/kestra-aws.yaml new file mode 100644 index 000000000..9b1f94b0f --- /dev/null +++ b/kestra/plural/recipes/kestra-aws.yaml @@ -0,0 +1,20 @@ +name: kestra-aws +description: Installs kestra on an aws eks cluster +provider: AWS +primary: true +dependencies: +- repo: bootstrap + name: aws-k8s + + +- repo: postgres + name: aws-postgres + +sections: +- name: kestra + configuration: [] + items: + - type: TERRAFORM + name: aws + - type: HELM + name: kestra diff --git a/kestra/plural/recipes/kestra-azure.yaml b/kestra/plural/recipes/kestra-azure.yaml new file mode 100644 index 000000000..962f5c38a --- /dev/null +++ b/kestra/plural/recipes/kestra-azure.yaml @@ -0,0 +1,20 @@ +name: kestra-azure +description: Installs kestra on an aws eks cluster +provider: AZURE +primary: true +dependencies: +- repo: bootstrap + name: azure-k8s + + +- repo: postgres + name: azure-postgres + +sections: +- name: kestra + configuration: [] + items: + - type: TERRAFORM + name: azure + - type: HELM + name: kestra diff --git a/kestra/plural/recipes/kestra-gcp.yaml b/kestra/plural/recipes/kestra-gcp.yaml new file mode 100644 index 000000000..747cced9e --- /dev/null +++ b/kestra/plural/recipes/kestra-gcp.yaml @@ -0,0 +1,20 @@ +name: kestra-gcp +description: Installs kestra on an aws eks cluster +provider: GCP +primary: true +dependencies: +- repo: bootstrap + name: gcp-k8s + + +- repo: postgres + name: gcp-postgres + +sections: +- name: kestra + configuration: [] + items: + - type: TERRAFORM + name: gcp + - type: HELM + name: kestra diff --git a/kestra/repository.yaml b/kestra/repository.yaml new file mode 100644 index 000000000..c9adb3199 --- /dev/null +++ b/kestra/repository.yaml @@ -0,0 +1,11 @@ +name: kestra +description: kestra deployed on plural +category: DATA +private: true +icon: plural/icons/kestra.png +notes: plural/notes.tpl +homepage: https://kestra.io +gitUrl: https://github.com/kestra-io/kestra + +contributors: +- akposlive59@gmail.com \ No newline at end of file diff --git a/kestra/terraform/aws/deps.yaml b/kestra/terraform/aws/deps.yaml new file mode 100644 index 000000000..c4fa40aa6 --- /dev/null +++ b/kestra/terraform/aws/deps.yaml @@ -0,0 +1,13 @@ +apiVersion: plural.sh/v1alpha1 +kind: Dependencies +metadata: + description: kestra aws setup + version: 0.1.0 +spec: + dependencies: + - name: aws-bootstrap + repo: bootstrap + type: terraform + version: '>= 0.1.1' + providers: + - aws \ No newline at end of file diff --git a/kestra/terraform/aws/main.tf b/kestra/terraform/aws/main.tf new file mode 100644 index 000000000..a8fc180ee --- /dev/null +++ b/kestra/terraform/aws/main.tf @@ -0,0 +1,32 @@ +resource "kubernetes_namespace" "kestra" { + metadata { + name = var.namespace + labels = { + "app.kubernetes.io/managed-by" = "plural" + "app.plural.sh/name" = "kestra" + + "platform.plural.sh/sync-target" = "pg" + + } + } +} + + +data "aws_iam_role" "postgres" { + name = "${var.cluster_name}-postgres" +} + +resource "kubernetes_service_account" "postgres" { + metadata { + name = "postgres-pod" + namespace = var.namespace + + annotations = { + "eks.amazonaws.com/role-arn" = data.aws_iam_role.postgres.arn + } + } + + depends_on = [ + kubernetes_namespace.kestra + ] +} diff --git a/kestra/terraform/aws/terraform.tfvars b/kestra/terraform/aws/terraform.tfvars new file mode 100644 index 000000000..961103ecf --- /dev/null +++ b/kestra/terraform/aws/terraform.tfvars @@ -0,0 +1,2 @@ +namespace = {{ .Namespace | quote }} +cluster_name = {{ .Cluster | quote }} \ No newline at end of file diff --git a/kestra/terraform/aws/variables.tf b/kestra/terraform/aws/variables.tf new file mode 100644 index 000000000..f2795a2e0 --- /dev/null +++ b/kestra/terraform/aws/variables.tf @@ -0,0 +1,8 @@ +variable "namespace" { + type = string + default = "kestra" +} + +variable "cluster_name" { + type = string +} diff --git a/kestra/terraform/azure/deps.yaml b/kestra/terraform/azure/deps.yaml new file mode 100644 index 000000000..97a07d8ea --- /dev/null +++ b/kestra/terraform/azure/deps.yaml @@ -0,0 +1,13 @@ +apiVersion: plural.sh/v1alpha1 +kind: Dependencies +metadata: + description: kestra azure setup + version: 0.1.0 +spec: + dependencies: + - name: azure-bootstrap + repo: bootstrap + type: terraform + version: '>= 0.1.1' + providers: + - azure \ No newline at end of file diff --git a/kestra/terraform/azure/main.tf b/kestra/terraform/azure/main.tf new file mode 100644 index 000000000..30183d67a --- /dev/null +++ b/kestra/terraform/azure/main.tf @@ -0,0 +1,13 @@ +resource "kubernetes_namespace" "kestra" { + metadata { + name = var.namespace + labels = { + "app.kubernetes.io/managed-by" = "plural" + "app.plural.sh/name" = "kestra" + + "platform.plural.sh/sync-target" = "pg" + + } + } +} + diff --git a/kestra/terraform/azure/terraform.tfvars b/kestra/terraform/azure/terraform.tfvars new file mode 100644 index 000000000..961103ecf --- /dev/null +++ b/kestra/terraform/azure/terraform.tfvars @@ -0,0 +1,2 @@ +namespace = {{ .Namespace | quote }} +cluster_name = {{ .Cluster | quote }} \ No newline at end of file diff --git a/kestra/terraform/azure/variables.tf b/kestra/terraform/azure/variables.tf new file mode 100644 index 000000000..f2795a2e0 --- /dev/null +++ b/kestra/terraform/azure/variables.tf @@ -0,0 +1,8 @@ +variable "namespace" { + type = string + default = "kestra" +} + +variable "cluster_name" { + type = string +} diff --git a/kestra/terraform/gcp/deps.yaml b/kestra/terraform/gcp/deps.yaml new file mode 100644 index 000000000..f20bfa9db --- /dev/null +++ b/kestra/terraform/gcp/deps.yaml @@ -0,0 +1,13 @@ +apiVersion: plural.sh/v1alpha1 +kind: Dependencies +metadata: + description: kestra gcp setup + version: 0.1.0 +spec: + dependencies: + - name: gcp-bootstrap + repo: bootstrap + type: terraform + version: '>= 0.1.1' + providers: + - gcp \ No newline at end of file diff --git a/kestra/terraform/gcp/main.tf b/kestra/terraform/gcp/main.tf new file mode 100644 index 000000000..30183d67a --- /dev/null +++ b/kestra/terraform/gcp/main.tf @@ -0,0 +1,13 @@ +resource "kubernetes_namespace" "kestra" { + metadata { + name = var.namespace + labels = { + "app.kubernetes.io/managed-by" = "plural" + "app.plural.sh/name" = "kestra" + + "platform.plural.sh/sync-target" = "pg" + + } + } +} + diff --git a/kestra/terraform/gcp/terraform.tfvars b/kestra/terraform/gcp/terraform.tfvars new file mode 100644 index 000000000..961103ecf --- /dev/null +++ b/kestra/terraform/gcp/terraform.tfvars @@ -0,0 +1,2 @@ +namespace = {{ .Namespace | quote }} +cluster_name = {{ .Cluster | quote }} \ No newline at end of file diff --git a/kestra/terraform/gcp/variables.tf b/kestra/terraform/gcp/variables.tf new file mode 100644 index 000000000..f2795a2e0 --- /dev/null +++ b/kestra/terraform/gcp/variables.tf @@ -0,0 +1,8 @@ +variable "namespace" { + type = string + default = "kestra" +} + +variable "cluster_name" { + type = string +}