mirror of
https://github.com/actions/actions-runner-controller.git
synced 2026-01-18 09:45:14 +08:00
add manager role extra rules
This commit is contained in:
@@ -11,6 +11,43 @@
|
||||
{{- .Values.namespaceOverride | default .Release.Namespace -}}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
The name of the manager Role.
|
||||
*/}}
|
||||
{{- define "manager-role.name" -}}
|
||||
{{- printf "%s-manager-role" (include "autoscaling-runner-set.name" .) -}}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{/*
|
||||
Create the labels for the manager Role.
|
||||
*/}}
|
||||
{{- define "manager-role.labels" -}}
|
||||
{{- $resourceLabels := dict "app.kubernetes.io/component" "manager-role" -}}
|
||||
{{- $commonLabels := include "gha-common-labels" . | fromYaml -}}
|
||||
{{- $userLabels := include "apply-non-reserved-gha-labels-and-annotations" (.Values.resource.managerRole.metadata.labels | default (dict)) | fromYaml -}}
|
||||
{{- $global := include "apply-non-reserved-gha-labels-and-annotations" (.Values.resource.all.metadata.labels | default (dict)) | fromYaml -}}
|
||||
{{- toYaml (mergeOverwrite $global $userLabels $resourceLabels $commonLabels) }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{/*
|
||||
Create the annotations for the manager Role.
|
||||
|
||||
Order of precedence:
|
||||
1) resource.all.metadata.annotations
|
||||
2) resource.managerRole.metadata.annotations
|
||||
Reserved annotations are excluded from both levels.
|
||||
*/}}
|
||||
{{- define "manager-role.annotations" -}}
|
||||
{{- $global := (include "apply-non-reserved-gha-labels-and-annotations" (.Values.resource.all.metadata.annotations | default (dict))) | fromYaml -}}
|
||||
{{- $resource := (include "apply-non-reserved-gha-labels-and-annotations" (.Values.resource.managerRole.metadata.annotations | default (dict))) | fromYaml -}}
|
||||
{{- $annotations := mergeOverwrite $global $resource -}}
|
||||
{{- if not (empty $annotations) -}}
|
||||
{{- toYaml $annotations }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
The name of the GitHub secret used for authentication.
|
||||
*/}}
|
||||
|
||||
85
charts/gha-runner-scale-set-dev/templates/manager_role.yaml
Normal file
85
charts/gha-runner-scale-set-dev/templates/manager_role.yaml
Normal file
@@ -0,0 +1,85 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ include "manager-role.name" . | quote }}
|
||||
namespace: {{ include "autoscaling-runner-set.namespace" . | quote }}
|
||||
labels:
|
||||
{{- include "manager-role.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
{{- include "manager-role.annotations" . | nindent 4 }}
|
||||
finalizers:
|
||||
- actions.github.com/cleanup-protection
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods/status
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- serviceaccounts
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- apiGroups:
|
||||
- rbac.authorization.k8s.io
|
||||
resources:
|
||||
- rolebindings
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- patch
|
||||
- update
|
||||
- apiGroups:
|
||||
- rbac.authorization.k8s.io
|
||||
resources:
|
||||
- roles
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- patch
|
||||
- update
|
||||
{{- if .Values.githubServerTLS }}
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
verbs:
|
||||
- get
|
||||
{{- end }}
|
||||
|
||||
{{- with .Values.resource.managerRole.extraRules }}
|
||||
{{- if not (empty .) }}
|
||||
{{- if not (kindIs "slice" .) -}}
|
||||
{{- fail ".Values.resource.managerRole.extraRules must be a list of RBAC policy rules" -}}
|
||||
{{- end }}
|
||||
{{ toYaml . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user