-
Notifications
You must be signed in to change notification settings - Fork 313
Add SA to each namespace for running cron jobs #7032
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: konflux-cron-sa-actions | ||
labels: | ||
konflux-cluster-role: "true" | ||
rules: | ||
- verbs: | ||
- get | ||
- list | ||
- watch | ||
- patch | ||
apiGroups: | ||
- appstudio.redhat.com | ||
resources: | ||
- snapshots |
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. we should update the tests to check the resource is correctly created. Something like Lines 50 to 54 in de5e61a
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,46 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
apiVersion: kyverno.io/v1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
kind: ClusterPolicy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
metadata: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name: init-ns-cron-sa | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
spec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
generateExisting: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rules: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- name: generate-serviceaccount | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
match: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
any: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- resources: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
kinds: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Namespace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
selector: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
matchLabels: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
konflux-ci.dev/type: tenant | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
generate: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+16
to
+17
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. for how the ClusterPolicy is now, it will react to any Update events. We are only interested in Update events that add the tenant label. We can restrict this way:
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
kind: ServiceAccount | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
apiVersion: v1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name: konflux-cron-sa | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
namespace: '{{request.object.metadata.name}}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
synchronize: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- name: generate-snapshot-rolebinding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
match: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+8
to
+24
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. the
Suggested change
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. #7348 will mitigate this problem though |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
any: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- resources: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
kinds: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Namespace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
selector: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
matchLabels: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
konflux-ci.dev/type: tenant | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
generate: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+31
to
+32
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. for how the ClusterPolicy is now, it will react to any Update events. We are only interested in Update events that add the tenant label. We can restrict this way:
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
kind: RoleBinding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
apiVersion: rbac.authorization.k8s.io/v1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name: snapshot-access-binding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
namespace: '{{request.object.metadata.name}}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
synchronize: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
roleRef: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
kind: ClusterRole | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name: konflux-cron-sa-actions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
apiGroup: rbac.authorization.k8s.io | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
subjects: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- kind: ServiceAccount | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name: konflux-cron-sa | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
namespace: '{{request.object.metadata.name}}' |
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.
we need to add this ClusterPolicy to the kustomization.yaml file, otherwise it won't be deployed.