-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix RBAC permissions for the Antctl ClusterRole #5166
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tnqn
reviewed
Jun 30, 2023
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.
LGTM, a few minor comments
test/e2e/antctl_test.go
Outdated
// Secret contents to a file. Ideally, we would use a Pod to run antctl commands instead of | ||
// running it from the Node (in that case, the Secret would be mounted to the Pod). | ||
kubeconfigSecretKey := "kubeconfig" | ||
// No need to worrky about deleting the Secret as it is created in the temporary test Namespace. |
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.
Suggested change
// No need to worrky about deleting the Secret as it is created in the temporary test Namespace. | |
// No need to worry about deleting the Secret as it is created in the temporary test Namespace. |
antoninbas
force-pushed
the
fix-antctl-clusterrole
branch
3 times, most recently
from
July 1, 2023 00:24
83210a0
to
8f6c698
Compare
tnqn
previously approved these changes
Jul 3, 2023
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.
LGTM
/test-all |
The ClusterRole definition was no longer up-to-date, with some incorrect permissions and some missing permissions. As a consequence, it could not be used to run some antctl commands, such as supportbundle. We fix the permissions and modify the Antctl e2e tests so that they use a Kubeconfig file generated for the antctl ServiceAccount, instead of the admin Kubeconfig file. Hopefully, this will help keep the ClusterRole definition up-to-date in the future. A few other improvements were implemented in that process: * antctl now uses the typed SystemBundle K8s clientset, instead of a raw REST client. This helps define the correct RBAC permissions for antctl. Previous permissions were indeed incorrect as they used the "post" verb (instead of the "create" verb), which is only correct for non-resource endpoints. * supportbundle unit tests now use an in-memory filesystem, to avoid writing test outputs to the local machine. * the antctl ClusterRole is giving access to a few extra endpoints ("/metrics", "/debug/pprof/*") to increse the usefulness of the antctl proxy command. Fixes antrea-io#5136 Signed-off-by: Antonin Bas <abas@vmware.com>
Signed-off-by: Antonin Bas <abas@vmware.com>
Signed-off-by: Antonin Bas <abas@vmware.com>
antoninbas
force-pushed
the
fix-antctl-clusterrole
branch
from
July 3, 2023 18:26
8f6c698
to
6678d30
Compare
Signed-off-by: Antonin Bas <abas@vmware.com>
antoninbas
force-pushed
the
fix-antctl-clusterrole
branch
from
July 4, 2023 00:08
c502128
to
793a930
Compare
'~' is not expanded with docker exec Signed-off-by: Antonin Bas <abas@vmware.com>
antoninbas
force-pushed
the
fix-antctl-clusterrole
branch
from
July 4, 2023 00:26
793a930
to
4ef67d4
Compare
tnqn
approved these changes
Jul 4, 2023
/test-all |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The ClusterRole definition was no longer up-to-date, with some incorrect permissions and some missing permissions. As a consequence, it could not be used to run some antctl commands, such as supportbundle.
We fix the permissions and modify the Antctl e2e tests so that they use a Kubeconfig file generated for the antctl ServiceAccount, instead of the admin Kubeconfig file. Hopefully, this will help keep the ClusterRole definition up-to-date in the future.
A few other improvements were implemented in that process:
Fixes #5136