Navigation Menu

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

kubectl default container behavior #99833

Merged

Conversation

mengjiao-liu
Copy link
Member

@mengjiao-liu mengjiao-liu commented Mar 5, 2021

What type of PR is this?

/kind feature

What this PR does / why we need it:

specify the default container for kubectl attach, cp, exec command with annotation kubectl.kubernetes.io/default-container
The following files are created
staging/src/k8s.io/kubectl/pkg/cmd/util/default-container.go
This avoids duplicate code and help having a single place for maintenance.

more details can be seen in the KEP KEP-2227: default container behavior

Which issue(s) this PR fixes:

Ref enhancements issue

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Users might specify the `kubectl.kubernetes.io/default-container` annotation in a Pod to preselect container for kubectl commands.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

- [KEP] https://github.com/kubernetes/enhancements/blob/master/keps/sig-cli/2227-kubectl-default-container/README.md

@k8s-ci-robot k8s-ci-robot added 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/S Denotes a PR that changes 10-29 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-priority Indicates a PR lacks a `priority/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 Mar 5, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @mengjiao-liu. 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 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 Mar 5, 2021
@mengjiao-liu mengjiao-liu force-pushed the kubectl-default-container-attach branch 3 times, most recently from 31cfe9b to fe5dd12 Compare March 5, 2021 10:15
@mengjiao-liu mengjiao-liu changed the title kubectl attach command default container behavior with annotation kubectl.kubernetes.io/default-container kubectl attach command default container behavior Mar 5, 2021
@dougsland
Copy link
Member

On queue for the review.
/cc @pacoxu

@k8s-ci-robot k8s-ci-robot requested a review from pacoxu March 5, 2021 11:32
Copy link
Member

@pacoxu pacoxu left a comment

Choose a reason for hiding this comment

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

/lgtm
👍

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 5, 2021
@pacoxu
Copy link
Member

pacoxu commented Mar 5, 2021

/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 Mar 5, 2021
@dougsland
Copy link
Member

@mengjiao-liu looks like there is a conflict. Could you please rebase so we can do a fresh review?

@dougsland
Copy link
Member

/cc @eddiezane

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 8, 2021
@mengjiao-liu mengjiao-liu force-pushed the kubectl-default-container-attach branch from 722cb94 to 02b5717 Compare March 8, 2021 02:25
@mengjiao-liu mengjiao-liu changed the title kubectl attach and cp command default container behavior kubectl default container behavior Mar 8, 2021
@pacoxu
Copy link
Member

pacoxu commented Mar 9, 2021

/lgtm
@dougsland

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 9, 2021
@dougsland
Copy link
Member

/lgtm
Thanks @mengjiao-liu @pacoxu

@annajung
Copy link

annajung commented Mar 9, 2021

Hi @mengjiao-liu, a friendly reminder that the code freeze for 1.21 is today.
Please make sure to get the necessary approval for this to merge by EOD PST.

Copy link
Member

@dougsland dougsland left a comment

Choose a reason for hiding this comment

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

/lgtm

@mengjiao-liu mengjiao-liu force-pushed the kubectl-default-container-attach branch from 02b5717 to 88e5301 Compare March 10, 2021 04:10
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 10, 2021
@eddiezane
Copy link
Member

/retest
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 10, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: eddiezane, mengjiao-liu, pacoxu

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 Mar 10, 2021
@palnabarun
Copy link
Member

Adding the PR to the v1.21 milestone, since most of the changes were lgtm'ed prior to Code Freeze and the change here doesn't carry much risk.

/milestone v1.21

@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Mar 10, 2021
@pacoxu
Copy link
Member

pacoxu commented Mar 10, 2021

/retest

@k8s-ci-robot k8s-ci-robot merged commit 9132f87 into kubernetes:master Mar 10, 2021
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/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. 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/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants