Add ServiceAccount and roles to allow namespace annotation

This commit is contained in:
Stefan Reimer 2020-05-18 18:12:02 +01:00
parent 584b093dd9
commit 9003ff81a7
2 changed files with 48 additions and 2 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: kubezero-kiam name: kubezero-kiam
description: KubeZero Umbrella Chart for Kiam description: KubeZero Umbrella Chart for Kiam
type: application type: application
version: 0.2.1 version: 0.2.2
home: https://kubezero.com home: https://kubezero.com
icon: https://cdn.zero-downtime.net/assets/logo_small.png icon: https://cdn.zero-downtime.net/assets/logo_small.png
keywords: keywords:

View File

@ -1,3 +1,49 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/name: {{ .name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/part-of: kubezero
name: kiam-namespace-annotate
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: {{ .name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/part-of: kubezero
name: kiam-namespace-annotate
rules:
- apiGroups:
- ""
resources:
- namespaces
verbs:
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/name: {{ .name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/part-of: kubezero
name: kiam-namespace-annotate
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kiam-namespace-annotate
subjects:
- kind: ServiceAccount
name: kiam-namespace-annotate
namespace: kube-system
---
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
@ -14,7 +60,7 @@ metadata:
spec: spec:
template: template:
spec: spec:
serviceAccountName: default serviceAccountName: kiam-namespace-annotate
containers: containers:
- name: kubectl - name: kubectl
image: "bitnami/kubectl:latest" image: "bitnami/kubectl:latest"