-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
E2E K8s Context Protection #4391
Comments
Hi @reedjosh, Thank you for raise this issue. Could you please let me know if you are using a project with the latest scaffold? I'm just asking because it was already addressed.
kubebuilder/testdata/project-v4/Makefile Lines 66 to 82 in 19237b5
kubebuilder/testdata/project-v4/test/e2e/e2e_suite_test.go Lines 78 to 108 in 19237b5
If you are using this version, then we might add a logic to exit(1) when it is not possible to load the image. We are looking forward to your reply. |
What if the KUBECONFIG point to a production cluster and the kind cluster exists? I think the image will still be loaded in the cluster (since we set |
Slight tangent, but this check is probably not working as intended.
The prefix kind- is, however, added to the kubeconfig file. e.g.
|
@monteiro-renato I think that's how they ensure that the cluster is not a production cluster. Because usually production clusters are not prefixed with |
Yea, I can see it now. When I got that error a while back I found it weird since I knew that I had a kind cluster running and with the correct context configured. |
But yea, I think OP's concern is still valid. The validation should probably be done against the context configured in the kubeconfig instead of relying on the output of a kind command. |
Hi @monteiro-renato, @damsien, @reedjosh, How can we validate the context or name to determine whether it’s a production environment for the user? Additionally, frameworks generally don’t handle this kind of validation. For example, tools like Terraform, Helm, etc., don’t verify whether a command targets a production environment. At some level, the user must understand the commands they’re running and the clusters they’re targeting. On top of that:
It was already discussed. We cannot validate the context configured by developers when they run the commands and say, "Ah, it's production, and it is not for the e2e tests," just as we do not perform such validation for any Makefile targets or features. I hope that clarifies. I am looking forward to knowing if @reedjosh is or is not using a project with all changes related to this request. (as described in #4391 (comment)) I really would appreciate it if @reedjosh could share this information with us. Thank you. |
Hey @camilamacedo86, We could create a kind cluster based on the project's name and then use kind's |
What do you want to happen?
The initial E2E suite created via kubebuilder does not protect against using a production kubernetes context.
This can result in removing monitoring and cert manager from production clusters.
Tilt for example only allows the user to run against a context matching
kind-*
by default, and requires the user to intentionally add other contexts.🙏 please add this protection. It is hard to otherwise ensure it doesn't crop up across a company.
Extra Labels
No response
The text was updated successfully, but these errors were encountered: