Skip to content

Commit

Permalink
Handle scnearios with multiple capi clusters
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Oct 3, 2024
1 parent 804c79d commit 889f3d7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cluster/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"crypto/hmac"
"crypto/sha256"
"encoding/json"
"errors"
"fmt"

kmapi "kmodules.xyz/client-go/api/v1"
Expand All @@ -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"
)

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 889f3d7

Please sign in to comment.