Skip to content
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

[FLINK-35937] RBAC cleanup #857

Merged
merged 3 commits into from
Feb 10, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
RBAC cleanup
timsn committed Jul 31, 2024
commit bd2eedf91ea0590fa70d3e3248179947dfd8f84c
29 changes: 16 additions & 13 deletions helm/flink-kubernetes-operator/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -50,8 +50,6 @@ rules:
- apps
resources:
- deployments
- deployments/scale
- deployments/finalizers
- replicasets
verbs:
- get
@@ -61,26 +59,20 @@ rules:
- update
- patch
- delete
- deletecollection
- apiGroups:
- extensions
- apps
resources:
- deployments
- ingresses
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we wish to drop support for extensions/v1beta1 API version of Ingress, I think we can also remove the code in IngressUtils.java:266. This will make the operator unable to create new Ingress resources for Kubernetes 1.19, but that version has been deprecated for a long time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would appreciate getting rid of the extensions part because this is making some trouble with our deployment on a recent managed Kubernetes cluster (1.29) in combination with Kyverno policy management. Kyverno is preventing the deployment because the extensions API does not seem to exist anymore.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timsn If this is something you specifically don't need you could simply modify your downstream helm chart. But as long as we have users who need this we cannot simply remove it from the base helm template. We would need a discussion on the ML before that

Copy link
Contributor Author

@timsn timsn Aug 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gyfora thanks for your response. That's something I cannot judge because I know not enough about what the extensions are used for and if they are still in use. I just discovered that they lead to problems with our deployment process (Kyverno policy checks).

If this would brake something I would be totally fine to remove the change from this PR and do the change downstream on my own.

- deployments/scale
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- flink.apache.org
resources:
- flinkdeployments
- flinkdeployments/finalizers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't removing finalizers here affect the fix provided in #600? The finalizers were added here specifically for OpenShift, I think it's related to the OwnerReferencesPermissionEnforcement admission plugin.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not the best to judge this. But at least from my point of view the "/finializers" resources are also making trouble with the deployment because it looks like the resources do not exist and (like mentioned above) Kyverno is blocking our deployment because it cannot add verbs to non existing resources. That's at least how I understand it.
Here is the output of available resources on our cluster for the flink operator:

API               Resource                 Verbs
flink.apache.org  flinkdeployments         delete,deletecollection,get,list,patch,create,update,watch
flink.apache.org  flinkdeployments/status  get,patch,update
flink.apache.org  flinkdeployments/scale   get,patch,update
flink.apache.org  flinksessionjobs         delete,deletecollection,get,list,patch,create,update,watch
flink.apache.org  flinksessionjobs/status  get,patch,update

- flinksessionjobs
- flinksessionjobs/finalizers
verbs:
- get
- list
@@ -89,6 +81,7 @@ rules:
- update
- patch
- delete
- deletecollection
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we adding the delete collection verb to many places? Is this used somewhere?

Copy link
Contributor Author

@timsn timsn Aug 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added them for "completeness". Because in the past the verbs just were a star ("*"), and deletecollection is implicitly a part of it. If not needed, I can also remove it from this PR.

- apiGroups:
- flink.apache.org
resources:
@@ -110,6 +103,7 @@ rules:
- update
- patch
- delete
- deletecollection
- apiGroups:
- coordination.k8s.io
resources:
@@ -122,6 +116,7 @@ rules:
- update
- patch
- delete
- deletecollection
{{- end }}

{{/*
@@ -142,11 +137,11 @@ rules:
- update
- patch
- delete
- deletecollection
- apiGroups:
- apps
resources:
- deployments
- deployments/finalizers
verbs:
- get
- list
@@ -155,6 +150,7 @@ rules:
- update
- patch
- delete
- deletecollection
{{- end }}

---
@@ -245,7 +241,14 @@ rules:
resources:
- leases
verbs:
- "*"
- get
- list
- watch
- create
- update
- patch
- delete
- deletecollection
{{- end }}
---
{{- if and .Values.rbac.operatorRole.create (not (has .Release.Namespace .Values.watchNamespaces)) }}