From 558ed33b2211ea012841f6d676adbcfccf81f7b4 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Thu, 3 Oct 2024 02:49:52 -0700 Subject: [PATCH] Handle scnearios with multiple capi clusters Signed-off-by: Tamal Saha --- go.mod | 2 +- go.sum | 4 ++-- vendor/kmodules.xyz/client-go/cluster/lib.go | 5 +++-- vendor/modules.txt | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 9df5e6f3c..e83fcd475 100644 --- a/go.mod +++ b/go.mod @@ -45,7 +45,7 @@ require ( k8s.io/kube-state-metrics/v2 v2.12.0 kmodules.xyz/apiversion v0.2.0 kmodules.xyz/authorizer v0.29.1 - kmodules.xyz/client-go v0.30.18 + kmodules.xyz/client-go v0.30.19 kmodules.xyz/custom-resources v0.30.0 kmodules.xyz/go-containerregistry v0.0.12 kmodules.xyz/monitoring-agent-api v0.30.2-0.20241001043315-b98120efea48 diff --git a/go.sum b/go.sum index b7e2bbd83..d5ca21864 100644 --- a/go.sum +++ b/go.sum @@ -922,8 +922,8 @@ kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk= kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80= kmodules.xyz/authorizer v0.29.1 h1:uByGGoryKbZcfiEAhjcK/Y345I9mygNQP7DVpkMbNQQ= kmodules.xyz/authorizer v0.29.1/go.mod h1:kZRhclL8twzyt2bQuJQJbpYww2sc+qFr8I5PPoq/sWY= -kmodules.xyz/client-go v0.30.18 h1:Ik8tyJx8AUWcaJ4+7LsOI+zGbYNlN7MCtWHybOermiE= -kmodules.xyz/client-go v0.30.18/go.mod h1:CAu+JlA8RVGtj6LQHu0Q1w2mnFUajuti49c7T1AvGdM= +kmodules.xyz/client-go v0.30.19 h1:OStrnata4fT+itjPVQLf1SJ+VW5eBi7Mxvo+AXr6vNM= +kmodules.xyz/client-go v0.30.19/go.mod h1:CAu+JlA8RVGtj6LQHu0Q1w2mnFUajuti49c7T1AvGdM= kmodules.xyz/crd-schema-fuzz v0.29.1 h1:zJTlWYOrT5dsVVHW8HGcnR/vaWfxQfNh11QwTtkYpcs= kmodules.xyz/crd-schema-fuzz v0.29.1/go.mod h1:n708z9YQqLMP2KNLQVgBcRJw1QpSWLvpNCEi+KJDOYE= kmodules.xyz/custom-resources v0.30.0 h1:vR3CbseHMLwR4GvtcJJuRuwIV8voKqFqNii27rMcm1o= diff --git a/vendor/kmodules.xyz/client-go/cluster/lib.go b/vendor/kmodules.xyz/client-go/cluster/lib.go index 1069ab033..80db44a13 100644 --- a/vendor/kmodules.xyz/client-go/cluster/lib.go +++ b/vendor/kmodules.xyz/client-go/cluster/lib.go @@ -21,7 +21,6 @@ import ( "crypto/hmac" "crypto/sha256" "encoding/json" - "errors" "fmt" kmapi "kmodules.xyz/client-go/api/v1" @@ -34,6 +33,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" + "k8s.io/klog/v2" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -170,7 +170,8 @@ func DetectCAPICluster(kc client.Client) (*kmapi.CAPIClusterInfo, error) { } else if err != nil { return nil, err } else if len(list.Items) > 1 { - return nil, errors.New("multiple CAPI cluster object found") + klog.Warningln("multiple CAPI cluster object found") + return nil, nil } obj := list.Items[0].UnstructuredContent() diff --git a/vendor/modules.txt b/vendor/modules.txt index ac6dd7881..b1b1c8dda 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -2000,7 +2000,7 @@ kmodules.xyz/authorizer/apiserver kmodules.xyz/authorizer/rbac kmodules.xyz/authorizer/rbac/helpers kmodules.xyz/authorizer/rbac/validation -# kmodules.xyz/client-go v0.30.18 +# kmodules.xyz/client-go v0.30.19 ## explicit; go 1.22.0 kmodules.xyz/client-go kmodules.xyz/client-go/api/v1