Skip to content

Emit a warning event when a Kustomization overwrites an object owned by another Kustomization #1724

Description

@MaxRink

Problem

All Kustomizations apply objects with the same field manager (kustomize-controller). When two Kustomizations render the same object, SSA sees a single manager, so there is no conflict. Each reconcile silently replaces the labels and annotations of the other Kustomization. There is no event, no log line, no failed condition.

We hit this in production. A namespace was rendered by two Kustomizations. Only one of them rendered kustomize.toolkit.fluxcd.io/prune: disabled. The other one removed that annotation on every reconcile. When the second Kustomization later stopped rendering the namespace, its garbage collection deleted it, because the prune check runs against
the live object and the annotation was absent at that moment. Whether the namespace survived depended only on which Kustomization applied last. Reproduced on flux v2.9.3.

Feature request

The controller already stamps owner labels (kustomize.toolkit.fluxcd.io/name and /namespace) on every apply. Before applying, it could check if the live object carries the owner labels of a different Kustomization and emit a warning event, e.g.:

Namespace/t-caas-controllers is also managed by Kustomization flux-system/prerequisites, fields will be overwritten

This makes silent co-ownership visible before it causes data loss. No change to apply or prune behavior is needed.

Workaround

Render the shared object with kustomize.toolkit.fluxcd.io/ssa: IfNotPresent in all but one Kustomization.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/server-side-applySSA related issues and pull requestsarea/uxIn pursuit of a delightful user experience

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions