From f03c24565fff2b64154f637053f7ad954b52b4c6 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Tue, 9 Nov 2021 18:41:06 +0200 Subject: [PATCH] Skip remote clusters in flux tree cmd Signed-off-by: Stefan Prodan --- cmd/flux/tree_kustomization.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/flux/tree_kustomization.go b/cmd/flux/tree_kustomization.go index c0cd03e5..6557bb44 100644 --- a/cmd/flux/tree_kustomization.go +++ b/cmd/flux/tree_kustomization.go @@ -169,7 +169,9 @@ func treeKustomization(ctx context.Context, tree tree.ObjMetadataTree, item *kus } if objMetadata.GroupKind.Group == kustomizev1.GroupVersion.Group && - objMetadata.GroupKind.Kind == kustomizev1.KustomizationKind { + objMetadata.GroupKind.Kind == kustomizev1.KustomizationKind && + // skip kustomization if it targets a remote clusters + item.Spec.KubeConfig == nil { k := &kustomizev1.Kustomization{} err = kubeClient.Get(ctx, client.ObjectKey{ Namespace: objMetadata.Namespace, @@ -199,6 +201,11 @@ func getHelmReleaseInventory(ctx context.Context, objectKey client.ObjectKey, ku return nil, err } + // skip release if it targets a remote clusters + if hr.Spec.KubeConfig != nil { + return nil, nil + } + storageNamespace := hr.GetNamespace() if hr.Spec.StorageNamespace != "" { storageNamespace = hr.Spec.StorageNamespace