Skip to content

Commit

Permalink
Initialize destination namespace labels
Browse files Browse the repository at this point in the history
This fixes the `Label destionation namespace - same as CTI` test and
a possible bug scenario.

Signed-off-by: Alex Misstear <[email protected]>
  • Loading branch information
amisstea committed Apr 23, 2024
1 parent f6c939d commit 8b6fd6a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/v1alpha1/clustertemplateinstance_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ func (i *ClusterTemplateInstance) labelDestionationNamespace(ctx context.Context
}

if l, lOk := ns.Labels["argocd.argoproj.io/managed-by"]; !lOk || l != argoCDNamespace {
if ns.Labels == nil {
ns.Labels = map[string]string{}
}
ns.Labels["argocd.argoproj.io/managed-by"] = argoCDNamespace
if err := k8sClient.Update(ctx, ns); err != nil {
return err
Expand Down

0 comments on commit 8b6fd6a

Please sign in to comment.