cisco-open/operator-tools

Recreating resources when an update conflicts should only apply to workloads

pepov opened this issue · 0 comments

pepov commented

Describe the bug
Right now if EnableRecreateWorkloadOnImmutableFieldChange does not check if the resource is a workload and does not check if the error relates to a different problem that cannot be fixed by recreating it (e.g. name collision for a service port). It only checks that the HTTP status code is 422.

Steps to reproduce the issue:
Use the GenericReconciler to create and update a service object and change one of the port names so that it conflicts with an existing one.

controller> Reconciler error failed to reconcile resource: Object has to be recreated, but refusing to remove without explicitly being told so. Use thanos.spec.enableRecreateWorkloadOnImmutableFieldChange to move on but make sure to understand the consequences. As of rule, to avoid data loss, make sure to use a persistent volume for buffers, which is the default, unless explicitly disabled or configured differently.: Service "query-query" is invalid: spec.ports[2].name: Duplicate value: "http" name: query, namespace: default

Expected behavior
The flag EnableRecreateWorkloadOnImmutableFieldChange should only apply to DaemonSet, Deployment and StatefulSet resources and should check (if possible) that the issue is field immutability not something else.