Skip to content

Commit 569edbc

Browse files
author
Sylvain Rabot
committed
Set --field-manager when applying
Signed-off-by: Sylvain Rabot <[email protected]>
1 parent 6a55d5d commit 569edbc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

controllers/kustomization_controller.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -682,9 +682,11 @@ func (r *KustomizationReconciler) apply(kustomization kustomizev1.Kustomization,
682682
timeout := kustomization.GetTimeout() + (time.Second * 1)
683683
ctx, cancel := context.WithTimeout(context.Background(), timeout)
684684
defer cancel()
685+
source, err := r.getSource(ctx, kustomization)
686+
fieldManager := fmt.Sprintf("%s/%s", "kustomize-controller", source.GetArtifact().Revision[:8])
685687

686-
cmd := fmt.Sprintf("cd %s && kubectl apply -f %s.yaml --timeout=%s --cache-dir=/tmp",
687-
dirPath, kustomization.GetUID(), kustomization.Spec.Interval.Duration.String())
688+
cmd := fmt.Sprintf("cd %s && kubectl apply --field-manager=%s -f %s.yaml --timeout=%s --cache-dir=/tmp",
689+
dirPath, fieldManager, kustomization.GetUID(), kustomization.Spec.Interval.Duration.String())
688690

689691
if kustomization.Spec.KubeConfig != nil {
690692
kubeConfig, err := r.writeKubeConfig(kustomization, dirPath)

0 commit comments

Comments
 (0)