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

[multi-container] toggling the default enable-multi-container from true to false will break things #7241

Closed
dprotaso opened this issue Mar 13, 2020 · 14 comments · Fixed by #9260
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@dprotaso
Copy link
Member

dprotaso commented Mar 13, 2020

What version of Knative?

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.

Steps to Reproduce the Problem

@dprotaso dprotaso added the kind/bug Categorizes issue or PR as related to a bug. label Mar 13, 2020
@dprotaso dprotaso 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 Mar 13, 2020
@dprotaso dprotaso added this to the Serving 0.16.x milestone May 27, 2020
@markusthoemmes
Copy link
Contributor

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
Copy link
Member Author

Yeah I was thinking about that as well

@markusthoemmes
Copy link
Contributor

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

configmap.Constructors{
. That function takes both the old and the new CM, does validation and maybe returns the new CM or an error.

Does that sound just about feasible? I'd take this issue to mentor a new contributor in :).

@vagababov
Copy link
Contributor

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
Copy link
Contributor

skonto commented 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
Copy link
Member Author

@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

@vagababov
Copy link
Contributor

Also we don't want CMs to be immutable. But operators might, i.e. mark the CMs as immutable in the operator deployment.

@dprotaso
Copy link
Member Author

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
Copy link
Contributor

skonto commented Jun 30, 2020

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
Copy link
Contributor

Seems to me as adding a cautionary warning to the configmap setting is sufficient for now?

@vagababov
Copy link
Contributor

Warning is fine.


If there are settings not meant to be changed once set...

Not necessarily true, settings might be set by mistake. I might be sure that disabling the setting is going to be safe, etc.

@dprotaso dprotaso modified the milestones: Serving 0.16.x, 0.17.x Jul 8, 2020
@skonto
Copy link
Contributor

skonto commented Jul 9, 2020

@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)?

@markusthoemmes
Copy link
Contributor

features.yaml has it now I believe.

@markusthoemmes
Copy link
Contributor

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants