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

helm: Remove Unnecessary RBAC Permissions for Agent #19053

Conversation

nathanjsweet
Copy link
Member

In October 2020, we made changes to the cilium-agent's
ClusterRole to be more permissive. We did this, because
Openshift enables the OwnerReferencesPermissionEnforcement
admission controller. This admissions controller prevents
changes to the metadata.ownerReferences of any object
unless the entity (the cilium-agent in this case) has
permission to delete the object as well. Furthermore,
the controller allows protects metadata.ownerReferences[x].blockOwnerDeletion
of a resource unless the entity (again, the cilium-agent) has
"update" access to the finalizer of the object having its
deletion blocked. The original PR mistakenly assumed we
set ownerReferences on pods and expanded cilium-agent's
permissions beyond what was necessary. Cilium-agent
only sets ownerReferences on a CiliumEndpoint and the
blockOwnerDeletion field propagates up to the "owning"
pod of the endpoint. Cilium-agent only needs to be able
to delete CiliumEndpoints (which it has always been able to)
and "update" pod/finalizers (to set the blockOwnerDeletion field
on CiliumEndpoints). All other changes contained in #13369
were unnecessary.

Signed-off-by: Nate Sweet nathanjsweet@pm.me

helm: Removed unnecessary Kubernetes RBAC permissions for cilium-agent

@nathanjsweet nathanjsweet added area/daemon Impacts operation of the Cilium daemon. release-note/bug This PR fixes an issue in a previous release of Cilium. area/helm Impacts helm charts and user deployment experience labels Mar 7, 2022
@nathanjsweet nathanjsweet requested a review from a team March 7, 2022 04:12
@nathanjsweet nathanjsweet requested a review from a team as a code owner March 7, 2022 04:12
@nathanjsweet nathanjsweet force-pushed the pr/nathanjsweet/update-problematic-rbac-permissions-that-are-unnecessary branch from 0f49b97 to e72d112 Compare March 7, 2022 04:12
Copy link
Member

@sayboras sayboras left a comment

Choose a reason for hiding this comment

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

@sayboras
Copy link
Member

sayboras commented Mar 7, 2022

/test

In October 2020, we made changes[1] to the cilium-agent's
ClusterRole to be more permissive. We did this, because
Openshift enables[2] the OwnerReferencesPermissionEnforcement[3]
admission controller. This admissions controller prevents
changes to the metadata.ownerReferences of any object
unless the entity (the cilium-agent in this case) has
permission to delete the object as well. Furthermore,
the controller allows protects metadata.ownerReferences[x].blockOwnerDeletion
of a resource unless the entity (again, the cilium-agent) has
"update" access to the finalizer of the object having its
deletion blocked. The original PR mistakenly assumed we
set ownerReferences on pods and expanded cilium-agent's
permissions beyond what was necessary. Cilium-agent
only sets ownerReferences on a CiliumEndpoint and the
blockOwnerDeletion field propagates up to the "owning"
pod of the endpoint. Cilium-agent only needs to be able
to delete CiliumEndpoints (which it has always been able to)
and "update" pod/finalizers (to set the blockOwnerDeletion field
on CiliumEndpoints). All other changes contained in #13369
were unnecessary.

1 #13369
2 https://docs.openshift.com/container-platform/4.6/architecture/admission-plug-ins.html
3 https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#ownerreferencespermissionenforcement

Signed-off-by: Nate Sweet <nathanjsweet@pm.me>
@nathanjsweet nathanjsweet force-pushed the pr/nathanjsweet/update-problematic-rbac-permissions-that-are-unnecessary branch from e72d112 to ab30b7d Compare March 7, 2022 15:35
@aanm
Copy link
Member

aanm commented Mar 7, 2022

The tests were previously green, merging.

@aanm aanm merged commit 0f4d3a7 into master Mar 7, 2022
@aanm aanm deleted the pr/nathanjsweet/update-problematic-rbac-permissions-that-are-unnecessary branch March 7, 2022 16:03
nathanjsweet added a commit that referenced this pull request Mar 7, 2022
The Clustermesh-APIServer creates a CiliumEndPoint and sets
a node as its ownerReference, also setting blockOwnerDeletion
to "true". If the OwnerReferencesPermissionEnforcement admission
controller is enabled (such as in environments like Openshift) then
the Clustermesh-APIServer will fail to create the CiliumEndPoint
as it has insufficient privileges to set blockOwnerDeletion of
a node. It needs to be able to "update" "nodes/finalizers" in order
to do this. See #19053 for more details and references.

Signed-off-by: Nate Sweet <nathanjsweet@pm.me>
ldelossa pushed a commit that referenced this pull request Mar 17, 2022
The Clustermesh-APIServer creates a CiliumEndPoint and sets
a node as its ownerReference, also setting blockOwnerDeletion
to "true". If the OwnerReferencesPermissionEnforcement admission
controller is enabled (such as in environments like Openshift) then
the Clustermesh-APIServer will fail to create the CiliumEndPoint
as it has insufficient privileges to set blockOwnerDeletion of
a node. It needs to be able to "update" "nodes/finalizers" in order
to do this. See #19053 for more details and references.

