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

Add completion for kubectl set image #124592

Merged
merged 1 commit into from May 7, 2024

Conversation

ah8ad3
Copy link
Member

@ah8ad3 ah8ad3 commented Apr 28, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds completion function for kubectl set image

Which issue(s) this PR fixes:

Fixes kubernetes/kubectl#1585

Special notes for your reviewer:

As we discussed in meeting this code here is just a sample on what is my approach to fix and suggestions about fixing this problem for other commands as well.

Current code act like this:
kubectl set image TAB:
cronjobs/ daemonsets/ deployments/ pods/ replicasets/ replicationcontrollers/ statefulsets/

and
kubectl set image pods/nginx-565b7446dd-dtm55 TAB:
kubectl set image pods/nginx-565b7446dd-dtm55 nginx=

Also if pod has few containers it will remove suggestions based on selected containers in argument.

This code is just the sample of how to fix it, we should discuss about it and what is our approach in future to add more completions, should we refactor the completion's functions or do it this way.
/cc @mpuckett159

Does this PR introduce a user-facing change?

Adds completion for `kubectl set image`.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 28, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @ah8ad3. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubectl sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 28, 2024
@ardaguclu
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 2, 2024
@ah8ad3 ah8ad3 force-pushed the add-kubectl-set-completion branch from 009f015 to c090922 Compare May 4, 2024 11:17
@ah8ad3
Copy link
Member Author

ah8ad3 commented May 4, 2024

Thanks for review, two of comments are addressed in last commit. For using restclientgetter i'm waiting for response #124592 (comment). PTAL @ardaguclu

@ah8ad3 ah8ad3 force-pushed the add-kubectl-set-completion branch from c090922 to ee58214 Compare May 7, 2024 05:18
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 7, 2024
@ah8ad3 ah8ad3 changed the title WIP: add completion for kubectl set image Add completion for kubectl set image May 7, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 7, 2024
@ah8ad3
Copy link
Member Author

ah8ad3 commented May 7, 2024

Thanks for reviews, comments addressed. PTAL @ardaguclu

Maybe later we can raise another issue to add support for containers in completion.

@ardaguclu
Copy link
Member

Thanks for reviews, comments addressed. PTAL @ardaguclu

Maybe later we can raise another issue to add support for containers in completion.

That is good idea. Thanks for the work @ah8ad3

/triage accepted
/priority backlog
/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the triage/accepted Indicates an issue or PR is ready to be actively worked on. label May 7, 2024
@k8s-ci-robot k8s-ci-robot added the priority/backlog Higher priority than priority/awaiting-more-evidence. label May 7, 2024
@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels May 7, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 7403bddf19e94319ace9640f13977a85b086489c

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ah8ad3, ardaguclu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 7, 2024
@k8s-ci-robot k8s-ci-robot merged commit 0590bb1 into kubernetes:master May 7, 2024
14 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.31 milestone May 7, 2024
@ah8ad3 ah8ad3 deleted the add-kubectl-set-completion branch May 7, 2024 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

No tab completion available for kubectl set command
3 participants