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 field selector support to delete, label, annotate #60717

Merged
merged 1 commit into from
May 1, 2018

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented Mar 2, 2018

What this PR does / why we need it:

Builds out field selector support for more bulk commands

Release note:

kubectl now supports --field-selector for `delete`, `label`, and `annotate`

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. 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. labels Mar 2, 2018
@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 2, 2018
@liggitt
Copy link
Member Author

liggitt commented Mar 2, 2018

@kubernetes/sig-cli-pr-reviews

@k8s-ci-robot k8s-ci-robot added the sig/cli Categorizes an issue or PR as relevant to SIG CLI. label Mar 2, 2018
@krmayankk
Copy link

@liggitt did you mean label selector or field selector. Is my understanding correct that now you would be able to annotate for e.g. multiple pods which match a label ?

@liggitt
Copy link
Member Author

liggitt commented Mar 6, 2018

@liggitt did you mean label selector or field selector. Is my understanding correct that now you would be able to annotate for e.g. multiple pods which match a label ?

Field selector. You can already annotate pods which match a label:

kubectl annotate pods --selector somelabel=somevalue newannotation=newvalue

Copy link
Contributor

@ericchiang ericchiang left a comment

Choose a reason for hiding this comment

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

Need to make changes to LabelOptions in pkg/kubectl/cmd/label.go

@liggitt
Copy link
Member Author

liggitt commented Mar 20, 2018

Need to make changes to LabelOptions in pkg/kubectl/cmd/label.go

done

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 20, 2018
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 24, 2018
@liggitt
Copy link
Member Author

liggitt commented Apr 24, 2018

rebased. @soltysh @juanvallejo PTAL at delete changes

cmd.Flags().StringVarP(f.LabelSelector, "selector", "l", *f.LabelSelector, "Selector (label query) to filter on, not including uninitialized ones.")
}
if f.FieldSelector != nil {
cmd.Flags().StringVarP(f.FieldSelector, "field-selector", "", *f.FieldSelector, "Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.")
Copy link
Member

Choose a reason for hiding this comment

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

Can use cmd.Flags().StringVar() here for missing shorthand letter.

@liggitt
Copy link
Member Author

liggitt commented Apr 25, 2018

/retest

@juanvallejo
Copy link
Contributor

"delete" changes lgtm

@liggitt
Copy link
Member Author

liggitt commented Apr 27, 2018

/retest

@liggitt
Copy link
Member Author

liggitt commented Apr 30, 2018

/assign @juanvallejo

@juanvallejo
Copy link
Contributor

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: juanvallejo, liggitt

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-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

/test all

Tests are more than 96 hours old. Re-running tests.

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit d39ff8e into kubernetes:master May 1, 2018
@liggitt liggitt deleted the field-selector branch May 2, 2018 00:57
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants