kustomize-controller
kustomize-controller copied to clipboard
Error when using buildMetadata managedByLabel setting
V1.1.1
When creating a namespace (although other assets may also fail) with managedByLabel is set on I get the following error on dry run
Namespace/sf-web-sandbox dry-run failed, reason: Invalid: Namespace "sf-web-sandbox" is invalid: metadata.labels: Invalid value: "kustomize-(devel)": a valid label must be an empty string or consist of alphanumeric characters
What seems to be happening is that when kustomize in the controller with this flagis being run the semver it is returning kustomize-(devel) rather than a version, which then makes the output yaml invalid
Link to managedByLabel code
https://github.com/kubernetes-sigs/kustomize/blob/master/api/krusty/kustomizer.go#L101
Link to Provenance code (used to get semver)
https://github.com/kubernetes-sigs/kustomize/blob/master/api/provenance/provenance.go#L18
Previously we were using v0.35.1 and did not encounter this error
You can't set managedBy, it's not kustomize who manages the resources but Flux kustomize-controller. We add labels to track ownership like so:
kustomize.toolkit.fluxcd.io/name: <name>kustomize.toolkit.fluxcd.io/name: <namespace>
Also Flux sets the field manager to kustomize-controller.