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

treat binary buildconfig instantiate requests as long running #12679

Merged
merged 1 commit into from
Feb 1, 2017

Conversation

bparees
Copy link
Contributor

@bparees bparees commented Jan 26, 2017

fixes #11563

@bparees
Copy link
Contributor Author

bparees commented Jan 26, 2017

@smarterclayton ptal

@ncdc @smarterclayton implied you might be the right one to review this also, in terms of picking the "right" place to setup the long running check.

@bparees
Copy link
Contributor Author

bparees commented Jan 26, 2017

[test]

@ncdc
Copy link
Contributor

ncdc commented Jan 26, 2017

I'll take a look in a bit. cc @sttts

@bparees bparees force-pushed the binary_longrunning branch from 719e056 to 40d8994 Compare January 26, 2017 18:08
longRunningRequestCheckFunc := func(r *http.Request) bool {
return longRunningRequestCheck(r) || kc.LongRunningFunc(r)
}
handler = kgenericfilters.WithTimeoutForNonLongRunningRequests(handler, longRunningRequestCheckFunc)
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't like to have this logic here. Can't we add that RE to kc.LongRunningFunc (haven't looked at the code) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

genericapiserver.Config can be customized. Just extend the upstream default function and set it in the config.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you elaborate on why you don't like it here? This puts it as close to where we setup the handler as possible, ensuring it doesn't get skipped by an alternate codepath (e.g. test code that mocks bringing up the api server).

Copy link
Contributor

Choose a reason for hiding this comment

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

It complicates the handler chain even more. There were complaints already in this direction. Moreover, the Config.LongRunningFunc exists for the very reason of customizability. Otherwise, we would have hardcoded it in the upstream code.

@bparees
Copy link
Contributor Author

bparees commented Jan 30, 2017 via email

genericConfig.LongRunningFunc = func(r *http.Request) bool {
return longRunningRequestCheck(r) || kubeLongRunningFunc(r)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sttts i don't know if this is closer to what you had in mind... but i want to retain the behavior of delegating to the kubernetes default function so that if it is changed, we are still honoring it. ptal.

Copy link
Contributor

Choose a reason for hiding this comment

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

Much better 👍


// request paths that match this regular expression will be treated as long running
// and not subjected to the default server timeout.
longRunningEndpointsRE = "(/|^)buildconfigs/.*?/instantiatebinary$"
Copy link
Contributor

Choose a reason for hiding this comment

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

can we call this extraLongRunningEndpointsRE or even originLongRunningEndpointsRE?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure.

@@ -301,6 +309,13 @@ func BuildKubernetesMasterConfig(options configapi.MasterConfig, requestContextM
}
genericConfig.ExternalAddress = url.Host

longRunningRequestRE := regexp.MustCompile(longRunningEndpointsRE)
longRunningRequestCheck := kgenericfilters.BasicLongRunningRequestCheck(longRunningRequestRE, nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

Better: originLongRunningFunc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do.

@bparees bparees force-pushed the binary_longrunning branch from 977ce29 to ad60ba3 Compare January 30, 2017 19:56
@bparees
Copy link
Contributor Author

bparees commented Jan 30, 2017

@sttts updated, ptal.

@sttts
Copy link
Contributor

sttts commented Jan 30, 2017

Code lgtm. Somebody else has to review whether the overall change is ok. /cc @ncdc @mfojtik


// request paths that match this regular expression will be treated as long running
// and not subjected to the default server timeout.
originLongRunningEndpointsRE = "(/|^)buildconfigs/.*?/instantiatebinary$"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the question mark in .*??

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 think it's probably unnecessary in this case, but i generally try to default to non-greedy matching. tends to have less surprises.

Copy link
Contributor

Choose a reason for hiding this comment

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

shoudln't the MustCompile be here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, but it should be a constant, not a variable, if we're going to follow the pattern kube used.

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 to make it a constant.


// request paths that match this regular expression will be treated as long running
// and not subjected to the default server timeout.
originLongRunningEndpointsRE = "(/|^)buildconfigs/.*?/instantiatebinary$"
Copy link
Contributor

Choose a reason for hiding this comment

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

shoudln't the MustCompile be here?

@bparees bparees force-pushed the binary_longrunning branch from ad60ba3 to 7678e97 Compare January 30, 2017 21:04
@bparees
Copy link
Contributor Author

bparees commented Jan 31, 2017

@ncdc @smarterclayton bump

@bparees
Copy link
Contributor Author

bparees commented Jan 31, 2017

extended image_eco passed.

[testextended][extended:core(builds)]

@ncdc
Copy link
Contributor

ncdc commented Jan 31, 2017

@bparees .*? still looks weird to me, but if nobody else objects, lgtm

@bparees
Copy link
Contributor Author

bparees commented Jan 31, 2017

.*? still looks weird to me, but if nobody else objects, lgtm

eh, i'll take it out.

@bparees bparees force-pushed the binary_longrunning branch from 7678e97 to c083b52 Compare January 31, 2017 16:05
@openshift-bot
Copy link
Contributor

Evaluated for origin test up to c083b52

@openshift-bot
Copy link
Contributor

Evaluated for origin testextended up to c083b52

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/13439/) (Base Commit: ed1d332)

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/testextended SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin_extended/1049/) (Base Commit: ed1d332) (Extended Tests: core(builds))

@bparees
Copy link
Contributor Author

bparees commented Jan 31, 2017

[merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to c083b52

@openshift-bot
Copy link
Contributor

openshift-bot commented Feb 1, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/13457/) (Base Commit: 6b6610a) (Image: devenv-rhel7_5823)

@openshift-bot openshift-bot merged commit 2fd327e into openshift:master Feb 1, 2017
@bparees bparees deleted the binary_longrunning branch February 1, 2017 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

binary build timeout uploading artifacts
5 participants