Signed-off-by: Nate Sweet <nathanjsweet@pm.me>
@qmonnet qmonnet added backport-done/1.11 The backport for Cilium 1.11.x for this PR is done. and removed backport-pending/1.11 labels Mar 28, 2022
qmonnet pushed a commit that referenced this pull request Mar 29, 2022
[ upstream commit 75f597b ]

The Clustermesh-APIServer creates a CiliumEndPoint and sets
a node as its ownerReference, also setting blockOwnerDeletion
to "true". If the OwnerReferencesPermissionEnforcement admission
controller is enabled (such as in environments like Openshift) then
the Clustermesh-APIServer will fail to create the CiliumEndPoint
as it has insufficient privileges to set blockOwnerDeletion of
a node. It needs to be able to "update" "nodes/finalizers" in order
to do this. See #19053 for more details and references.

Signed-off-by: Nate Sweet <nathanjsweet@pm.me>
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
qmonnet pushed a commit that referenced this pull request Mar 29, 2022
[ upstream commit 75f597b ]

The Clustermesh-APIServer creates a CiliumEndPoint and sets
a node as its ownerReference, also setting blockOwnerDeletion
to "true". If the OwnerReferencesPermissionEnforcement admission
controller is enabled (such as in environments like Openshift) then
the Clustermesh-APIServer will fail to create the CiliumEndPoint
as it has insufficient privileges to set blockOwnerDeletion of
a node. It needs to be able to "update" "nodes/finalizers" in order
to do this. See #19053 for more details and references.

Signed-off-by: Nate Sweet <nathanjsweet@pm.me>
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
@qmonnet qmonnet mentioned this pull request Mar 29, 2022
10 tasks
qmonnet pushed a commit that referenced this pull request Mar 30, 2022
[ upstream commit 75f597b ]

The Clustermesh-APIServer creates a CiliumEndPoint and sets
a node as its ownerReference, also setting blockOwnerDeletion
to "true". If the OwnerReferencesPermissionEnforcement admission
controller is enabled (such as in environments like Openshift) then
the Clustermesh-APIServer will fail to create the CiliumEndPoint
as it has insufficient privileges to set blockOwnerDeletion of
a node. It needs to be able to "update" "nodes/finalizers" in order
to do this. See #19053 for more details and references.

Signed-off-by: Nate Sweet <nathanjsweet@pm.me>
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
qmonnet pushed a commit that referenced this pull request Mar 30, 2022
[ upstream commit 75f597b ]

The Clustermesh-APIServer creates a CiliumEndPoint and sets
a node as its ownerReference, also setting blockOwnerDeletion
to "true". If the OwnerReferencesPermissionEnforcement admission
controller is enabled (such as in environments like Openshift) then
the Clustermesh-APIServer will fail to create the CiliumEndPoint
as it has insufficient privileges to set blockOwnerDeletion of
a node. It needs to be able to "update" "nodes/finalizers" in order
to do this. See #19053 for more details and references.

Signed-off-by: Nate Sweet <nathanjsweet@pm.me>
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
qmonnet pushed a commit that referenced this pull request Mar 30, 2022
[ upstream commit 75f597b ]

The Clustermesh-APIServer creates a CiliumEndPoint and sets
a node as its ownerReference, also setting blockOwnerDeletion
to "true". If the OwnerReferencesPermissionEnforcement admission
controller is enabled (such as in environments like Openshift) then
the Clustermesh-APIServer will fail to create the CiliumEndPoint
as it has insufficient privileges to set blockOwnerDeletion of
a node. It needs to be able to "update" "nodes/finalizers" in order
to do this. See #19053 for more details and references.

Signed-off-by: Nate Sweet <nathanjsweet@pm.me>
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
qmonnet pushed a commit that referenced this pull request Apr 4, 2022
[ upstream commit 75f597b ]

The Clustermesh-APIServer creates a CiliumEndPoint and sets
a node as its ownerReference, also setting blockOwnerDeletion
to "true". If the OwnerReferencesPermissionEnforcement admission
controller is enabled (such as in environments like Openshift) then
the Clustermesh-APIServer will fail to create the CiliumEndPoint
as it has insufficient privileges to set blockOwnerDeletion of
a node. It needs to be able to "update" "nodes/finalizers" in order
to do this. See #19053 for more details and references.

Signed-off-by: Nate Sweet <nathanjsweet@pm.me>
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
pchaigno pushed a commit that referenced this pull request Apr 4, 2022
[ upstream commit 75f597b ]

The Clustermesh-APIServer creates a CiliumEndPoint and sets
a node as its ownerReference, also setting blockOwnerDeletion
to "true". If the OwnerReferencesPermissionEnforcement admission
controller is enabled (such as in environments like Openshift) then
the Clustermesh-APIServer will fail to create the CiliumEndPoint
as it has insufficient privileges to set blockOwnerDeletion of
a node. It needs to be able to "update" "nodes/finalizers" in order
to do this. See #19053 for more details and references.

Signed-off-by: Nate Sweet <nathanjsweet@pm.me>
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/daemon Impacts operation of the Cilium daemon. area/helm Impacts helm charts and user deployment experience backport-done/1.11 The backport for Cilium 1.11.x for this PR is done. release-note/bug This PR fixes an issue in a previous release of Cilium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants