mirror of
https://github.com/fluxcd/flux2.git
synced 2026-04-16 08:45:43 +00:00
flux tree: Add namespaces to objects reconcile from HRs
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
parent
023a709b6a
commit
06b8ad2402
3 changed files with 75 additions and 3 deletions
|
|
@ -272,5 +272,17 @@ func getHelmReleaseInventory(ctx context.Context, objectKey client.ObjectKey, ku
|
|||
return nil, fmt.Errorf("failed to read the Helm storage object for HelmRelease '%s': %w", objectKey.String(), err)
|
||||
}
|
||||
|
||||
for _, obj := range objects {
|
||||
if obj.GetNamespace() == "" {
|
||||
if isNamespaced, _ := utils.IsAPINamespaced(obj, kubeClient.Scheme(), kubeClient.RESTMapper()); isNamespaced {
|
||||
if hr.Spec.TargetNamespace != "" {
|
||||
obj.SetNamespace(hr.Spec.TargetNamespace)
|
||||
} else {
|
||||
obj.SetNamespace(hr.GetNamespace())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return object.UnstructuredSetToObjMetadataSet(objects), nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue