-
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
Add 'oc set probe' for setting readiness and liveness #7331
Add 'oc set probe' for setting readiness and liveness #7331
Conversation
Mapper meta.RESTMapper | ||
|
||
PrintObject func(runtime.Object) error | ||
UpdatePodSpecForObject func(runtime.Object, func(spec *kapi.PodSpec) error) (bool, error) |
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.
please start typing these or this will become another Factory
.
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.
For a single use field the type doesn't make anything better less
understandable (I have to go find the method, add Godoc to it, etc). Also,
Factory isn't the wrong pattern - this is the simplest way to express a set
of common behaviors that multiple commands use that can be abstracted.
Passing the factory onto Options is definitely the wrong pattern.
On Tue, Feb 16, 2016 at 4:08 PM, David Eads notifications@github.com
wrote:
In pkg/cmd/cli/cmd/set/probe.go
#7331 (comment):
- Filenames []string
- ContainerSelector string
- Selector string
- All bool
- Builder *resource.Builder
- Infos []*resource.Info
- Encoder runtime.Encoder
- ShortOutput bool
- Mapper meta.RESTMapper
- PrintObject func(runtime.Object) error
- UpdatePodSpecForObject func(runtime.Object, func(spec *kapi.PodSpec) error) (bool, error)
please start typing these or this will become another Factory.
—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/7331/files#r53078585.
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.
Factory with a bunch of specialized function types that themselves end up being overridden by other things that just happen to know they want exactly the same shape of function without an named type makes rebasing and keeping the bits in sync very difficult. It has also make it nearly impossible to split the Factory
apart into sub-chunks that have bits that we want.
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.
Splitting the factory isn't really worth it - seventeen different
interfaces being passed in 5 different shapes of interface holder objects
to a hundred commands is madness. Going from function pointers to
interfaces is a worthy goal, it just isn't on my list of "things that are
causing users or programmers problems"
On Wed, Feb 17, 2016 at 9:36 AM, David Eads notifications@github.com
wrote:
In pkg/cmd/cli/cmd/set/probe.go
#7331 (comment):
- Filenames []string
- ContainerSelector string
- Selector string
- All bool
- Builder *resource.Builder
- Infos []*resource.Info
- Encoder runtime.Encoder
- ShortOutput bool
- Mapper meta.RESTMapper
- PrintObject func(runtime.Object) error
- UpdatePodSpecForObject func(runtime.Object, func(spec *kapi.PodSpec) error) (bool, error)
Factory with a bunch of specialized function types that themselves end up
being overridden by other things that just happen to know they want exactly
the same shape of function without an named type makes rebasing and keeping
the bits in sync very difficult. It has also make it nearly impossible to
split the Factory apart into sub-chunks that have bits that we want.—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/7331/files#r53171584.
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 is now using pointers instead of flag set.
On Wed, Feb 17, 2016 at 9:55 AM, Clayton Coleman ccoleman@redhat.com
wrote:
Splitting the factory isn't really worth it - seventeen different
interfaces being passed in 5 different shapes of interface holder objects
to a hundred commands is madness. Going from function pointers to
interfaces is a worthy goal, it just isn't on my list of "things that are
causing users or programmers problems"On Wed, Feb 17, 2016 at 9:36 AM, David Eads notifications@github.com
wrote:In pkg/cmd/cli/cmd/set/probe.go
#7331 (comment):
- Filenames []string
- ContainerSelector string
- Selector string
- All bool
- Builder *resource.Builder
- Infos []*resource.Info
- Encoder runtime.Encoder
- ShortOutput bool
- Mapper meta.RESTMapper
- PrintObject func(runtime.Object) error
- UpdatePodSpecForObject func(runtime.Object, func(spec *kapi.PodSpec) error) (bool, error)
Factory with a bunch of specialized function types that themselves end up
being overridden by other things that just happen to know they want exactly
the same shape of function without an named type makes rebasing and keeping
the bits in sync very difficult. It has also make it nearly impossible to
split the Factory apart into sub-chunks that have bits that we want.—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/7331/files#r53171584.
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.
it just isn't on my list of "things that are
causing users or programmers problems"
Wait, I'm a programmer and it causes me problems on a rebase! Take the last one as a for instance. I spent hours chasing down the duplicate definitions of one logical type for a clientmapper function.
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.
Sure, the interface stuff would help that (not opposed to that change). Am
opposed to splitting up factory or anything other than "Factory is a struct
{ interface1 interface2 interface3 }" which I still think is vulnerable to
the problem you describe.
On Wed, Feb 17, 2016 at 10:37 AM, David Eads notifications@github.com
wrote:
In pkg/cmd/cli/cmd/set/probe.go
#7331 (comment):
- Filenames []string
- ContainerSelector string
- Selector string
- All bool
- Builder *resource.Builder
- Infos []*resource.Info
- Encoder runtime.Encoder
- ShortOutput bool
- Mapper meta.RESTMapper
- PrintObject func(runtime.Object) error
- UpdatePodSpecForObject func(runtime.Object, func(spec *kapi.PodSpec) error) (bool, error)
it just isn't on my list of "things that are
causing users or programmers problems"Wait, I'm a programmer and it causes me problems on a rebase! Take the
last one as a for instance. I spent hours chasing down the duplicate
definitions of one logical type for a clientmapper function.—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/7331/files#r53181031.
UI depends on kubernetes/kubernetes#21341 |
479a7fc
to
460110d
Compare
ContainerSelector: "*", | ||
} | ||
cmd := &cobra.Command{ | ||
Use: "probe RESOURCE/NAME [--readiness|--liveness] ...", |
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.
At least one of readiness or liveness are required, so it doesn't take brackets here: --readiness|--liveness
.
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'd suggest this usage line:
probe (RESOURCE/NAME | RESOURCE --all) --readiness|--liveness [--get-url=URL] [--open-tcp=PORT] [-- COMMAND]
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.
In fact I just noticed in Validate
that you can only set one of the probe rules, so it could actually be
probe (RESOURCE/NAME | RESOURCE --all) --readiness|--liveness (--unset | --get-url=URL | --open-tcp=PORT | -- COMMAND)
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.
That's probably too long to fit on a normal screen, but I'll check it
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.
Probably. Resource arg can be just RESOURCE/NAME
, we do that already in other commands even when they accept --all
. If the rest fits it would be good, makes it pretty clear what options you have.
e8ada65
to
5bfb4c4
Compare
[test] |
67f4062
to
1353b8c
Compare
da22041
to
6e28ecf
Compare
https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/11465/console
|
[test] |
This is ready for final review @fabianofranz or @Kargakis |
9242572
to
0f30adc
Compare
cmd.Flags().BoolVar(&options.All, "all", options.All, "Select all resources in the namespace of the specified resource types") | ||
cmd.Flags().StringSliceVarP(&options.Filenames, "filename", "f", options.Filenames, "Filename, directory, or URL to file to use to edit the resource.") | ||
|
||
cmd.Flags().BoolVar(&options.Remove, "remove", options.Remove, "If true, remove the specified probe(s).") |
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.
Add --remove-all
like in triggers?
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 only two, so it didn't seem like we needed it. Triggers are a
list, this is more of a named struct.
On Sun, Feb 21, 2016 at 7:59 PM, Fabiano Franz notifications@github.com
wrote:
In pkg/cmd/cli/cmd/set/probe.go
#7331 (comment):
// TODO: move met to kcmdutil
if err == cmdutil.ErrExit {
os.Exit(1)
}
kcmdutil.CheckErr(err)
}
},
- }
- kcmdutil.AddPrinterFlags(cmd)
- cmd.Flags().StringVarP(&options.ContainerSelector, "containers", "c", options.ContainerSelector, "The names of containers in the selected pod templates to change - may use wildcards")
- cmd.Flags().StringVarP(&options.Selector, "selector", "l", options.Selector, "Selector (label query) to filter on")
- cmd.Flags().BoolVar(&options.All, "all", options.All, "Select all resources in the namespace of the specified resource types")
- cmd.Flags().StringSliceVarP(&options.Filenames, "filename", "f", options.Filenames, "Filename, directory, or URL to file to use to edit the resource.")
- cmd.Flags().BoolVar(&options.Remove, "remove", options.Remove, "If true, remove the specified probe(s).")
Add --remove-all like in triggers?
—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/7331/files#r53578238.
Minor comments but LGTM. |
0f30adc
to
c38eaef
Compare
$ %[1]s probe dc/router --readiness --get-url=https://127.0.0.1:1936/stats | ||
|
||
# Set only the initial-delay-seconds field on all deployments | ||
$ %[1]s probe dc --all --readiness --initial-delay-seconds=30` |
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.
FWIW, most commands don't use --all and have the same effect.
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 would like to make requiring --all for any mutation command, and make that part of kubectl conventions. kubectl delete pods
lacks specificity as to user intent, and for the other commands we are "safe" when someone does the simple thing, so we should be safe on mutation.
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.
will this support 30s
or 1m
? it always has to be seconds, right?
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.
It has to be seconds because that's what the API supports. We could
support integer durations in the future, but practically this will always
be a number between 0 and 240
On Tue, Feb 23, 2016 at 8:05 AM, Michal Fojtik notifications@github.com
wrote:
In pkg/cmd/cli/cmd/set/probe.go
#7331 (comment):
- $ %[1]s probe dc/registry --remove --readiness --liveness
Set an exec action as a liveness probe to run 'echo ok'
- $ %[1]s probe dc/registry --liveness -- echo ok
Set a readiness probe to try to open a TCP socket on 3306
- $ %[1]s probe rc/mysql --readiness --open-tcp=3306
Set an HTTP readiness probe for port 8080 and path /healthz over HTTP on the pod IP
- $ %[1]s probe dc/webapp --readiness --get-url=http://:8080/healthz
Set an HTTP readiness probe over HTTPS on 127.0.0.1 for a hostNetwork pod
- $ %[1]s probe dc/router --readiness --get-url=https://127.0.0.1:1936/stats
Set only the initial-delay-seconds field on all deployments
- $ %[1]s probe dc --all --readiness --initial-delay-seconds=30`
will this support 30s or 1m ? it always has to be seconds, right?
—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/7331/files#r53776601.
c38eaef
to
f6c79df
Compare
Updated, PTAL |
[test] |
[test] On Tue, Feb 23, 2016 at 7:30 AM, OpenShift Bot notifications@github.com
|
Any other comments? Will merge at 11am EST otherwise |
LGTM |
Adds a new helper which should be used for getting patches for changes (can be abstracted further).
f6c79df
to
b2de291
Compare
[merge] |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/1558/) (Image: devenv-rhel7_3525) |
Evaluated for origin merge up to b2de291 |
Evaluated for origin test up to b2de291 |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/1558/) |
Merged by openshift-bot
Adds a new helper which should be used for getting patches for
changes (can be abstracted further).
@spadgett FYI