You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[multi-container] toggling the default enable-multi-container from true to false will break things #7241
enable-multi-container flag was introduced in this PR #7167
Expected Behavior
Operators who set enable-multi-container default to true shouldn't be able to set it back to false or even delete the entry in the config map
Actual Behavior
There are no restrictions to how enable-multi-container can be set.
Thus if users create multi-container revisions and then the operator sets the default to false reconciliation of those resources will start to constantly fail.
changed the title [-][multi-container] toggling the default enable-multi-container from true and then to false will break things[/-][+][multi-container] toggling the default enable-multi-container from true to false will break things[/+]on Mar 13, 2020
This might be somewhat non-trivial as our current validation logic for ConfigMaps only gets the state of the update itself, not the "before" state, thus (I think?) it cannot decide whether you're actually toggling or not. As such, this might require significant changes to how we validate ConfigMaps in our webhook. Does that sound right @dprotaso?
We might be lucky because the configmap.Constructors type is map[string]interface{} and the functions are called by reflection already. Maybe we can make it so that it can take both unary and 2-arity functions and depending on which it gets, it passes the correct parameters in?
We could then create a ValidateABC function for the features configmap that we pass into the webhook here
@markusthoemmes regarding update If I read correctly this new enhancement by K8s (immutable configmaps) might be useful so configuration could be split to immutable and mutable parts. @vagababov It will probably cover deletion too.
@markusthoemmes regarding update If I read correctly this new enhancement by K8s (immutable configmaps) might be useful so configuration could be split to immutable and mutable parts. @vagababov It will probably cover deletion too.
Our current min K8s version is 1.16 so it'll be sometime before we can adopt that feature
Our current min K8s version is 1.16 so it'll be sometime before we can adopt that feature.
True it will take a few months, but it seems it will go to Beta.
Also we don't want CMs to be immutable. But operators might.
If there are settings not meant to be changed once set, then they can be put in a special immutable configmap. This way it would be clear what can or cannot be changed at runtime IMHO.
An alternative would be to keep critical config replicated at the Knative CR object (eg. in status) or at the operator CR object (if operators are used) since configuration is part of the state of your system anyway. This way you know your past state and you could reject new updates. Of course CR objects can be updated so you dont get much protection but if they are deleted it means your system needs to be reconciled anyway.
@markusthoemmes afaik the setting has been removed from the defaults.yaml file in #8315, is there some other place to add the warning (or do you mean emit a log msg)?
Activity
[-][multi-container] toggling the default enable-multi-container from true and then to false will break things[/-][+][multi-container] toggling the default enable-multi-container from true to false will break things[/+]markusthoemmes commentedon Jun 24, 2020
This might be somewhat non-trivial as our current validation logic for ConfigMaps only gets the state of the update itself, not the "before" state, thus (I think?) it cannot decide whether you're actually toggling or not. As such, this might require significant changes to how we validate ConfigMaps in our webhook. Does that sound right @dprotaso?
dprotaso commentedon Jun 24, 2020
Yeah I was thinking about that as well
markusthoemmes commentedon Jun 24, 2020
We might be lucky because the
configmap.Constructorstype ismap[string]interface{}and the functions are called by reflection already. Maybe we can make it so that it can take both unary and 2-arity functions and depending on which it gets, it passes the correct parameters in?We could then create a
ValidateABCfunction for the features configmap that we pass into the webhook hereserving/cmd/webhook/main.go
Line 154 in 5ce203e
Does that sound just about feasible? I'd take this issue to mentor a new contributor in :).
vagababov commentedon Jun 24, 2020
I don't see this working though. I can just delete the CM. Or you're going to block deletion of CM as well?
skonto commentedon Jun 27, 2020
@markusthoemmes regarding update If I read correctly this new enhancement by K8s (immutable configmaps) might be useful so configuration could be split to immutable and mutable parts. @vagababov It will probably cover deletion too.
dprotaso commentedon Jun 29, 2020
Our current min K8s version is 1.16 so it'll be sometime before we can adopt that feature
vagababov commentedon Jun 29, 2020
Also we don't want CMs to be immutable. But operators might, i.e. mark the CMs as immutable in the operator deployment.
dprotaso commentedon Jun 29, 2020
I also realize this issue applies to other features - ie. enabling and disabling fieldref.
Maybe the solution for now is operator awareness - maybe via comments in the features configmap
skonto commentedon Jun 30, 2020
True it will take a few months, but it seems it will go to Beta.
If there are settings not meant to be changed once set, then they can be put in a special immutable configmap. This way it would be clear what can or cannot be changed at runtime IMHO.
An alternative would be to keep critical config replicated at the Knative CR object (eg. in
status) or at the operator CR object (if operators are used) since configuration is part of the state of your system anyway. This way you know your past state and you could reject new updates. Of course CR objects can be updated so you dont get much protection but if they are deleted it means your system needs to be reconciled anyway.markusthoemmes commentedon Jun 30, 2020
Seems to me as adding a cautionary warning to the configmap setting is sufficient for now?
vagababov commentedon Jun 30, 2020
Warning is fine.
Not necessarily true, settings might be set by mistake. I might be sure that disabling the setting is going to be safe, etc.
skonto commentedon Jul 9, 2020
@markusthoemmes afaik the setting has been removed from the
defaults.yamlfile in #8315, is there some other place to add the warning (or do you mean emit a log msg)?markusthoemmes commentedon Jul 9, 2020
features.yamlhas it now I believe.markusthoemmes commentedon Sep 2, 2020
/assign