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

Cherry pick 65711 65786 65982 #65979

Conversation

juanvallejo
Copy link
Contributor

@juanvallejo juanvallejo commented Jul 9, 2018

What this PR does / why we need it:
This cherry picks #65711, #65786, and #65982 onto release 1.11.

Special notes for your reviewer:
Picks and rebases existing cherry-pick #65873

Fixes #65647

Release note:

fixes a regression in kubectl printing behavior when using go-template or jsonpath output that resulted in a "unable to match a printer" error message

/assign @deads2k
for review
/assign @foxish
for 1.11 approval

Fixes defaulting done for commands that default to a specific output
format (such as yaml, json) when a --template flag is provided and no
explicit --output value is given.

Under the above case, these commands will now properly default to
honoring the --template argument given, and default their --output
format to "go-template".
@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jul 9, 2018
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 9, 2018
@k8s-github-robot k8s-github-robot added the do-not-merge/cherry-pick-not-approved Indicates that a PR is not yet approved to merge into a release branch. label Jul 9, 2018
// For backwards compatibility we want to support a --template argument given, even when no --output format is provided.
// If a default output format has been set, but no explicit output format has been provided via the --output flag, fallback
// to honoring the --template argument.
if f.TemplatePrinterFlags != nil && f.TemplatePrinterFlags.TemplateArgument != nil &&
Copy link
Contributor

Choose a reason for hiding this comment

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

use bool assignments to make this readable for me to stumble through.

// to honoring the --template argument.
if f.TemplatePrinterFlags != nil && f.TemplatePrinterFlags.TemplateArgument != nil &&
len(*f.TemplatePrinterFlags.TemplateArgument) > 0 &&
(len(outputFormat) == 0 || (f.outputDefaulted && !f.outputFlag.Changed)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't this change make it impossible to compose this without specifically adding these flags?

}
}

// WithDefaultOutput sets a default output format if one is not provided through a flag value
func (f *PrintFlags) WithDefaultOutput(output string) *PrintFlags {
f.OutputFormat = &output
f.outputDefaulted = true
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems wrong. Why do we have this instead of knowing it from the AddFlags call at the point at which it was bound?

@juanvallejo juanvallejo changed the title Cherry pick 65711 65786 Cherry pick 65711 65786 65982 Jul 9, 2018
@foxish
Copy link
Contributor

foxish commented Jul 9, 2018

Can we close #65873 then?

@deads2k
Copy link
Contributor

deads2k commented Jul 9, 2018

/lgtm

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

deads2k commented Jul 9, 2018

Can we close #65873 then?

done

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Jul 9, 2018
@deads2k deads2k added this to the v1.11 milestone Jul 9, 2018
@deads2k
Copy link
Contributor

deads2k commented Jul 10, 2018

/status approved-for-milestone

@deads2k
Copy link
Contributor

deads2k commented Jul 10, 2018

/kind bug

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jul 10, 2018
@deads2k
Copy link
Contributor

deads2k commented Jul 10, 2018

/priority important-soon

@k8s-ci-robot k8s-ci-robot added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Jul 10, 2018
@deads2k deads2k added the sig/cli Categorizes an issue or PR as relevant to SIG CLI. label Jul 10, 2018
@k8s-github-robot
Copy link

[MILESTONENOTIFIER] Milestone Pull Request: Up-to-date for process

@deads2k @foxish @juanvallejo

Pull Request Labels
  • sig/cli: Pull Request will be escalated to these SIGs if needed.
  • priority/important-soon: Escalate to the pull request owners and SIG owner; move out of milestone after several unsuccessful escalation attempts.
  • kind/bug: Fixes a bug discovered during the current release.
Help

@juanvallejo
Copy link
Contributor Author

@foxish for cherry-pick approval

@foxish foxish added cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. and removed do-not-merge/cherry-pick-not-approved Indicates that a PR is not yet approved to merge into a release branch. labels Jul 11, 2018
@k8s-github-robot
Copy link

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

@k8s-github-robot
Copy link

Automatic merge from submit-queue.

@k8s-github-robot k8s-github-robot merged commit d01b9eb into kubernetes:release-1.11 Jul 11, 2018
@juanvallejo juanvallejo deleted the soltysh-cherry-pick-65711-65786 branch July 11, 2018 13:15
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. cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants