-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Update set commands #20139
Conversation
391e4a0
to
dfc6405
Compare
pkg/oc/cli/cmd/set/buildsecret.go
Outdated
} | ||
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/fialed/failed/
54f426e
to
df4770c
Compare
331ae43
to
9c050c0
Compare
pkg/oc/cli/cmd/set/buildhook.go
Outdated
"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" |
There was a problem hiding this comment.
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?
pkg/oc/cli/cmd/set/buildhook.go
Outdated
for _, patch := range patches { | ||
info := patch.Info | ||
name := info.Name | ||
if info.Mapping != nil { |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
pkg/oc/cli/cmd/set/buildhook.go
Outdated
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
pkg/oc/cli/cmd/set/buildsecret.go
Outdated
"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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
genericclioptions/printers?
pkg/oc/cli/cmd/set/deploymenthook.go
Outdated
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, just fixed.
pkg/oc/cli/cmd/set/env.go
Outdated
Client dynamic.Interface | ||
func NewEnvOptions(streams genericclioptions.IOStreams) *EnvOptions { | ||
return &EnvOptions{ | ||
PrintFlags: genericclioptions.NewPrintFlags("updated"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.WithTypeSetter(oscheme.PrintingInternalScheme)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
pkg/oc/cli/cmd/set/probe.go
Outdated
@@ -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" |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 ;)
Comments addressed, ptal. |
I'll wait for #20083 to merge and will tag this one. |
[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 |
Approving based on previous comments and the included commit from #20083 |
/retest |
4 similar comments
/retest |
/retest |
/retest |
/retest |
New changes are detected. LGTM label has been removed. |
Rebase only, re-applying the label back. |
@soltysh: The following test failed, say
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. |
/retest |
/assign @deads2k @juanvallejo