Skip to content

Update managed resources when GitLab CR Spec changes

Hossein Pursultani requested to merge 97-update-with-cr-changes into master

This MR introduces createOrPatch method which replaces createIfNotExists. If the resource does not exist it creates a new one. When the resource exists, similar to kubectl edit, it fetches the resource, applies the changes in-place, and patches it. For patching this method excludes status and most of metadata attributes of resources (except labels and annotations) and uses merge patch (as opposed to strategic patch).

In its current form, this method can not delete the resources that are removed from spec (defined by GitLab CR values). It keeps the resource in sync with the spec. Since it is using merge patch, any manual change to the resource will be overwritten.

This method is generic enough that obsoletes internal.IsDeploymentChanged and replacing Deployments instead of patching.

Closes #97 (closed)

Edited by Hossein Pursultani

Merge request reports

Loading