Skip to content

Commit 8190529

Browse files
samdyzonSam Dysonjacobtomlinson
authored
feat: add service account roles/rolebinding to operator helm chart (#480)
* feat: add service account roles/rolebinding to helm chart, and add some doco for using the helm chart * Apply suggestions from code review Co-authored-by: Sam Dyson <sam.dyson@quantifiedstrategies.com.au> Co-authored-by: Jacob Tomlinson <jacobtomlinson@users.noreply.github.com>
1 parent 3967206 commit 8190529

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

dask_kubernetes/operator/deployment/helm/dask-kubernetes-operator/templates/serviceaccount.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,56 @@ metadata:
99
annotations:
1010
{{- toYaml . | nindent 4 }}
1111
{{- end }}
12+
---
13+
apiVersion: rbac.authorization.k8s.io/v1
14+
kind: ClusterRole
15+
metadata:
16+
name: {{ include "dask_kubernetes_operator.serviceAccountName" . }}-role-cluster
17+
rules:
18+
# Framework: knowing which other operators are running (i.e. peering).
19+
- apiGroups: [kopf.dev]
20+
resources: [clusterkopfpeerings]
21+
verbs: [list, watch, patch, get]
22+
23+
# Framework: runtime observation of namespaces & CRDs (addition/deletion).
24+
- apiGroups: [apiextensions.k8s.io]
25+
resources: [customresourcedefinitions]
26+
verbs: [list, watch]
27+
- apiGroups: [""]
28+
resources: [namespaces]
29+
verbs: [list, watch]
30+
31+
# Framework: admission webhook configuration management.
32+
- apiGroups:
33+
[admissionregistration.k8s.io/v1, admissionregistration.k8s.io/v1beta1]
34+
resources: [validatingwebhookconfigurations, mutatingwebhookconfigurations]
35+
verbs: [create, patch]
36+
37+
# Application: watching & handling for the custom resource we declare.
38+
- apiGroups: [kubernetes.dask.org]
39+
resources: [daskclusters, daskworkergroups]
40+
verbs: [get, list, watch, patch, create, delete]
41+
42+
# Application: other resources it produces and manipulates.
43+
# Here, we create/delete Pods.
44+
- apiGroups: [""]
45+
resources: [pods]
46+
verbs: [create, delete, get, watch, list]
47+
48+
- apiGroups: [""]
49+
resources: [services]
50+
verbs: [create, delete, get, watch, list]
51+
---
52+
apiVersion: rbac.authorization.k8s.io/v1
53+
kind: ClusterRoleBinding
54+
metadata:
55+
name: {{ include "dask_kubernetes_operator.serviceAccountName" . }}-rolebinding-cluster
56+
roleRef:
57+
apiGroup: rbac.authorization.k8s.io
58+
kind: ClusterRole
59+
name: {{ include "dask_kubernetes_operator.serviceAccountName" . }}-role-cluster
60+
subjects:
61+
- kind: ServiceAccount
62+
name: {{ include "dask_kubernetes_operator.serviceAccountName" . }}
63+
namespace: {{ .Release.Namespace }}
1264
{{- end }}

doc/source/operator.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,25 @@ This will create the appropriate roles, service accounts and a deployment for th
4141
kube-system dask-kubernetes-operator-775b8bbbd5-zdrf7 1/1 Running 0 74s
4242
4343
44+
Installing the operator with Helm
45+
---------------------------------
46+
47+
Along with a set of kubernetes manifests, the operator has a basic Helm chart which can be used to manage the installation of the operator.
48+
The chart is published in the `Dask Helm repo <https://helm.dask.org>`_ repository, and can be installed via:
49+
50+
.. code-block:: console
51+
52+
$ helm repo add dask https://helm.dask.org
53+
$ helm repo update
54+
$ helm install myrelease dask/dask-kubernetes-operator
55+
56+
This will install the custom resource definitions, service account, roles, and the operator deployment.
57+
58+
.. warning::
59+
Please note that `Helm does not support updating or deleting CRDs. <https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#some-caveats-and-explanations>`_ If updates
60+
are made to the CRD templates in future releases (to support future k8s releases, for example) you may have to manually update the CRDs.
61+
62+
4463
Creating a Dask cluster via ``kubectl``
4564
---------------------------------------
4665

0 commit comments

Comments
 (0)