-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Action Platform PAR] Use actionsAllowlist to configure RBAC #1518
base: main
Are you sure you want to change the base?
Changes from all commits
921c0ea
38d8a4a
7039cce
a9e7c45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,45 @@ | |
{{- define "chart.roleBindingName" }} "private-action-runner-{{.}}-rolebinding" {{ end }} | ||
{{- define "chart.serviceName" }} "private-action-runner-{{.}}-service" {{ end }} | ||
{{- define "chart.secretName" }} "private-action-runner-{{.}}-secrets" {{ end }} | ||
|
||
{{/* | ||
Defines an RBAC rule for provided apiGroup, resource type and allowed verbs | ||
*/}} | ||
{{- define "rbacRule" }} | ||
- apiGroups: | ||
- {{ .apiGroup }} | ||
resources: | ||
- {{ .resource }} | ||
verbs: | ||
{{- range $_, $verb := .verbs }} | ||
- {{ $verb }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Defines an RBAC "get" rule for provided apiGroup and resource type | ||
*/}} | ||
{{- define "rbacGetRule" }} | ||
{{- include "rbacRule" (dict "apiGroup" .apiGroup "resource" .resource "verbs" (list "get"))}} | ||
{{- end }} | ||
|
||
{{/* | ||
Defines an RBAC "list" rule for provided apiGroup and resource type | ||
*/}} | ||
{{- define "rbacListRule" }} | ||
{{- include "rbacRule" (dict "apiGroup" .apiGroup "resource" .resource "verbs" (list "list"))}} | ||
{{- end }} | ||
Comment on lines
+22
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It depends how much granularity you want, but maybe get and list can be define together. Same for patch and update |
||
|
||
{{/* | ||
Defines an RBAC "update" rule for provided apiGroup and resource type | ||
*/}} | ||
{{- define "rbacUpdateRule" }} | ||
{{- include "rbacRule" (dict "apiGroup" .apiGroup "resource" .resource "verbs" (list "update"))}} | ||
{{- end }} | ||
|
||
{{/* | ||
Defines an RBAC "patch" rule for provided apiGroup and resource type | ||
*/}} | ||
{{- define "rbacPatchRule" }} | ||
{{- include "rbacRule" (dict "apiGroup" .apiGroup "resource" .resource "verbs" (list "patch"))}} | ||
{{- end }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,20 @@ kind: ClusterRole | |
metadata: | ||
namespace: {{ $.Release.Namespace }} | ||
name: {{ include "chart.roleName" $runner.name }} | ||
rules: {{ $runner.kubernetesPermissions | toJson }} | ||
rules: | ||
{{- if $runner.kubernetesPermissions }} | ||
{{ $runner.kubernetesPermissions | toYaml}} | ||
{{- end }} | ||
{{- if has "com.datadoghq.kubernetes.apps.getDeployment" $runner.config.actionsAllowlist }} | ||
{{- include "rbacGetRule" (dict "apiGroup" "apps" "resource" "deployments")}} | ||
{{- end }} | ||
{{- if has "com.datadoghq.kubernetes.apps.listDeployment" $runner.config.actionsAllowlist }} | ||
{{- include "rbacListRule" (dict "apiGroup" "apps" "resource" "deployments")}} | ||
{{- end }} | ||
{{- if has "com.datadoghq.kubernetes.apps.patchDeployment" $runner.config.actionsAllowlist }} | ||
{{- include "rbacPatchRule" (dict "apiGroup" "apps" "resource" "deployments")}} | ||
{{- end }} | ||
{{- if has "com.datadoghq.kubernetes.apps.restartDeployment" $runner.config.actionsAllowlist }} | ||
{{- include "rbacUpdateRule" (dict "apiGroup" "apps" "resource" "deployments")}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. restartDeployment is actually using patch under the hood |
||
{{- end }} | ||
{{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you merge / rebase from main ? there was another release in the meantime