-
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
Adding synchronization and other features to extended test cluster loader. #17894
Adding synchronization and other features to extended test cluster loader. #17894
Conversation
ade2888
to
3adc981
Compare
Flakes on:
|
29914ac
to
ca85550
Compare
Flakes on:
|
@sjug PTAL |
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.
A few changes, looking good overall.
Number int `mapstructure:"num"` | ||
Basename string | ||
Tuning string | ||
Configmaps map[string]interface{} |
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.
nit, missing a space?
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.
Not sure where, formatted by gofmt, also used go tool vet
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.
The columns should align, not sure why you're not getting proper output.
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.
Which columns do not align? I do not see any mis-alignment. Again, the code is formatted with "gofmt -s -d context.go" produces no diff. Please be specific.
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.
The one I've tagged, line 26?
Configmaps
is aligned, but map[string]interface{}
is not.
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's just on github... ffs
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.
Great, was getting desperate...
@@ -33,9 +36,22 @@ type ClusterLoaderObjectType struct { | |||
Image string | |||
Basename string | |||
File string | |||
Sync SyncObjectType |
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.
Why is SyncObjectType
nested in two structs?
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 order to perform synchronization both on template/pod and cluster-loader wide level.
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.
We need to discuss this further.
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.
Not currently used but may be helpful in the future.
test/extended/cluster/context.go
Outdated
// SyncObjectType is nested object type for cluster loader synchronisation functionality | ||
type SyncObjectType struct { | ||
Server struct { | ||
Enable bool |
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.
nit, should probably be Enabled
test/extended/cluster/utils.go
Outdated
if v != 0 && v != "" { | ||
args = append(args, "-p") | ||
args = append(args, fmt.Sprintf("%s=%v", k, v)) | ||
val := v |
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 think I understand what you're trying to do here, but it's not necessary as k
& v
are already new variables.
test/extended/cluster/utils.go
Outdated
// Parameter not defined, see if it is defined in the environment. | ||
var found bool | ||
val, found = os.LookupEnv(fmt.Sprintf("%s", k)) | ||
if found == false { |
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.
found
is boolean so we don't need to explicitly compare it.
if found {
...
test/extended/cluster/cl.go
Outdated
// Create secrets | ||
if p.Secrets != nil { | ||
// Secrets defined | ||
for k, v := range p.Secrets { |
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 block looks really similar to the configmap version L87-91 😄
Can we make it more generic too?
test/extended/cluster/utils.go
Outdated
return args, err | ||
} | ||
|
||
func getSecretArgs(k string, v interface{}) (args []string, err 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.
nit, very similar to getConfigMapArgs
.
test/extended/cluster/utils.go
Outdated
@@ -41,12 +48,58 @@ func ParsePods(jsonFile string) (configStruct kapiv1.Pod) { | |||
return | |||
} | |||
|
|||
// Wait for pods to go into Running or "not Running" state | |||
func SyncPods(c kclientset.Interface, ns string, selectors map[string]string, timeout time.Duration, negate bool) (err 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.
This has already been implemented a bunch of times in the e2e framework (example). Do we want another version here to maintain?
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.
So how do you implement waiting for a pod to go into anything but "Running" state using the code you pointed out?
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.
Usually we would expect a specific state.
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 do not see why. Expecting anything but "not Running" instead of "Complete/Error/..." is a valid reason for synchronization.
edit: On second thought, waiting for Complete + setting a timeout for complete might actually be a better idea. Will rewrite then.
test/extended/cluster/utils.go
Outdated
} | ||
|
||
return 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.
Shouldn't this be return nil
or what error is this?
test/extended/cluster/cl.go
Outdated
} | ||
} | ||
} | ||
|
||
if sync.Running { | ||
for _, ns := range namespaces { | ||
err := SyncRunningPods(c, ns, sync.Selectors, time.Duration(sync.Timeout)*time.Second) |
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.
time.Duration(sync.Timeout)*time.Second
This kind of pattern has happened a lot in here, I suggest using time.ParseDuration
rather than hardcoding. This is something I've done in the perf-tests cluster loader version.
ca85550
to
71f7984
Compare
@sjug please check that all your concerns have been addressed. |
test/extended/cluster/utils.go
Outdated
// Server is the webservice that will syncronize the start and stop of Pods | ||
func Server(c *PodCount) error { | ||
// Server is the webservice that will synchronize the start and stop of Pods | ||
func Server(c *PodCount, Port int, awaitShutdown 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.
Port
should not be capitalized.
test/extended/cluster/utils.go
Outdated
http.HandleFunc("/start", handleStart(startHandler, c)) | ||
http.HandleFunc("/stop", handleStop(stopHandler, c)) | ||
if Port <= 0 { |
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.
How could Port
be < 0
?
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.
Perhaps because it is a signed int and user defined it as negative? Most code I've seen in origin uses int for ports.
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 rather it just throw an error in that edge case, but this will be fine, maybe add a log message?
test/extended/cluster/utils.go
Outdated
maxRetries = 4 | ||
|
||
// Poll every two seconds | ||
Poll = 2 * time.Second |
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.
Not sure we need to export this?
de27297
to
e4d5665
Compare
…loader. Fixes: - number of templates no longer ignored - tuningsets no longer ignored for templates - maxRetries reflected the number of all tries, not retries New features: - label-based pod post deployment synchronization at pod, template or global level - creation of config maps and secrets from files - support for getting parameter values from the environment
e4d5665
to
dd2366b
Compare
@sjug AFAIK all requests for change addressed. |
/LGTM @jmencak |
/assign @stevekuznetsov |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jmencak, knobunc, sjug The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Flake on ci/openshift-jenkins/extended_conformance_gce "dial tcp 10.142.0.5:10250: getsockopt: connection refused" |
/test extended_conformance_gce |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. |
Documenting synchronization primitives and the possibility to create ConfigMaps and Secrets from files as implemented by openshift/origin#17894 (cherry picked from commit c85b8a9) xref:openshift#7297
Fixes:
New features:
or global level