Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions cmd/ctrlc/root/sync/kubernetes/vcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ package kubernetes
import (
"encoding/json"
"fmt"
"os"
"strconv"
"time"

"github.com/MakeNowJust/heredoc/v2"
"github.com/Masterminds/semver"
"github.com/ctrlplanedev/cli/internal/api"
"github.com/ctrlplanedev/cli/internal/kinds"
"github.com/sirupsen/logrus"

"github.com/loft-sh/log"
"github.com/loft-sh/vcluster/pkg/cli/find"
"github.com/loft-sh/vcluster/pkg/platform/kube"
"github.com/spf13/cobra"
"github.com/spf13/viper"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -136,9 +134,18 @@ func NewSyncVclusterCmd() *cobra.Command {
}
clusterResource := clusterResourceResponse.JSON200

logger := log.NewStdoutLogger(os.Stdout, os.Stdout, os.Stdout, logrus.InfoLevel)
config, context, err := getKubeConfig()
if err != nil {
return fmt.Errorf("failed to get kube config: %w", err)
}

clientset, err := kube.NewForConfig(config)
if err != nil {
return fmt.Errorf("failed to create kube client: %w", err)
}

namespace := metav1.NamespaceAll
vclusters, err := find.ListVClusters(cmd.Context(), "", "", namespace, logger)
vclusters, err := find.ListOSSVClusters(cmd.Context(), clientset, context, "", namespace)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ require (
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3
github.com/hashicorp/go-tfe v1.73.1
github.com/loft-sh/log v0.0.0-20240219160058-26d83ffb46ac
github.com/loft-sh/vcluster v0.25.0
github.com/mitchellh/go-homedir v1.1.0
github.com/moby/term v0.5.0
github.com/oapi-codegen/runtime v1.1.1
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.19.0
github.com/tailscale/tailscale-client-go/v2 v2.0.0-20241217012816-8143c7dc1766
Expand Down Expand Up @@ -137,6 +135,7 @@ require (
github.com/loft-sh/agentapi/v4 v4.0.0-alpha.6.0.20240614131646-3359da6a4818 // indirect
github.com/loft-sh/api/v4 v4.0.0-alpha.6.0.20240614134907-f9ecc1668e9e // indirect
github.com/loft-sh/apiserver v0.0.0-20240607231110-634aeeab2b36 // indirect
github.com/loft-sh/log v0.0.0-20240219160058-26d83ffb46ac // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
Expand Down Expand Up @@ -171,6 +170,7 @@ require (
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/samber/lo v1.38.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/speakeasy-api/openapi-overlay v0.9.0 // indirect
Expand Down