Skip to content

Commit

Permalink
Added helm chart for Flyte core (flyteorg#1366)
Browse files Browse the repository at this point in the history
* refactor dir structure for helm

Signed-off-by: Yuvraj <[email protected]>

* Rebase master

Signed-off-by: Yuvraj <[email protected]>

* Added sandbox value in flyte-core

Signed-off-by: Yuvraj <[email protected]>

* more changes

Signed-off-by: Yuvraj <[email protected]>

* Remove redis from flyte-core

Signed-off-by: Yuvraj <[email protected]>
  • Loading branch information
yindia authored Aug 30, 2021
1 parent fcf5cb8 commit 506408b
Show file tree
Hide file tree
Showing 35 changed files with 2,785 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ release/
__pycache__/
/charts/flyte/charts
/charts/flyte/Chart.lock
/charts/flyte-core/Chart.lock
**/*.bak-
bin/-
bin/
Expand Down
23 changes: 23 additions & 0 deletions charts/flyte-core/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
5 changes: 5 additions & 0 deletions charts/flyte-core/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v2
name: flyte-core
description: A Helm chart for Flyte
type: application
version: v0.1.10 # VERSION
168 changes: 168 additions & 0 deletions charts/flyte-core/README.md

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions charts/flyte-core/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}

{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}

{{ template "chart.description" . }}

{{ template "chart.homepageLine" . }}

{{ template "chart.maintainersSection" . }}

{{ template "chart.sourcesSection" . }}

{{ template "chart.requirementsSection" . }}

### Flyte INSTALLATION:
- [Install helm 3](https://helm.sh/docs/intro/install/)
- Fetch chart dependencies ``
- Install Flyte:

```bash
helm repo add flyte https://flyteorg.github.io/flyte
helm install -n flyte -f values-eks.yaml --create-namespace flyte flyte/flyte-core
```

Customize your installation by changing settings in `values-eks.yaml`.
You can use the helm diff plugin to review any value changes you've made to your values:

```bash
helm plugin install https://github.com/databus23/helm-diff
helm diff upgrade -f values-eks.yaml flyte flyte/flyte-core
```

Then apply your changes:
```bash
helm upgrade -f values-eks.yaml flyte flyte/flyte-core
```

Install ingress controller (By default Flyte helm chart have contour ingress resource)
```bash
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install gateway bitnami/contour -n flyte
```

#### Alternative: Generate raw kubernetes yaml with helm template
- `helm template --name-template=flyte-eks . -n flyte -f values-eks.yaml > flyte_generated_eks.yaml`
- Deploy the manifest `kubectl apply -f flyte_generated_eks.yaml`


- When all pods are running - run end2end tests: `kubectl apply -f ../end2end/tests/endtoend.yaml`
- Get flyte host `minikube service contour -n heptio-contour --url`. And then visit `http://<HOST>/console`

### CONFIGURATION NOTES:
- The docker images, their tags and other default parameters are configured in `values.yaml` file.
- Each Flyte installation type should have separate `values-*.yaml` file: for sandbox, EKS and etc. The configuration in `values.yaml` and the choosen config `values-*.yaml` are merged when generating the deployment manifest.
- The configuration in `values-sandbox.yaml` is ready for installation in minikube. But `values-eks.yaml` should be edited before installation: s3 bucket, RDS hosts, iam roles, secrets and etc need to be modified.

{{ template "chart.valuesSection" . }}
149 changes: 149 additions & 0 deletions charts/flyte-core/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
{{/* vim: set filetype=mustache: */}}

{{- define "flyte.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "flyte.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "flyte.namespace" -}}
{{- default .Release.Namespace .Values.forceNamespace | trunc 63 | trimSuffix "-" -}}
{{- end -}}


{{- define "flyteadmin.name" -}}
flyteadmin
{{- end -}}

{{- define "flyteadmin.selectorLabels" -}}
app.kubernetes.io/name: {{ template "flyteadmin.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{- define "flyteadmin.labels" -}}
{{ include "flyteadmin.selectorLabels" . }}
helm.sh/chart: {{ include "flyte.chart" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}


{{- define "datacatalog.name" -}}
datacatalog
{{- end -}}

{{- define "datacatalog.selectorLabels" -}}
app.kubernetes.io/name: {{ template "datacatalog.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{- define "datacatalog.labels" -}}
{{ include "datacatalog.selectorLabels" . }}
helm.sh/chart: {{ include "flyte.chart" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}


{{- define "flytepropeller.name" -}}
flytepropeller
{{- end -}}

{{- define "flytepropeller.selectorLabels" -}}
app.kubernetes.io/name: {{ template "flytepropeller.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{- define "flytepropeller.labels" -}}
{{ include "flytepropeller.selectorLabels" . }}
helm.sh/chart: {{ include "flyte.chart" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{- define "flyte-pod-webhook.name" -}}
flyte-pod-webhook
{{- end -}}


{{- define "flyteconsole.name" -}}
flyteconsole
{{- end -}}

{{- define "flyteconsole.selectorLabels" -}}
app.kubernetes.io/name: {{ template "flyteconsole.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{- define "flyteconsole.labels" -}}
{{ include "flyteconsole.selectorLabels" . }}
helm.sh/chart: {{ include "flyte.chart" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

# Optional blocks for secret mount

{{- define "databaseSecret.volume" -}}
{{- with .Values.common.databaseSecret.name -}}
- name: {{ . }}
secret:
secretName: {{ . }}
{{- end }}
{{- end }}

{{- define "databaseSecret.volumeMount" -}}
{{- with .Values.common.databaseSecret.name -}}
- mountPath: /etc/db
name: {{ . }}
{{- end }}
{{- end }}

{{- define "storage.base" -}}
storage:
{{- if eq .Values.storage.type "s3" }}
type: s3
container: {{ .Values.storage.bucketName | quote }}
connection:
auth-type: iam
region: {{ .Values.storage.s3.region }}
{{- else if eq .Values.storage.type "gcs" }}
type: stow
stow:
kind: google
config:
json: ""
project_id: {{ .Values.storage.gcs.projectId }}
scopes: https://www.googleapis.com/auth/devstorage.read_write
container: {{ .Values.storage.bucketName | quote }}
{{- else if eq .Values.storage.type "sandbox" }}
type: minio
container: {{ .Values.storage.bucketName | quote }}
connection:
access-key: minio
auth-type: accesskey
secret-key: miniostorage
disable-ssl: true
endpoint: http://minio.{{ .Release.Namespace }}.svc.cluster.local:9000
region: us-east-1
{{- else if eq .Values.storage.type "custom" }}
{{- with .Values.storage.custom -}}
{{ toYaml . | nindent 2 }}
{{- end }}
{{- end }}
{{- end }}

{{- define "storage" -}}
{{ include "storage.base" .}}
limits:
maxDownloadMBs: 10
{{- end }}

{{- define "copilot.config" -}}
kind: ConfigMap
apiVersion: v1
metadata:
name: flyte-data-config
namespace: {{`{{ namespace }}`}}
data:
config.yaml: | {{ tpl (include "storage.base" .) $ | nindent 4 }}
enable-multicontainer: true
{{- end }}
13 changes: 13 additions & 0 deletions charts/flyte-core/templates/admin/cluster_resource_configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.cluster_resource_manager.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: clusterresource-template
namespace: {{ template "flyte.namespace" . }}
labels: {{ include "flyteadmin.labels" . | nindent 4 }}
data:
{{- range .Values.cluster_resource_manager.templates }}
{{ .key }}.yaml: | {{ .value | nindent 4 }}
{{- end }}
zz_copilot_config.yaml: | {{ include "copilot.config" . | nindent 4 }}
{{- end }}
41 changes: 41 additions & 0 deletions charts/flyte-core/templates/admin/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: flyte-admin-config
namespace: {{ template "flyte.namespace" . }}
labels: {{ include "flyteadmin.labels" . | nindent 4 }}
data:
{{- with .Values.db }}
db.yaml: | {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
{{- with .Values.configmap.domain }}
domain.yaml: | {{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.configmap.logger }}
logger.yaml: | {{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.configmap.adminServer }}
server.yaml: | {{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.configmap.remoteData }}
remoteData.yaml: | {{ toYaml . | nindent 4 }}
{{- end }}
storage.yaml: | {{ tpl (include "storage" .) $ | nindent 4 }}
{{- with .Values.configmap.task_resource_defaults }}
task_resource_defaults.yaml: | {{ toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.workflow_notifications.enabled }}
{{- with .Values.workflow_notifications.config }}
notifications.yaml: | {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
{{- end }}
{{- if .Values.cluster_resource_manager.enabled }}
{{- with .Values.cluster_resource_manager.config }}
cluster_resources.yaml: | {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
{{- end }}
{{- if .Values.workflow_scheduler.enabled }}
{{- with .Values.workflow_scheduler.config }}
scheduler.yaml: | {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
{{- end }}
42 changes: 42 additions & 0 deletions charts/flyte-core/templates/admin/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- if .Values.cluster_resource_manager.enabled }}
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: syncresources
namespace: {{ template "flyte.namespace" . }}
labels: {{ include "flyteadmin.labels" . | nindent 4 }}
spec:
schedule: '*/1 * * * *'
jobTemplate:
spec:
template:
{{- with .Values.flyteadmin.podAnnotations }}
metadata:
annotations: {{ toYaml . | nindent 12 }}
{{- end }}
spec:
containers:
- command:
- flyteadmin
- --config
- {{ .Values.flyteadmin.configPath }}
- clusterresource
- sync
image: "{{ .Values.flyteadmin.image.repository }}:{{ .Values.flyteadmin.image.tag }}"
imagePullPolicy: "{{ .Values.flyteadmin.image.pullPolicy }}"
name: sync-cluster-resources
volumeMounts: {{- include "databaseSecret.volumeMount" . | nindent 12 }}
- mountPath: /etc/flyte/clusterresource/templates
name: resource-templates
- mountPath: /etc/flyte/config
name: config-volume
restartPolicy: OnFailure
serviceAccountName: flyteadmin
volumes: {{- include "databaseSecret.volume" . | nindent 10 }}
- configMap:
name: clusterresource-template
name: resource-templates
- configMap:
name: flyte-admin-config
name: config-volume
{{- end }}
Loading

0 comments on commit 506408b

Please sign in to comment.