-
Notifications
You must be signed in to change notification settings - Fork 163
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
Correct cluster drift using patches #822
Conversation
8cf7783
to
84a08e2
Compare
84a08e2
to
f6abde6
Compare
270619b
to
001b2d1
Compare
39ae10d
to
5055ebd
Compare
This changes the cluster drift correction behavior from performing a Helm upgrade to performing create and patch API requests based on the JSON Patch data. Doing this is much lighter than performing a full release cycle, and deals with the issue of Helm being unable to restore state of Custom Resources without the `--force` flag being set. Which has unwanted side-effects like forcing objects through a deletion/creation cycle. After a drift correction attempt a Kubernetes Event is emitted, which contains a summary of the created and patched resources, and a collection of any (potential) errors. As the goal is to restore state as best as we can, the drift correction will be re-attempted until all resources have been restored to the desired state. Signed-off-by: Hidde Beydals <[email protected]>
5055ebd
to
ccd8f88
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.
I've tested this with various custom resources changes and found no issues except for the meta.helm.sh/release
annotations missing from objects which have been deleted and restored.
Fixed in: 0131f22
d20e120
to
04cb4f8
Compare
This ensures that the metadata labels and annotations Helm adds during the creation of resources are included while diffing them. As they are not part of the manifest but should be restored in case they are e.g. removed or modified. Signed-off-by: Hidde Beydals <[email protected]>
04cb4f8
to
0131f22
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.
This changes the cluster drift correction behavior from performing a
Helm upgrade to performing create and patch API requests based on the
JSON Patch data.
Doing this is much lighter than performing a full release cycle, and
deals with the issue of Helm being unable to restore state of Custom
Resources without the
--force
flag being set. Which has unwantedside-effects like forcing objects through a deletion/creation cycle.
After a drift correction attempt a Kubernetes Event is emitted, which
contains a summary of the created and patched resources, and a
collection of any (potential) errors.
As the goal is to restore state as best as we can, the drift correction
will be re-attempted until all resources have been restored to the
desired state.
Fixes #805