-
Notifications
You must be signed in to change notification settings - Fork 40.6k
kubectl: add env option to deployment creation #93269
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
kubectl: add env option to deployment creation #93269
Conversation
Welcome @Xercoy! |
Hi @Xercoy. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/cc @kubernetes/sig-cli-api-reviews @kubernetes/sig-cli-pr-reviews |
@Xercoy: Reiterating the mentions to trigger a notification: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Xercoy The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
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.
Code lgtm but:
The main goal is to make create command simple as possible, other need to create deployment should use kubectl apply
instead. Before we add --port
, --replicas
flag since they are commonly used in deployment . Not sure we really want to continue add more.
@zhouya0 , thank you for the quick review! I definitely agree with you in that For whatever purposes that are required when using
I also think that the ability to provide a deployment with environment variables can also be considered a core configuration of a deployment. I believe that it is commonly used and that the benefits from this feature would outweigh the simplicity that the changes in this PR removes. The flags listed above enable users to create a deployment which dictates the command, number of replicas, and port. One of the most important pieces of an application's operations are configuration values; many applications need some kind of configuration values to run smoothly. Adding Manipulating deployments with From my perspective as a user, someone who shares knowledge about Kubernetes, and one who still tries to use As a contributor with this PR, the changes make use of utility/helper functions that already exist, includes tests, and adds code changes that matches how other flags are handled, such as While I do agree with you on both points in that the create command should be as simple as possible, and again when you mentioned that the flags mentioned above are commonly used in deployments, adding Of course, I defer the decision to validate the need for this PR to you and the consensus of the community. Overall, it's been an awesome learning experience and a great chance to collaborate and make contributions to a project that has given so much to me. Thanks again. |
/ok-to-test |
/retest - for flakiness |
/retest |
/retest |
@zhouya0 while Tide is mentioning that this PR isn't mergeable yet, all tests are passing. Thanks again for the review and enabling tests! For the time being, I'll try to promote visibility but please let me know if there's anything else I can do to help. |
"SingleEnvVar", | ||
[]string{ | ||
"FOO=bar", | ||
"FIZZ=buzz", |
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.
This test case should have only one env var set, will fix.
/retest |
1 similar comment
/retest |
/priority backlog |
Holding this while we explore other options as discussed in SIG-CLI meeting. /hold |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@Xercoy: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@fejta-bot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Creating a deployment using kubectl with environment variables was done with
kubectl run
. Since most of the generators have been deprecated, including the one for deployments (#87077), this PR adds functionality to the preferred method of deployment creation,kubectl create deployment
.I think this feature would be useful in providing more flexibility for deployments with
kubectl create
. Additionally, resources related to deployment creation with environment variables viakubectl run
can be updated and remain useful rather than eventually being deprecated.I did not create an issue/enhancement beforehand but I would be more than happy to do so. Apologies especially in case I had missed any content which deemed that this feature shouldn't be implemented.
Supporting documentation/PRs:
and also attached in the docs section.
Special notes for your reviewer:
In addition to running and providing tests, I built the kubectl binary and tested that the new flag/feature works as expected; the intent is for its behavior to be similar to how the flag was in
kubectl run
.Please let me know if any changes or amendments should be made, or if I'm not adhering to any guidelines or processes. Would also be more than happy to refactor any recommendations for changes.
Thank you very much to all reviewers, maintainers, and contributors for the time and effort!
Does this PR introduce a user-facing change?:
Yes, this will add an optional flag
--env
which expects a key value pair of an environment name and value. This flag can be repeated to provide multiple environment variables.