diff --git a/dask/README.md b/dask/README.md index c0ce310..0bc1819 100644 --- a/dask/README.md +++ b/dask/README.md @@ -60,6 +60,7 @@ The following table lists the configurable parameters of the Dask chart and thei | Parameter | Description | Default | | ------------------------ | ----------------------- | -------------- | | `scheduler.name` | Dask scheduler name. | `"scheduler"` | +| `scheduler.component` | | `"scheduler"` | | `scheduler.enabled` | Enable/disable scheduler. | `true` | | `scheduler.image.repository` | Container image repository. | `"ghcr.io/dask/dask"` | | `scheduler.image.tag` | Container image tag. | `"2022.6.1"` | @@ -72,6 +73,7 @@ The following table lists the configurable parameters of the Dask chart and thei | `scheduler.serviceAnnotations` | Scheduler service annotations. | `{}` | | `scheduler.extraArgs` | | `[]` | | `scheduler.resources` | Scheduler pod resources. See `values.yaml` for example values. | `{}` | +| `scheduler.annotations` | Annotations | `{}` | | `scheduler.tolerations` | Tolerations. | `[]` | | `scheduler.affinity` | Container affinity. | `{}` | | `scheduler.nodeSelector` | Node Selector. | `{}` | @@ -93,6 +95,7 @@ The following table lists the configurable parameters of the Dask chart and thei | `webUI.ingress.hostname` | Ingress hostname. | `"dask-ui.example.com"` | | `webUI.ingress.annotations` | | `{}` | | `worker.name` | Dask worker name. | `"worker"` | +| `worker.component` | | `"worker"` | | `worker.image.repository` | Container image repository. | `"ghcr.io/dask/dask"` | | `worker.image.tag` | Container image tag. | `"2022.6.1"` | | `worker.image.pullPolicy` | Container image pull policy. | `"IfNotPresent"` | @@ -124,6 +127,7 @@ The following table lists the configurable parameters of the Dask chart and thei | `worker.metrics.podMonitor.metricRelabelings` | MetricRelabelConfigs to apply to samples before ingestion. | `[]` | | `additional_worker_groups` | Additional groups of workers to create. List of groups with same options as `worker`. | `[]` | | `jupyter.name` | Jupyter name. | `"jupyter"` | +| `jupyter.component` | | `"jupyter"` | | `jupyter.enabled` | Enable/disable the bundled Jupyter notebook. | `true` | | `jupyter.rbac` | Create RBAC service account and role to allow Jupyter pod to scale worker pods and access logs. | `true` | | `jupyter.image.repository` | Container image repository. | `"ghcr.io/dask/dask-notebook"` | @@ -140,6 +144,7 @@ The following table lists the configurable parameters of the Dask chart and thei | `jupyter.extraConfig` | | `"# Extra Jupyter config goes here\n# E.g\n# c.NotebookApp.port = 8888"` | | `jupyter.resources` | Jupyter pod resources. See `values.yaml` for example values. | `{}` | | `jupyter.mounts` | Worker Pod volumes and volume mounts, mounts.volumes follows kuberentes api v1 Volumes spec. mounts.volumeMounts follows kubernetesapi v1 VolumeMount spec | `{}` | +| `jupyter.annotations` | Annotations | `{}` | | `jupyter.tolerations` | Tolerations. | `[]` | | `jupyter.affinity` | Container affinity. | `{}` | | `jupyter.nodeSelector` | Node Selector. | `{}` | @@ -150,6 +155,7 @@ The following table lists the configurable parameters of the Dask chart and thei | `jupyter.ingress.pathType` | set pathType in ingress | `"Prefix"` | | `jupyter.ingress.hostname` | Ingress hostname. | `"dask-jupyter.example.com"` | | `jupyter.ingress.annotations` | | `{}` | +| `label.style` | helm|kubernetes | `"helm"` | #### Jupyter Password diff --git a/dask/templates/_helpers.tpl b/dask/templates/_helpers.tpl index 527d9f7..d983007 100644 --- a/dask/templates/_helpers.tpl +++ b/dask/templates/_helpers.tpl @@ -30,3 +30,50 @@ Create chart name and version as used by the chart label. {{- define "dask.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{/* +Common labels +*/}} +{{- define "dask.labels" -}} +{{- $ := index . 1 }} +{{- with index . 0 }} +{{- if eq "kubernetes" $.Values.label.style }} +helm.sh/chart: {{ include "dask.chart" $ }} +{{- else }} +chart: {{ include "dask.chart" $ }} +{{- end }} +{{- include "dask.selectorLabels" (list . $) }} +{{- if $.Chart.AppVersion }} +{{- if eq "kubernetes" $.Values.label.style }} +app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }} +{{- else }} +version: {{ $.Chart.AppVersion | quote }} +{{- end }} +{{- end }} +{{- if eq "kubernetes" $.Values.label.style }} +app.kubernetes.io/part-of: {{ include "dask.fullname" $ }} +app.kubernetes.io/managed-by: {{ $.Release.Service }} +app.kubernetes.io/created-by: {{ include "dask.chart" $ }} +{{- else }} +heritage: {{ $.Release.Service }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "dask.selectorLabels" -}} +{{- $ := index . 1 }} +{{- with index . 0 }} +{{- if eq "kubernetes" $.Values.label.style }} +app.kubernetes.io/name: {{ include "dask.name" $ }}-{{ .name }} +app.kubernetes.io/instance: {{ include "dask.name" $ }}-{{ .name }} +app.kubernetes.io/component: {{ .component }} +{{- else }} +app: {{ include "dask.name" $ }} +release: {{ $.Release.Name | quote }} +component: {{ .component }} +{{- end }} +{{- end }} +{{- end }} diff --git a/dask/templates/additional-worker-deployment.yaml b/dask/templates/additional-worker-deployment.yaml index 901f806..401a715 100644 --- a/dask/templates/additional-worker-deployment.yaml +++ b/dask/templates/additional-worker-deployment.yaml @@ -5,26 +5,18 @@ kind: Deployment metadata: name: {{ template "dask.fullname" $ }}-worker-{{ $worker.name }} labels: - app: {{ template "dask.name" $ }} - heritage: {{ $.Release.Service | quote }} - release: {{ $.Release.Name | quote }} - chart: {{ template "dask.chart" $ }} - component: worker + {{- include "dask.labels" (list $worker $) | nindent 4 }} spec: replicas: {{ $worker.replicas }} selector: matchLabels: - app: {{ template "dask.name" $ }} - release: {{ $.Release.Name | quote }} - component: worker + {{- include "dask.selectorLabels" (list $worker $) | nindent 6 }} strategy: type: {{ $worker.strategy.type }} template: metadata: labels: - app: {{ template "dask.name" $ }} - release: {{ $.Release.Name | quote }} - component: worker + {{- include "dask.selectorLabels" (list $worker $) | nindent 8 }} {{- with $worker.annotations }} annotations: {{- . | toYaml | nindent 8 }} diff --git a/dask/templates/dask-jupyter-config.yaml b/dask/templates/dask-jupyter-config.yaml index d4b7990..092536f 100644 --- a/dask/templates/dask-jupyter-config.yaml +++ b/dask/templates/dask-jupyter-config.yaml @@ -4,11 +4,7 @@ kind: ConfigMap metadata: name: {{ template "dask.fullname" . }}-jupyter-config labels: - app: {{ template "dask.name" . }} - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: {{ template "dask.chart" . }} - component: jupyter + {{- include "dask.labels" (list .Values.jupyter $) | nindent 4 }} data: jupyter_notebook_config.py: | c = get_config() diff --git a/dask/templates/dask-jupyter-deployment.yaml b/dask/templates/dask-jupyter-deployment.yaml index 4fadf9f..3f74aa7 100644 --- a/dask/templates/dask-jupyter-deployment.yaml +++ b/dask/templates/dask-jupyter-deployment.yaml @@ -4,26 +4,22 @@ kind: Deployment metadata: name: {{ template "dask.fullname" . }}-jupyter labels: - app: {{ template "dask.name" . }} - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: {{ template "dask.chart" . }} - component: jupyter + {{- include "dask.labels" (list .Values.jupyter $) | nindent 4 }} spec: replicas: {{ .Values.jupyter.replicas }} selector: matchLabels: - app: {{ template "dask.name" . }} - release: {{ .Release.Name | quote }} - component: jupyter + {{- include "dask.selectorLabels" (list .Values.jupyter $) | nindent 6 }} strategy: type: RollingUpdate template: metadata: labels: - app: {{ template "dask.name" . }} - release: {{ .Release.Name | quote }} - component: jupyter + {{- include "dask.selectorLabels" (list .Values.jupyter $) | nindent 8 }} + {{- with .Values.jupyter.annotations }} + annotations: + {{- . | toYaml | nindent 8 }} + {{- end }} spec: {{- with .Values.jupyter.image.pullSecrets }} imagePullSecrets: diff --git a/dask/templates/dask-jupyter-ingress.yaml b/dask/templates/dask-jupyter-ingress.yaml index d16830b..29141b3 100644 --- a/dask/templates/dask-jupyter-ingress.yaml +++ b/dask/templates/dask-jupyter-ingress.yaml @@ -8,13 +8,10 @@ kind: Ingress metadata: name: {{ template "dask.fullname" . }}-jupyter labels: - app: {{ template "dask.fullname" . }}-jupyter - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" + {{- include "dask.labels" (list .Values.jupyter $) | nindent 4 }} {{- with .Values.jupyter.ingress.annotations }} annotations: - {{ . | toYaml | indent 4 }} + {{ . | toYaml | nindent 4 }} {{- end }} spec: {{- with .Values.jupyter.ingress.ingressClassName }} diff --git a/dask/templates/dask-jupyter-service.yaml b/dask/templates/dask-jupyter-service.yaml index 6d5dc63..ae372a9 100644 --- a/dask/templates/dask-jupyter-service.yaml +++ b/dask/templates/dask-jupyter-service.yaml @@ -4,19 +4,13 @@ kind: Service metadata: name: {{ template "dask.fullname" . }}-jupyter labels: - app: {{ template "dask.name" . }} - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: {{ template "dask.chart" . }} - component: jupyter + {{- include "dask.labels" (list .Values.jupyter $) | nindent 4 }} spec: ports: - name: {{ template "dask.fullname" . }}-jupyter port: {{ .Values.jupyter.servicePort }} targetPort: 8888 selector: - app: {{ template "dask.name" . }} - release: {{ .Release.Name | quote }} - component: jupyter + {{- include "dask.selectorLabels" (list .Values.jupyter $) | nindent 4 }} type: {{ .Values.jupyter.serviceType }} {{- end }} diff --git a/dask/templates/dask-jupyter-serviceaccount.yaml b/dask/templates/dask-jupyter-serviceaccount.yaml index a3acc4a..7e22214 100644 --- a/dask/templates/dask-jupyter-serviceaccount.yaml +++ b/dask/templates/dask-jupyter-serviceaccount.yaml @@ -5,10 +5,8 @@ metadata: name: dask-jupyter namespace: {{ .Release.Namespace }} labels: - app: {{ template "dask.name" . }} - release: {{ .Release.Name | quote }} - component: jupyter - + {{- include "dask.selectorLabels" (list .Values.jupyter $) | nindent 4 }} + --- kind: Role @@ -17,9 +15,7 @@ metadata: name: dask-jupyter namespace: {{ .Release.Namespace }} labels: - app: {{ template "dask.name" . }} - release: {{ .Release.Name | quote }} - component: jupyter + {{- include "dask.selectorLabels" (list .Values.jupyter $) | nindent 4 }} rules: - apiGroups: ["apps"] resources: ["deployments"] @@ -39,9 +35,7 @@ metadata: name: dask-jupyter namespace: {{ .Release.Namespace }} labels: - app: {{ template "dask.name" . }} - release: {{ .Release.Name | quote }} - component: jupyter + {{- include "dask.selectorLabels" (list .Values.jupyter $) | nindent 4 }} subjects: - kind: ServiceAccount name: dask-jupyter diff --git a/dask/templates/dask-scheduler-deployment.yaml b/dask/templates/dask-scheduler-deployment.yaml index a626050..f868610 100644 --- a/dask/templates/dask-scheduler-deployment.yaml +++ b/dask/templates/dask-scheduler-deployment.yaml @@ -4,26 +4,22 @@ kind: Deployment metadata: name: {{ template "dask.fullname" . }}-scheduler labels: - app: {{ template "dask.name" . }} - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: {{ template "dask.chart" . }} - component: scheduler + {{- include "dask.labels" (list .Values.scheduler $) | nindent 4 }} spec: replicas: {{ .Values.scheduler.replicas }} selector: matchLabels: - app: {{ template "dask.name" . }} - release: {{ .Release.Name | quote }} - component: scheduler + {{- include "dask.selectorLabels" (list .Values.scheduler $) | nindent 6 }} strategy: type: RollingUpdate template: metadata: labels: - app: {{ template "dask.name" . }} - release: {{ .Release.Name | quote }} - component: scheduler + {{- include "dask.selectorLabels" (list .Values.scheduler $) | nindent 8 }} + {{- with .Values.scheduler.annotations }} + annotations: + {{- . | toYaml | nindent 8 }} + {{- end }} spec: {{- with .Values.scheduler.image.pullSecrets }} imagePullSecrets: diff --git a/dask/templates/dask-scheduler-ingress.yaml b/dask/templates/dask-scheduler-ingress.yaml index 4667953..b3dadf2 100644 --- a/dask/templates/dask-scheduler-ingress.yaml +++ b/dask/templates/dask-scheduler-ingress.yaml @@ -8,13 +8,10 @@ kind: Ingress metadata: name: {{ template "dask.fullname" . }}-scheduler labels: - app: {{ template "dask.fullname" . }}-scheduler - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" + {{- include "dask.labels" (list .Values.scheduler $) | nindent 4 }} {{- with .Values.webUI.ingress.annotations }} annotations: - {{ . | toYaml | indent 4 }} + {{ . | toYaml | nindent 4 }} {{- end }} spec: {{- with .Values.webUI.ingress.ingressClassName }} diff --git a/dask/templates/dask-scheduler-service.yaml b/dask/templates/dask-scheduler-service.yaml index 0d8ba5b..e831d7d 100644 --- a/dask/templates/dask-scheduler-service.yaml +++ b/dask/templates/dask-scheduler-service.yaml @@ -4,11 +4,7 @@ kind: Service metadata: name: {{ template "dask.fullname" . }}-scheduler labels: - app: {{ template "dask.name" . }} - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: {{ template "dask.chart" . }} - component: scheduler + {{- include "dask.labels" (list .Values.scheduler $) | nindent 4 }} {{- with .Values.scheduler.serviceAnnotations }} annotations: {{- . | toYaml | nindent 4 }} @@ -22,9 +18,7 @@ spec: port: {{ .Values.webUI.servicePort }} targetPort: 8787 selector: - app: {{ template "dask.name" . }} - release: {{ .Release.Name | quote }} - component: scheduler + {{- include "dask.selectorLabels" (list .Values.scheduler $) | nindent 4 }} type: {{ .Values.scheduler.serviceType }} {{- with .Values.scheduler.loadBalancerIP }} loadBalancerIP: {{ . }} diff --git a/dask/templates/dask-scheduler-servicemonitor.yaml b/dask/templates/dask-scheduler-servicemonitor.yaml index dad2ded..928d633 100644 --- a/dask/templates/dask-scheduler-servicemonitor.yaml +++ b/dask/templates/dask-scheduler-servicemonitor.yaml @@ -7,11 +7,7 @@ metadata: namespace: {{ . | quote }} {{- end }} labels: - app: {{ template "dask.name" . }} - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: {{ template "dask.chart" . }} - component: scheduler + {{- include "dask.labels" (list .Values.scheduler $) | nindent 4 }} {{- with .Values.scheduler.metrics.serviceMonitor.additionalLabels }} {{- . | toYaml | nindent 4 }} {{- end }} @@ -40,7 +36,5 @@ spec: {{- end }} selector: matchLabels: - app: {{ template "dask.name" . }} - release: {{ .Release.Name | quote }} - component: scheduler + {{- include "dask.selectorLabels" (list .Values.scheduler $) | nindent 6 }} {{- end }} diff --git a/dask/templates/dask-worker-deployment.yaml b/dask/templates/dask-worker-deployment.yaml index 1233919..0e010e6 100644 --- a/dask/templates/dask-worker-deployment.yaml +++ b/dask/templates/dask-worker-deployment.yaml @@ -3,26 +3,18 @@ kind: Deployment metadata: name: {{ template "dask.fullname" . }}-worker labels: - app: {{ template "dask.name" . }} - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: {{ template "dask.chart" . }} - component: worker + {{- include "dask.labels" (list .Values.worker $) | nindent 4 }} spec: replicas: {{ .Values.worker.replicas }} selector: matchLabels: - app: {{ template "dask.name" . }} - release: {{ .Release.Name | quote }} - component: worker + {{- include "dask.selectorLabels" (list .Values.worker $) | nindent 6 }} strategy: type: {{ .Values.worker.strategy.type }} template: metadata: labels: - app: {{ template "dask.name" . }} - release: {{ .Release.Name | quote }} - component: worker + {{- include "dask.selectorLabels" (list .Values.worker $) | nindent 8 }} {{- with .Values.worker.annotations }} annotations: {{- . | toYaml | nindent 8 }} diff --git a/dask/templates/dask-worker-podmonitor.yaml b/dask/templates/dask-worker-podmonitor.yaml index f93bd53..29c844c 100644 --- a/dask/templates/dask-worker-podmonitor.yaml +++ b/dask/templates/dask-worker-podmonitor.yaml @@ -7,11 +7,7 @@ metadata: namespace: {{ . | quote }} {{- end }} labels: - app: {{ template "dask.name" . }} - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: {{ template "dask.chart" . }} - component: worker + {{- include "dask.labels" (list .Values.worker $) | nindent 4 }} {{- with .Values.worker.metrics.podMonitor.additionalLabels }} {{- . | toYaml | nindent 4 }} {{- end }} @@ -41,7 +37,5 @@ spec: {{- end }} selector: matchLabels: - app: {{ template "dask.name" . }} - release: {{ .Release.Name | quote }} - component: worker + {{- include "dask.selectorLabels" (list .Values.worker $) | nindent 6 }} {{- end }} diff --git a/dask/values.yaml b/dask/values.yaml index 99b61b0..517d7c4 100644 --- a/dask/values.yaml +++ b/dask/values.yaml @@ -4,6 +4,7 @@ scheduler: name: scheduler # Dask scheduler name. + component: scheduler enabled: true # Enable/disable scheduler. image: repository: "ghcr.io/dask/dask" # Container image repository. @@ -29,6 +30,7 @@ scheduler: # requests: # cpu: 1.8 # memory: 6G + annotations: {} # Annotations tolerations: [] # Tolerations. affinity: {} # Container affinity. nodeSelector: {} # Node Selector. @@ -55,7 +57,7 @@ webUI: servicePort: 80 # webui service internal port. ingress: enabled: false # Enable ingress. - # ingressClassName: + # ingressClassName: pathType: Prefix # set pathType in ingress tls: false # Ingress should use TLS. # secretName: dask-scheduler-tls @@ -68,6 +70,7 @@ webUI: worker: name: worker # Dask worker name. + component: worker image: repository: "ghcr.io/dask/dask" # Container image repository. tag: "2022.6.1" # Container image tag. @@ -152,6 +155,7 @@ additional_worker_groups: [] # Additional groups of workers to create. List of g jupyter: name: jupyter # Jupyter name. + component: jupyter enabled: true # Enable/disable the bundled Jupyter notebook. rbac: true # Create RBAC service account and role to allow Jupyter pod to scale worker pods and access logs. image: @@ -196,6 +200,7 @@ jupyter: # volumeMounts: # - name: data # mountPath: /data + annotations: {} # Annotations tolerations: [] # Tolerations. affinity: {} # Container affinity. nodeSelector: {} # Node Selector. @@ -203,7 +208,7 @@ jupyter: serviceAccountName: "dask-jupyter" # Service account for use with RBAC ingress: enabled: false # Enable ingress. - # ingressClassName: + # ingressClassName: tls: false # Ingress should use TLS. # secretName: dask-jupyter-tls pathType: Prefix # set pathType in ingress @@ -213,3 +218,6 @@ jupyter: # kuernetesbernetes.io/ingress.class: "nginx" # secretName: my-tls-cert # kub.io/tls-acme: "true" + +label: + style: helm # helm|kubernetes