diff --git a/runs/k8s-action-test.yaml b/runs/k8s-action-test.yaml new file mode 100644 index 0000000..168c00e --- /dev/null +++ b/runs/k8s-action-test.yaml @@ -0,0 +1,13 @@ + +apiVersion: tekton.dev/v1beta1 +kind: TaskRun +metadata: + name: k8s-action-test +spec: + serviceAccountName: internal-kubectl + taskRef: + name: kubernetes-actions + params: + - name: script + value: | + kubectl get deploy \ No newline at end of file diff --git a/serviceaccounts/internal-kubectl.yaml b/serviceaccounts/internal-kubectl.yaml new file mode 100644 index 0000000..762f359 --- /dev/null +++ b/serviceaccounts/internal-kubectl.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: internal-kubectl +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: modify-deployments +rules: + - apiGroups: ["apps"] + resources: + - deployments + verbs: + - get + - list + - delete + - update + - patch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: modify-deployments-to-sa +subjects: + - kind: ServiceAccount + name: internal-kubectl +roleRef: + kind: Role + name: modify-deployments + apiGroup: rbac.authorization.k8s.io \ No newline at end of file