diff --git a/charts/graphscope/README.md b/charts/graphscope/README.md index da5643c313cc..956ccaf9bf67 100644 --- a/charts/graphscope/README.md +++ b/charts/graphscope/README.md @@ -15,14 +15,6 @@ See [*helm repo*](https://helm.sh/docs/helm/helm_repo/) for command documentatio ## Install Chart -GraphScope rely on some permissions to delete resources. - -```shell -# example for `default` ServiceAccount with `default` namespace -$ wget https://raw.githubusercontent.com/alibaba/GraphScope/main/charts/role_and_binding.yaml -$ kubectl create -f ./role_and_binding.yaml -``` - ```shell # Helm 3 $ helm install [RELEASE_NAME] graphscope/graphscope diff --git a/charts/graphscope/templates/coordinator.yaml b/charts/graphscope/templates/coordinator.yaml index f87326264fb7..821ad498e31e 100644 --- a/charts/graphscope/templates/coordinator.yaml +++ b/charts/graphscope/templates/coordinator.yaml @@ -47,8 +47,17 @@ spec: preStop: exec: command: - - python3 - - /usr/local/bin/pre_stop.py + - /bin/bash + - -c + - | + kubectl patch role/{{ include "graphscope.fullname" . }}-role \ + -n {{ .Release.Namespace }} \ + --type json \ + --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' && \ + kubectl patch rolebinding/{{ include "graphscope.fullname" . }}-role-binding \ + -n {{ .Release.Namespace }} \ + --type json \ + --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' command: - python3 - "-m" diff --git a/charts/graphscope/templates/role_and_binding.yaml b/charts/graphscope/templates/role_and_binding.yaml index ce6c4a63ea78..f58039113659 100644 --- a/charts/graphscope/templates/role_and_binding.yaml +++ b/charts/graphscope/templates/role_and_binding.yaml @@ -3,16 +3,23 @@ kind: Role metadata: name: {{ include "graphscope.fullname" . }}-role namespace: {{ .Release.Namespace }} + finalizers: + - kubernetes rules: - apiGroups: ["apps", "extensions", ""] resources: ["configmaps", "deployments", "deployments/status", "endpoints", "events", "pods", "pods/log", "pods/exec", "pods/status", "services", "replicasets"] verbs: ["*"] +- apiGroups: ["rbac.authorization.k8s.io"] + resources: ["roles", "rolebindings"] + verbs: ["patch"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: {{ include "graphscope.fullname" . }}-role-binding namespace: {{ .Release.Namespace }} + finalizers: + - kubernetes subjects: - kind: ServiceAccount name: default