Skip to content

Commit 40a3d20

Browse files
ElderMattj-zimnowodamerll
authored
feat: create service accounts for gitea organizations (#1929)
Co-authored-by: Jehoszafat Zimnowoda <[email protected]> Co-authored-by: Matthias Erll <[email protected]>
1 parent e634d34 commit 40a3d20

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

charts/team-ns/templates/rbac.yaml

+27-13
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,6 @@ rules:
106106
verbs:
107107
- '*'
108108
---
109-
# This secret needs refactoring! When ssh in Gitea is enabled: https://tekton.dev/docs/pipelines/auth/#configuring-ssh-auth-authentication-for-git
110-
# This is only temporary to support a specif use case
111-
apiVersion: v1
112-
kind: Secret
113-
metadata:
114-
name: gitea-credentials
115-
annotations:
116-
tekton.dev/git-0: "{{ $v.gitOps.globalUrl }}"
117-
type: kubernetes.io/basic-auth
118-
stringData:
119-
username: {{ $v.gitOps.adminUsername }}
120-
password: {{ $v.gitOps.adminPassword }}
121-
---
122109
apiVersion: v1
123110
kind: ServiceAccount
124111
metadata:
@@ -220,4 +207,31 @@ roleRef:
220207
apiGroup: rbac.authorization.k8s.io
221208
kind: Role
222209
name: tekton-triggers-createwebhook-team-{{ $v.teamId }}
210+
---
211+
# Role for apl-gitea-operator to manage service account in team namespace
212+
apiVersion: rbac.authorization.k8s.io/v1
213+
kind: Role
214+
metadata:
215+
name: apl-gitea-operator-service-account
216+
namespace: team-{{ $v.teamId }}
217+
rules:
218+
# Allows the apl-gitea-operator to create, get and list secrets in the team namespace. This is necessary to create service accounts for build in harbor.
219+
- apiGroups: [""]
220+
resources: ["secrets"]
221+
verbs: ["get", "watch", "list", "delete", "create", "update"]
222+
---
223+
# RoleBinding for the above Role in team namespace
224+
apiVersion: rbac.authorization.k8s.io/v1
225+
kind: RoleBinding
226+
metadata:
227+
name: apl-gitea-operator-service-account-binding
228+
namespace: team-{{ $v.teamId }}
229+
subjects:
230+
- kind: ServiceAccount
231+
namespace: apl-gitea-operator
232+
name: apl-gitea-operator
233+
roleRef:
234+
kind: Role
235+
name: apl-gitea-operator-service-account
236+
apiGroup: rbac.authorization.k8s.io
223237
---

0 commit comments

Comments
 (0)