Closed alembiewski closed 3 years ago
@alembiewski I confirm that I'm able to reproduce this; hopefully will come up with a fix proposal/PR in the near future.
@alembiewski After trying to come up with a simpler test, I realized that the underlying issue is more general, and affects not only dependent operators.
Currently, there is no way to upgrade an operator that has both dedicated upgrade and update plans, if the upgrade adds a required parameter without a default. One could imagine that such an update should be possible when a value for the new parameter is set together with update; however, If one tries to specify a value for the new parameter, this results in two conflicting plans being triggered. I fully agree with your suggestion that "update" should simply be not be triggered in this case, and hence this is a bug.
IMO, it is quite logical that your example in this issue is also affected by this bug: as the parameter value in your example is pulled from the parent instance, the upgrade results not only in adding a parameter to dependency's OV, but also in adding a parameter to the instance of the dependency.
Thus, my https://github.com/kudobuilder/kudo/pull/1780 tries to address the bug I outlined above.
And how the upgrade is going to work in case when the value of the existing parameters actually changes between the versions? What is the recomended way to perform upgrades in such cases?
That's an interesting point, which probably should be a new issue. Even after https://github.com/kudobuilder/kudo/pull/1780, an upgrade that changes both OVs and also the default in the parent will result in a similar failure if no value for this parameter is set manually. At this point, it is not clear to me what the desired behavior should be, because, from the point of view of the dependency, the update plan has to be triggered (the dependency should not care why its parameter changed, right?)
What happened: I developed a simple operator with a single dependency with the following structure:
Dependency operator exposes one single parameter, that could be updated via parent instance. Both operators have
deploy
,update
andupgrade
plans defined, making it possible to implement a custom operational behavior for each operation. The Initial deployment goes well:Then let's say I want to extend my dependency and add another parameter and make it configurable via parent operator: https://github.com/alembiewski/operator-with-dependencies/commit/faa903742eaf1a1c76875973f37b0abb62087768
When I'm trying to do an upgrade, the plan fails with the following error:
What you expected to happen: Since I'm not changing any parameter value, but only adding a new one, it's not clear why the
update
plan gets triggered for the dependency in this case. I would expect KUDO to only trigger anupgrade
plan. And how the upgrade is going to work in case when the value of the existing parameters actually changes between the versions? What is the recomended way to perform upgrades in such cases? How to reproduce it (as minimally and precisely as possible):0.0.1
version from https://github.com/alembiewski/operator-with-dependencies/commit/c84b6122d65ef28fca52c68f9b0da6223e9d5ce4Anything else we need to know?:
Environment:
kubectl version
):kubectl kudo version
):uname -a
):