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

Update set commands #20139

Merged
merged 7 commits into from
Jul 6, 2018
Merged

Conversation

soltysh
Copy link
Contributor

@soltysh soltysh commented Jun 28, 2018

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 28, 2018
@openshift-ci-robot openshift-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jun 28, 2018
@soltysh soltysh force-pushed the the_new_oc branch 2 times, most recently from 391e4a0 to dfc6405 Compare June 28, 2018 21:06
}
actual, err := o.Client.Resource(info.Mapping.Resource).Namespace(info.Namespace).Patch(info.Name, types.StrategicMergePatchType, patch.Patch)
if err != nil {
allErrs = append(allErrs, fmt.Errorf("fialed to patch secret %v", err))
Copy link
Contributor

@juanvallejo juanvallejo Jun 29, 2018

Choose a reason for hiding this comment

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

s/fialed/failed/

@openshift-ci-robot openshift-ci-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 29, 2018
@soltysh soltysh force-pushed the the_new_oc branch 2 times, most recently from 54f426e to df4770c Compare June 29, 2018 16:06
@soltysh soltysh changed the title WIP: Update set commands Update set commands Jun 29, 2018
@openshift-ci-robot openshift-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 Jun 29, 2018
@soltysh soltysh force-pushed the the_new_oc branch 2 times, most recently from 331ae43 to 9c050c0 Compare July 2, 2018 13:27
"k8s.io/client-go/dynamic"
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource"
"k8s.io/kubernetes/pkg/printers"
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we had switched to using the new pkg/genericclioptions/printers pkg?

for _, patch := range patches {
info := patch.Info
name := info.Name
if info.Mapping != nil {
Copy link
Contributor

@juanvallejo juanvallejo Jul 2, 2018

Choose a reason for hiding this comment

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

This fixes the panic we were seeing with --local, right?
(will update upstream PR to match this)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup.

Copy link
Contributor

Choose a reason for hiding this comment

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

Per @liggitt's comment here, I am wondering if we would would want to do the same in Origin? That is, default to showing lower-case kind.group (with .group being included when non-empty) when info.Mapping is nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've created GetObjectName which I'm guessing you can just add upstream, it does exactly what Jordan asked for.

continue
}

if string(patch.Patch) == "{}" || len(patch.Patch) == 0 {
fmt.Fprintf(o.Err, "info: %s %q was not changed\n", info.Mapping.Resource, info.Name)
fmt.Fprintf(o.ErrOut, "info: %s was not changed\n", name)
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we were getting rid of this message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Turned into glog.V(1).Infof("info: %s was not changed\n", name)

"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource"
"k8s.io/kubernetes/pkg/printers"
Copy link
Contributor

Choose a reason for hiding this comment

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

genericclioptions/printers?

return o.PrintObject(infos)
}
// if singleItemImplied && len(patches) == 0 {
// return fmt.Errorf("%s/%s is not a deployment config or does not have an applicable strategy", infos[0].Mapping.Resource, infos[0].Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this leftover, or are we enabling this error message in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, just fixed.

Client dynamic.Interface
func NewEnvOptions(streams genericclioptions.IOStreams) *EnvOptions {
return &EnvOptions{
PrintFlags: genericclioptions.NewPrintFlags("updated"),
Copy link
Contributor

Choose a reason for hiding this comment

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

.WithTypeSetter(oscheme.PrintingInternalScheme)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@@ -22,6 +21,7 @@ import (
"k8s.io/kubernetes/pkg/kubectl/genericclioptions"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource"
"k8s.io/kubernetes/pkg/kubectl/polymorphichelpers"
"k8s.io/kubernetes/pkg/printers"
Copy link
Contributor

Choose a reason for hiding this comment

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

genericclioptions/printers

cmd.Flags().StringVar(&o.HTTPGet, "get-url", o.HTTPGet, "A URL to perform an HTTP GET on (you can omit the host, have a string port, or omit the scheme.")

o.InitialDelaySeconds = cmd.Flags().Int("initial-delay-seconds", 0, "The time in seconds to wait before the probe begins checking")
o.SuccessThreshold = cmd.Flags().Int("success-threshold", 0, "The number of successes required before the probe is considered successful")
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we could switch these to IntVars?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are pointer to values, I'm guessing to to differentiate between set and not, although there's .Changed paramter on each flag. But I didn't want to add more to this PR. We can solve it later ;)

@soltysh
Copy link
Contributor Author

soltysh commented Jul 2, 2018

Comments addressed, ptal.

@soltysh
Copy link
Contributor Author

soltysh commented Jul 4, 2018

I'll wait for #20083 to merge and will tag this one.

@soltysh soltysh added approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. labels Jul 5, 2018
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: soltysh

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

@soltysh
Copy link
Contributor Author

soltysh commented Jul 5, 2018

Approving based on previous comments and the included commit from #20083

@soltysh
Copy link
Contributor Author

soltysh commented Jul 5, 2018

/retest

4 similar comments
@soltysh
Copy link
Contributor Author

soltysh commented Jul 5, 2018

/retest

@soltysh
Copy link
Contributor Author

soltysh commented Jul 5, 2018

/retest

@soltysh
Copy link
Contributor Author

soltysh commented Jul 6, 2018

/retest

@soltysh
Copy link
Contributor Author

soltysh commented Jul 6, 2018

/retest

@openshift-ci-robot
Copy link

New changes are detected. LGTM label has been removed.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 6, 2018
@soltysh
Copy link
Contributor Author

soltysh commented Jul 6, 2018

Rebase only, re-applying the label back.

@soltysh soltysh added the lgtm Indicates that a PR is ready to be merged. label Jul 6, 2018
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 6, 2018

@soltysh: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/openshift-jenkins/extended_builds dfc6405 link /test extended_builds

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. I understand the commands that are listed here.

@soltysh
Copy link
Contributor Author

soltysh commented Jul 6, 2018

/retest

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. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants