Skip to content

Commit cb60cbc

Browse files
Merge pull request #29 from ctrlplanedev/use-list-oss-vcluster
fix: use list oss vcluster from loft library
2 parents 001d37c + 0812692 commit cb60cbc

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

cmd/ctrlc/root/sync/kubernetes/vcluster.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@ package kubernetes
33
import (
44
"encoding/json"
55
"fmt"
6-
"os"
76
"strconv"
87
"time"
98

109
"github.com/MakeNowJust/heredoc/v2"
1110
"github.com/Masterminds/semver"
1211
"github.com/ctrlplanedev/cli/internal/api"
1312
"github.com/ctrlplanedev/cli/internal/kinds"
14-
"github.com/sirupsen/logrus"
1513

16-
"github.com/loft-sh/log"
1714
"github.com/loft-sh/vcluster/pkg/cli/find"
15+
"github.com/loft-sh/vcluster/pkg/platform/kube"
1816
"github.com/spf13/cobra"
1917
"github.com/spf13/viper"
2018
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -136,9 +134,18 @@ func NewSyncVclusterCmd() *cobra.Command {
136134
}
137135
clusterResource := clusterResourceResponse.JSON200
138136

139-
logger := log.NewStdoutLogger(os.Stdout, os.Stdout, os.Stdout, logrus.InfoLevel)
137+
config, context, err := getKubeConfig()
138+
if err != nil {
139+
return fmt.Errorf("failed to get kube config: %w", err)
140+
}
141+
142+
clientset, err := kube.NewForConfig(config)
143+
if err != nil {
144+
return fmt.Errorf("failed to create kube client: %w", err)
145+
}
146+
140147
namespace := metav1.NamespaceAll
141-
vclusters, err := find.ListVClusters(cmd.Context(), "", "", namespace, logger)
148+
vclusters, err := find.ListOSSVClusters(cmd.Context(), clientset, context, "", namespace)
142149
if err != nil {
143150
return err
144151
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ require (
2626
github.com/google/uuid v1.6.0
2727
github.com/gorilla/websocket v1.5.3
2828
github.com/hashicorp/go-tfe v1.73.1
29-
github.com/loft-sh/log v0.0.0-20240219160058-26d83ffb46ac
3029
github.com/loft-sh/vcluster v0.25.0
3130
github.com/mitchellh/go-homedir v1.1.0
3231
github.com/moby/term v0.5.0
3332
github.com/oapi-codegen/runtime v1.1.1
34-
github.com/sirupsen/logrus v1.9.3
3533
github.com/spf13/cobra v1.8.1
3634
github.com/spf13/viper v1.19.0
3735
github.com/tailscale/tailscale-client-go/v2 v2.0.0-20241217012816-8143c7dc1766
@@ -137,6 +135,7 @@ require (
137135
github.com/loft-sh/agentapi/v4 v4.0.0-alpha.6.0.20240614131646-3359da6a4818 // indirect
138136
github.com/loft-sh/api/v4 v4.0.0-alpha.6.0.20240614134907-f9ecc1668e9e // indirect
139137
github.com/loft-sh/apiserver v0.0.0-20240607231110-634aeeab2b36 // indirect
138+
github.com/loft-sh/log v0.0.0-20240219160058-26d83ffb46ac // indirect
140139
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
141140
github.com/magiconair/properties v1.8.7 // indirect
142141
github.com/mailru/easyjson v0.7.7 // indirect
@@ -171,6 +170,7 @@ require (
171170
github.com/sagikazarmark/locafero v0.4.0 // indirect
172171
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
173172
github.com/samber/lo v1.38.1 // indirect
173+
github.com/sirupsen/logrus v1.9.3 // indirect
174174
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
175175
github.com/sourcegraph/conc v0.3.0 // indirect
176176
github.com/speakeasy-api/openapi-overlay v0.9.0 // indirect

0 commit comments

Comments
 (0)