Repository navigation
Description
What version of Knative?
1.16.x and previous versions
Expected Behavior
When revision-timeout-seconds=revision-response-start-timeout-seconds in config defaults a revision without any timeouts should get 0 for revision-response-start-timeout-seconds.
Actual Behavior
revision-response-start-timeout-seconds is set wrongly when its default equals to the default timeoutSeconds in configmap defaults.
Now it gets 300 which is the default if the configmap values are not modified. However, when the user sets those values to be equal, he expects to allow any response time until the revision timeout expires not an arbitrary default value eg. 300.
Steps to Reproduce the Problem
In config defaults we set:
max-revision-timeout-seconds: "584"
revision-response-start-timeout-seconds: "582"
revision-timeout-seconds: "582"
Apply a service without any timeouts and then observe:
kubectl get revision autoscale-go-00001 -ojson | jq .spec.timeoutSeconds
582
kubectl get revision autoscale-go-00001 -ojson | jq .spec.responseStartTimeoutSeconds
300
Given the logic in revision defaults we should see 0 for responseStartTimeoutSeconds.
The reason this falls back to 300 is due to the wrong config store used.
Long ago we split config stores so that the configuration controller
and the revision controller can have a separate one. However the configuration_defaults code here calls the revision_default code here.
The revision defaulting code will get its own config values from here
cfg := config.FromContextOrDefaults(ctx), however that config store has not be initialized as this is the configuration controller and it only gets the default configmap values, thus the value 300.
A fix requires to inject the right values in the ctx as follows:
@@ -67,5 +75,19 @@ func (cs *ConfigurationSpec) SetDefaults(ctx context.Context) {
return
}
}
+
+ cfg := cconfig.FromContext(ctx)
+ cf := config.Config{}
+ if cfg != nil && cfg.Defaults != nil {
+ cf.Defaults = cfg.Defaults.DeepCopy()
+ }
+ if cfg != nil && cfg.Features != nil {
+ cf.Features = cfg.Features.DeepCopy()
+ }
+ if cfg != nil {
+ ctx = config.ToContext(ctx, &cf)
+ }
+
cs.Template.SetDefaults(ctx)
}
To debug further you can use this branch.
Activity
[-]revision-response-start-timeout-seconds is set wrongly when its default equals to the default timeoutSeconds in configmap defaults[/-][+]revision-response-start-timeout-seconds is set wrongly [/+]