-
Notifications
You must be signed in to change notification settings - Fork 1.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
Set REST timeout when timeout cli arg is provided #6440
Conversation
ad2a925
to
5d02640
Compare
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.
@sebsoto Thanks for taking the time to write up this contribution! Overall I think the change suggested is reasonable, but I think the existing change doesn't actually address this. I left a comment that elaborates on this a bit more:
internal/olm/installer/manager.go
Outdated
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 I think this sounds like a reasonable change, however I think this is being done in the wrong file based on the context given in the PR description. This configuration is only for the operator-sdk olm install
command and doesn't apply broadly to all commands.
I can see an argument for applying this more broadly but based on the PR description this change seems to be more focused on updating operator-sdk run bundle
and I'd personally prefer to keep this PR scoped to only that command set for now. Having said that, the appropriate place to make this change would likely be in this function:
operator-sdk/internal/olm/operator/config.go
Lines 67 to 113 in 6a6edfd
func (c *Configuration) Load() error { | |
if c.overrides == nil { | |
c.overrides = &clientcmd.ConfigOverrides{} | |
} | |
loadingRules := clientcmd.NewDefaultClientConfigLoadingRules() | |
loadingRules.ExplicitPath = c.KubeconfigPath | |
mergedConfig, err := loadingRules.Load() | |
if err != nil { | |
return err | |
} | |
cfg := clientcmd.NewDefaultClientConfig(*mergedConfig, c.overrides) | |
cc, err := cfg.ClientConfig() | |
if err != nil { | |
return err | |
} | |
ns, _, err := cfg.Namespace() | |
if err != nil { | |
return err | |
} | |
sch := scheme.Scheme | |
for _, f := range []func(*runtime.Scheme) error{ | |
v1alpha1.AddToScheme, | |
v1.AddToScheme, | |
apiextv1.AddToScheme, | |
} { | |
if err := f(sch); err != nil { | |
return err | |
} | |
} | |
cl, err := client.New(cc, client.Options{ | |
Scheme: sch, | |
}) | |
if err != nil { | |
return err | |
} | |
c.Scheme = sch | |
c.Client = &operatorClient{cl} | |
if c.Namespace == "" { | |
c.Namespace = ns | |
} | |
c.RESTConfig = cc | |
return nil | |
} |
IIRC this configuration type is the configuration that is used for both operator-sdk run bundle
and operator-sdk run bundle-upgrade
commands so modifying this Configuration.Load()
function should help address the issue you outlined in the PR description.
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.
Thanks for the review, sorry it took so long for me to get back to this. I took a crack at moving the change to the file you suggested.
Please let me know if I'm misusing the overrides struct, I wasn't sure if this would be the correct way to set the timeout.
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
5d02640
to
8fb5676
Compare
/remove-lifecycle stale |
8fb5676
to
49a175b
Compare
The timeout arg sets the overall timeout for the full command to finish, such as `run bundle`, but it doesn't affect the timeout of individual API server requests. This remains the default timeout specified in the API server configuration. This means that even if a user wants `run bundle` to timeout after 5m, the command may return earlier due to an individual request's timeout being hit. This commit fixes that behavior by setting the Timeout value in the client cfg to the value passed in by the user, this will prevent the individual request from timing out before the desired timeout. Signed-off-by: Sebastian Soto <ssoto@redhat.com>
49a175b
to
58f56d6
Compare
@everettraven Could you take another a look at this when you get a chance? Thanks! |
Looks like the actions here are stuck. Going to close and re-open to kick them |
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
Stale issues rot after 30d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle rotten |
Rotten issues close after 30d of inactivity. Reopen the issue by commenting /close |
@openshift-bot: Closed this PR. In response to this:
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. |
Description of the change:
The timeout arg sets the overall timeout for the full command to finish, such as
run bundle
, but it doesn't affect the timeout of individual API server requests. This remains the default timeout specified in the API server configuration. This means that even if a user wantsrun bundle
to timeout after 5m, the command may return earlier due to an individual request's timeout being hit.This commit fixes that behavior by setting the Timeout value in the client cfg to the value passed in by the user, this will prevent the individual request from timing out before the desired timeout.
Motivation for the change:
operator-sdk bundle run fails on operators that take longer than usual to install