-
Notifications
You must be signed in to change notification settings - Fork 280
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
Don't rewrite manifests when values don't change #2457
Don't rewrite manifests when values don't change #2457
Conversation
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
eeedd2c
to
d7e319f
Compare
chart.Spec.Set[k] = intstr.FromString(v) | ||
val := intstr.FromString(v) | ||
if cur, ok := chart.Spec.Set[k]; ok { | ||
curBytes, _ := cur.MarshalJSON() |
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.
why do we ignore the error check here?
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.
The new value is guaranteed to be valid since we just generated it, and if the current value is invalid and returns an error we'll handle comparing the empty byte slice to the new value properly anyway despite the error.
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.
makes sense
Proposed Changes
Don't rewrite manifests when values don't change.
RKE2 injects cluster configuration into HelmChart manifests on startup, including into user-provided HelmCharts, by rewriting the files on disk. These manifests were rewritten on startup every time, even if cluster configuration values did not change. This rewrite causes the Deploy controller to re-apply the manifest, and in turn the Helm controller to trigger a helm upgrade of the affected chart - even if there was not in fact any change to apply.
These no-op helm upgrades could cause issues if they triggered hooks in the Helm chart, or resulted in the Helm release getting stuck pending due to simultaneous upgrades to cluster infrastructure triggered by the restart.
Types of Changes
bugfix
Verification
Linked Issues
Further Comments
Note that manifests for packaged components will still get rewritten every time, as they are copied out of the runtime image every startup.