From dead0074661cb31c29f4df75b58ad4affa92fd29 Mon Sep 17 00:00:00 2001 From: Fabian Kramm Date: Tue, 30 Apr 2024 10:45:48 +0200 Subject: [PATCH] feat: add vcluster activate & apply platform secret --- .github/workflows/unit-tests.yaml | 2 +- cmd/vcluster/cmd/start.go | 12 - cmd/vclusterctl/cmd/activate.go | 8 - cmd/vclusterctl/cmd/create.go | 1 + cmd/vclusterctl/cmd/login.go | 7 - cmd/vclusterctl/cmd/logout.go | 7 - cmd/vclusterctl/cmd/platform/import.go | 9 +- cmd/vclusterctl/cmd/platform/start.go | 7 - cmd/vclusterctl/cmd/ui.go | 7 - config/config.go | 5 - go.mod | 6 +- go.sum | 12 +- pkg/cli/activate_helm.go | 50 ++- pkg/cli/create_helm.go | 27 +- pkg/cli/find/find.go | 2 +- pkg/cli/list_helm.go | 2 +- pkg/cli/list_platform.go | 2 +- pkg/cli/pause_helm.go | 4 +- pkg/lifecycle/lifecycle.go | 8 +- pkg/platform/client.go | 7 +- pkg/platform/secret.go | 125 +++++++ .../install/zz_generated.api.register.go | 6 +- .../management/v1/policyviolation_types.go | 43 --- .../v1/virtualcluster_convertconfig_types.go | 41 +++ .../v1/virtualclusterinstance_types.go | 5 + .../v1/zz_generated.api.register.go | 22 +- .../management/v1/zz_generated.conversion.go | 278 ++++++++------- .../management/v1/zz_generated.deepcopy.go | 192 +++++----- .../management/zz_generated.api.register.go | 337 +++++++++--------- .../apis/management/zz_generated.deepcopy.go | 192 +++++----- .../v3/pkg/apis/storage/v1/accesskey_types.go | 53 ++- .../v1/devpodworkspacetemplate_types.go | 12 +- .../v3/pkg/apis/storage/v1/project_types.go | 5 + .../v1/virtualclusterinstance_types.go | 26 +- .../apis/storage/v1/zz_generated.deepcopy.go | 33 +- .../v1/convertvirtualclusterconfig.go | 168 +++++++++ .../management/v1/generated_expansion.go | 4 +- .../typed/management/v1/management_client.go | 10 +- .../typed/management/v1/policyviolation.go | 168 --------- .../v3/cmd/loftctl/cmd/devpod/rebuild.go | 1 - .../loft-sh/loftctl/v3/pkg/client/config.go | 4 + vendor/modules.txt | 10 +- 42 files changed, 1064 insertions(+), 856 deletions(-) create mode 100644 pkg/platform/secret.go delete mode 100644 vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/policyviolation_types.go create mode 100644 vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/virtualcluster_convertconfig_types.go create mode 100644 vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/convertvirtualclusterconfig.go delete mode 100644 vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/policyviolation.go diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index a9d04c0e65..f166198ba5 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@v4 - name: Install Helm Unit Test Plugin run: | - helm plugin install https://github.com/helm-unittest/helm-unittest + helm plugin install https://github.com/helm-unittest/helm-unittest --version v0.4.4 - name: Run Helm Unit Tests run: | helm unittest chart diff --git a/cmd/vcluster/cmd/start.go b/cmd/vcluster/cmd/start.go index c32cbc2d88..5d7a3feead 100644 --- a/cmd/vcluster/cmd/start.go +++ b/cmd/vcluster/cmd/start.go @@ -6,8 +6,6 @@ import ( "os" "runtime/debug" - "github.com/go-logr/logr" - vconfig "github.com/loft-sh/vcluster/config" "github.com/loft-sh/vcluster/pkg/config" "github.com/loft-sh/vcluster/pkg/leaderelection" "github.com/loft-sh/vcluster/pkg/plugin" @@ -53,16 +51,6 @@ func ExecuteStart(ctx context.Context, options *StartOptions) error { return err } - if vconfig.ShouldCheckForProFeatures() && vConfig.IsProFeatureEnabled() { - log, err := logr.FromContext(ctx) - if err != nil { - return err - } - - log.Info("In order to use a Pro feature, please contact us at https://www.vcluster.com/pro-demo or downgrade by running `vcluster upgrade --version v0.19.5`") - os.Exit(1) - } - // get current namespace vConfig.ControlPlaneConfig, vConfig.ControlPlaneNamespace, vConfig.ControlPlaneService, vConfig.WorkloadConfig, vConfig.WorkloadNamespace, vConfig.WorkloadService, err = pro.GetRemoteClient(vConfig) if err != nil { diff --git a/cmd/vclusterctl/cmd/activate.go b/cmd/vclusterctl/cmd/activate.go index e7d9110609..cd7feb3fb4 100644 --- a/cmd/vclusterctl/cmd/activate.go +++ b/cmd/vclusterctl/cmd/activate.go @@ -1,12 +1,9 @@ package cmd import ( - "os" - loftctlUtil "github.com/loft-sh/loftctl/v3/pkg/util" "github.com/loft-sh/log" platformcmd "github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/platform" - "github.com/loft-sh/vcluster/config" "github.com/loft-sh/vcluster/pkg/cli/flags" "github.com/spf13/cobra" ) @@ -35,11 +32,6 @@ vcluster activate my-vcluster --cluster connected-cluster \ Long: description, Args: loftctlUtil.VClusterNameOnlyValidator, RunE: func(cobraCmd *cobra.Command, args []string) error { - if config.ShouldCheckForProFeatures() { - cmd.Log.Warnf("In order to use a Pro feature, please contact us at https://www.vcluster.com/pro-demo or downgrade by running `vcluster upgrade --version v0.19.5`") - os.Exit(1) - } - return cmd.Run(cobraCmd.Context(), args) }, } diff --git a/cmd/vclusterctl/cmd/create.go b/cmd/vclusterctl/cmd/create.go index 0e47242357..82e41965c3 100644 --- a/cmd/vclusterctl/cmd/create.go +++ b/cmd/vclusterctl/cmd/create.go @@ -70,6 +70,7 @@ vcluster create test --namespace test cobraCmd.Flags().BoolVar(&cmd.Upgrade, "upgrade", false, "If true will try to upgrade the vcluster instead of failing if it already exists") // Platform flags + cobraCmd.Flags().BoolVar(&cmd.Activate, "activate", true, "[PLATFORM] Activate the vCluster automatically when using helm manager") cobraCmd.Flags().StringVar(&cmd.Project, "project", "", "[PLATFORM] The vCluster platform project to use") cobraCmd.Flags().StringSliceVarP(&cmd.Labels, "labels", "l", []string{}, "[PLATFORM] Comma separated labels to apply to the virtualclusterinstance") cobraCmd.Flags().StringSliceVar(&cmd.Annotations, "annotations", []string{}, "[PLATFORM] Comma separated annotations to apply to the virtualclusterinstance") diff --git a/cmd/vclusterctl/cmd/login.go b/cmd/vclusterctl/cmd/login.go index 8680c77f36..126e6b2eae 100644 --- a/cmd/vclusterctl/cmd/login.go +++ b/cmd/vclusterctl/cmd/login.go @@ -2,13 +2,11 @@ package cmd import ( "fmt" - "os" "github.com/loft-sh/api/v3/pkg/product" loftctl "github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd" "github.com/loft-sh/log" "github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/use" - "github.com/loft-sh/vcluster/config" "github.com/loft-sh/vcluster/pkg/cli/flags" "github.com/loft-sh/vcluster/pkg/platform" "github.com/spf13/cobra" @@ -46,11 +44,6 @@ vcluster login https://my-vcluster-platform.com --access-key myaccesskey Long: description, Args: cobra.MaximumNArgs(1), RunE: func(cobraCmd *cobra.Command, args []string) error { - if config.ShouldCheckForProFeatures() { - log.GetInstance().Warnf("In order to use a Platform feature, please contact us at https://www.vcluster.com/pro-demo or downgrade by running `vcluster upgrade --version v0.19.5`") - os.Exit(1) - } - loginCmd := &loftctl.LoginCmd{ GlobalFlags: loftGlobalFlags, diff --git a/cmd/vclusterctl/cmd/logout.go b/cmd/vclusterctl/cmd/logout.go index 337ed87999..f6454d8936 100644 --- a/cmd/vclusterctl/cmd/logout.go +++ b/cmd/vclusterctl/cmd/logout.go @@ -2,12 +2,10 @@ package cmd import ( "fmt" - "os" loftctl "github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd" "github.com/loft-sh/log" "github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/use" - "github.com/loft-sh/vcluster/config" "github.com/loft-sh/vcluster/pkg/cli/flags" "github.com/loft-sh/vcluster/pkg/platform" "github.com/spf13/cobra" @@ -40,11 +38,6 @@ vcluster logout Long: description, Args: cobra.NoArgs, RunE: func(cobraCmd *cobra.Command, args []string) error { - if config.ShouldCheckForProFeatures() { - cmd.Log.Warnf("In order to use a Pro feature, please contact us at https://www.vcluster.com/pro-demo or downgrade by running `vcluster upgrade --version v0.19.5`") - os.Exit(1) - } - _, err := platform.CreatePlatformClient() if err != nil { return err diff --git a/cmd/vclusterctl/cmd/platform/import.go b/cmd/vclusterctl/cmd/platform/import.go index 10a53ff6da..aff014075b 100644 --- a/cmd/vclusterctl/cmd/platform/import.go +++ b/cmd/vclusterctl/cmd/platform/import.go @@ -2,11 +2,9 @@ package platform import ( "context" - "os" loftctlUtil "github.com/loft-sh/loftctl/v3/pkg/util" "github.com/loft-sh/log" - "github.com/loft-sh/vcluster/config" "github.com/loft-sh/vcluster/pkg/cli" "github.com/loft-sh/vcluster/pkg/cli/flags" "github.com/loft-sh/vcluster/pkg/platform" @@ -43,11 +41,6 @@ vcluster platform import my-vcluster --cluster connected-cluster \ Long: description, Args: loftctlUtil.VClusterNameOnlyValidator, RunE: func(cobraCmd *cobra.Command, args []string) error { - if config.ShouldCheckForProFeatures() { - cmd.Log.Warnf("In order to use a Pro feature, please contact us at https://www.vcluster.com/pro-demo or downgrade by running `vcluster upgrade --version v0.19.5`") - os.Exit(1) - } - return cmd.Run(cobraCmd.Context(), args) }, } @@ -73,5 +66,5 @@ func (cmd *ImportCmd) Run(ctx context.Context, args []string) error { return cli.ActivatePlatform(ctx, &cmd.ActivateOptions, cmd.GlobalFlags, args[0], cmd.Log) } - return cli.ActivateHelm() + return cli.ActivateHelm(ctx, &cmd.ActivateOptions, cmd.GlobalFlags, args[0], cmd.Log) } diff --git a/cmd/vclusterctl/cmd/platform/start.go b/cmd/vclusterctl/cmd/platform/start.go index 5064aee9b6..05ee22db2c 100644 --- a/cmd/vclusterctl/cmd/platform/start.go +++ b/cmd/vclusterctl/cmd/platform/start.go @@ -3,14 +3,12 @@ package platform import ( "context" "fmt" - "os" loftctlflags "github.com/loft-sh/loftctl/v3/cmd/loftctl/flags" "github.com/loft-sh/loftctl/v3/pkg/start" "github.com/loft-sh/log" "github.com/loft-sh/log/survey" "github.com/loft-sh/log/terminal" - "github.com/loft-sh/vcluster/config" "github.com/loft-sh/vcluster/pkg/cli/find" "github.com/loft-sh/vcluster/pkg/platform" "github.com/spf13/cobra" @@ -77,11 +75,6 @@ before running this command: } func (cmd *StartCmd) Run(ctx context.Context) error { - if config.ShouldCheckForProFeatures() { - cmd.Log.Warnf("In order to use a Pro feature, please contact us at https://www.vcluster.com/pro-demo or downgrade by running `vcluster upgrade --version v0.19.5`") - os.Exit(1) - } - // get version to deploy if cmd.Version == "latest" || cmd.Version == "" { cmd.Version = platform.MinimumVersionTag diff --git a/cmd/vclusterctl/cmd/ui.go b/cmd/vclusterctl/cmd/ui.go index e24479727b..dfd2b93be1 100644 --- a/cmd/vclusterctl/cmd/ui.go +++ b/cmd/vclusterctl/cmd/ui.go @@ -3,11 +3,9 @@ package cmd import ( "errors" "fmt" - "os" loftctl "github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd" "github.com/loft-sh/log" - "github.com/loft-sh/vcluster/config" "github.com/loft-sh/vcluster/pkg/cli/flags" "github.com/loft-sh/vcluster/pkg/platform" "github.com/spf13/cobra" @@ -40,11 +38,6 @@ vcluster ui Long: description, Args: cobra.NoArgs, RunE: func(cobraCmd *cobra.Command, args []string) error { - if config.ShouldCheckForProFeatures() { - cmd.Log.Warnf("In order to use a Pro feature, please contact us at https://www.vcluster.com/pro-demo or downgrade by running `vcluster upgrade --version v0.19.5`") - os.Exit(1) - } - err := cmd.Run(cobraCmd.Context(), args) if err != nil { if errors.Is(err, loftctl.ErrNoUrl) { diff --git a/config/config.go b/config/config.go index af060e89f2..ef3e33c2fc 100644 --- a/config/config.go +++ b/config/config.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "io" - "os" "reflect" "regexp" "strings" @@ -133,10 +132,6 @@ func (c *Config) Distro() string { return K8SDistro } -func ShouldCheckForProFeatures() bool { - return os.Getenv("FORCE_VCLUSTER_PRO") != "true" -} - func (c *Config) IsProFeatureEnabled() bool { if len(c.Networking.ResolveDNS) > 0 { return true diff --git a/go.mod b/go.mod index 607d103b56..21fbcd9b86 100644 --- a/go.mod +++ b/go.mod @@ -17,10 +17,10 @@ require ( github.com/invopop/jsonschema v0.12.0 github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0 github.com/loft-sh/admin-apis v0.0.0-20240203010124-3600c1c582a8 - github.com/loft-sh/agentapi/v3 v3.4.5 + github.com/loft-sh/agentapi/v3 v3.4.6-beta.0 github.com/loft-sh/analytics-client v0.0.0-20240219162240-2f4c64b2494e - github.com/loft-sh/api/v3 v3.4.5 - github.com/loft-sh/loftctl/v3 v3.5.0-alpha.0.0.20240425091019-24b84e25c22a + github.com/loft-sh/api/v3 v3.5.0-alpha.1.0.20240426152201-dfdce426ab92 + github.com/loft-sh/loftctl/v3 v3.5.0-alpha.1.0.20240430082516-88fe061dbac1 github.com/loft-sh/utils v0.0.29 github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d github.com/mitchellh/go-homedir v1.1.0 diff --git a/go.sum b/go.sum index c2bf3384dd..9b4afb46da 100644 --- a/go.sum +++ b/go.sum @@ -634,18 +634,18 @@ github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhn github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= github.com/loft-sh/admin-apis v0.0.0-20240203010124-3600c1c582a8 h1:nuY9Vgvabh2FlaTYp9yhzh3cBzY6jjFEFSsOvw9ZAJw= github.com/loft-sh/admin-apis v0.0.0-20240203010124-3600c1c582a8/go.mod h1:MWczNwKvWssHo1KaeZKaWDdRLYSNbWqQBGsTLoCNd7U= -github.com/loft-sh/agentapi/v3 v3.4.5 h1:1IUMGU//43w+6xMYcUQZzWbeAwQTq55E9kdorrjrDzA= -github.com/loft-sh/agentapi/v3 v3.4.5/go.mod h1:H6z6N4cxhi6axLQGTIfBbWiFYaWHJIiPBAPywP7LiJ8= +github.com/loft-sh/agentapi/v3 v3.4.6-beta.0 h1:tZeKjzlVjc8KL5rVQyYQQVsX7P4lfwO1GZSNKBdKtrY= +github.com/loft-sh/agentapi/v3 v3.4.6-beta.0/go.mod h1:9lZuxYBmu4gE9Pkeh5+XObMvRpClOTAAdyPeuY5cAiY= github.com/loft-sh/analytics-client v0.0.0-20240219162240-2f4c64b2494e h1:JcPnMaoczikvpasi8OJ47dCkWZjfgFubWa4V2SZo7h0= github.com/loft-sh/analytics-client v0.0.0-20240219162240-2f4c64b2494e/go.mod h1:FFWcGASyM2QlWTDTCG/WBVM/XYr8btqYt335TFNRCFg= -github.com/loft-sh/api/v3 v3.4.5 h1:PAB5Vv4J54jbfwjd5qKO6day1dCaHhRe6n/Gq1zcFsE= -github.com/loft-sh/api/v3 v3.4.5/go.mod h1:GYvob5nqzrApImDtxmPUzF1z21kwE2rtqsm6pu9EqIQ= +github.com/loft-sh/api/v3 v3.5.0-alpha.1.0.20240426152201-dfdce426ab92 h1:Ae2S28oZK48bWYDMv13qN+kmwwIcMa4O17eu/SYnIK4= +github.com/loft-sh/api/v3 v3.5.0-alpha.1.0.20240426152201-dfdce426ab92/go.mod h1:thDZXZ/bR/aDAGLrJvGnohMw1tU/y+OUvr4wSDJrJiQ= github.com/loft-sh/apiserver v0.0.0-20240129130254-7b9a55ab1744 h1:1Yhs86ugpnEsex4kkFpyvCHNy42O5vtJjY7Loty9JkI= github.com/loft-sh/apiserver v0.0.0-20240129130254-7b9a55ab1744/go.mod h1:/QBF5drEoeQ0pggzT6q29+cyirRg5/MOJCq39ghku+8= github.com/loft-sh/jspolicy v0.2.2 h1:+7QqVumYm225mSJsGOjnbCGYzh9XyKYQab6FgLiHYJU= github.com/loft-sh/jspolicy v0.2.2/go.mod h1:kbXD1CS17Ie9dqcq5iXrOhpSLESkmQpy4+F80YXOfUM= -github.com/loft-sh/loftctl/v3 v3.5.0-alpha.0.0.20240425091019-24b84e25c22a h1:7JtQrD39yYkFvGJ8s9tu+y+qDjxyEM9RIFuLpZmYmmE= -github.com/loft-sh/loftctl/v3 v3.5.0-alpha.0.0.20240425091019-24b84e25c22a/go.mod h1:IUXEhtAFeJj2GED0yyePY3ybpjOs8ZJ4pvkPIJ2/g7U= +github.com/loft-sh/loftctl/v3 v3.5.0-alpha.1.0.20240430082516-88fe061dbac1 h1:ecEb6OmBBs1eF6zxSIH1k+rEaWkqCjuApgbUCkAs220= +github.com/loft-sh/loftctl/v3 v3.5.0-alpha.1.0.20240430082516-88fe061dbac1/go.mod h1:IUXEhtAFeJj2GED0yyePY3ybpjOs8ZJ4pvkPIJ2/g7U= github.com/loft-sh/log v0.0.0-20240219160058-26d83ffb46ac h1:Gz/7Lb7WgdgIv+KJz87ORA1zvQW52tUqKPGyunlp4dQ= github.com/loft-sh/log v0.0.0-20240219160058-26d83ffb46ac/go.mod h1:YImeRjXH34Yf5E79T7UHBQpDZl9fIaaFRgyZ/bkY+UQ= github.com/loft-sh/utils v0.0.29 h1:P/MObccXToAZy2QoJSQDJ+OJx1qHitpFHEVj3QBSNJs= diff --git a/pkg/cli/activate_helm.go b/pkg/cli/activate_helm.go index 503d8f806f..7838b94f20 100644 --- a/pkg/cli/activate_helm.go +++ b/pkg/cli/activate_helm.go @@ -1,6 +1,16 @@ package cli -import "fmt" +import ( + "context" + "fmt" + + "github.com/loft-sh/log" + "github.com/loft-sh/vcluster/pkg/cli/find" + "github.com/loft-sh/vcluster/pkg/cli/flags" + "github.com/loft-sh/vcluster/pkg/lifecycle" + "github.com/loft-sh/vcluster/pkg/platform" + "k8s.io/client-go/kubernetes" +) type ActivateOptions struct { Manager string @@ -10,6 +20,40 @@ type ActivateOptions struct { ImportName string } -func ActivateHelm() error { - return fmt.Errorf("this function is currently not implemented") +func ActivateHelm(ctx context.Context, options *ActivateOptions, globalFlags *flags.GlobalFlags, vClusterName string, log log.Logger) error { + platformClient, err := platform.CreatePlatformClient() + if err != nil { + return err + } + + // check if vCluster exists + vCluster, err := find.GetVCluster(ctx, globalFlags.Context, vClusterName, globalFlags.Namespace, log) + if err != nil { + return err + } + + // create kube client + restConfig, err := vCluster.ClientFactory.ClientConfig() + if err != nil { + return err + } + kubeClient, err := kubernetes.NewForConfig(restConfig) + if err != nil { + return err + } + + // apply platform secret + err = platformClient.ApplyPlatformSecret(ctx, kubeClient, vCluster.Name, vCluster.Namespace, options.Project) + if err != nil { + return err + } + + // restart vCluster + err = lifecycle.DeletePods(ctx, kubeClient, "app=vcluster,release="+vCluster.Name, vCluster.Namespace, log) + if err != nil { + return fmt.Errorf("delete vcluster workloads: %w", err) + } + + log.Donef("Successfully activated vCluster %s/%s", vCluster.Namespace, vCluster.Name) + return nil } diff --git a/pkg/cli/create_helm.go b/pkg/cli/create_helm.go index f04f41e4d3..365ebab9d4 100644 --- a/pkg/cli/create_helm.go +++ b/pkg/cli/create_helm.go @@ -24,6 +24,7 @@ import ( "github.com/loft-sh/vcluster/pkg/constants" "github.com/loft-sh/vcluster/pkg/embed" "github.com/loft-sh/vcluster/pkg/helm" + "github.com/loft-sh/vcluster/pkg/platform" "github.com/loft-sh/vcluster/pkg/telemetry" "github.com/loft-sh/vcluster/pkg/upgrade" "github.com/loft-sh/vcluster/pkg/util" @@ -65,6 +66,7 @@ type CreateOptions struct { Upgrade bool // Platform + Activate bool Project string Cluster string Template string @@ -159,6 +161,7 @@ func CreateHelm(ctx context.Context, options *CreateOptions, globalFlags *flags. } // TODO end + // build extra values var newExtraValues []string for _, value := range cmd.Values { decodedString, err := getBase64DecodedString(value) @@ -192,13 +195,17 @@ func CreateHelm(ctx context.Context, options *CreateOptions, globalFlags *flags. } // Check if the passed in values adhere to our config format. + hasPlatformConfiguration := false for _, p := range newExtraValues { f, err := os.Open(p) if err != nil { return err } - defer f.Close() + defer func() { + _ = f.Close() + }() + // parse config cfg := &config.Config{} err = cfg.DecodeYAML(f) if err != nil { @@ -208,9 +215,8 @@ func CreateHelm(ctx context.Context, options *CreateOptions, globalFlags *flags. return err } - if config.ShouldCheckForProFeatures() && cfg.IsProFeatureEnabled() { - cmd.log.Warnf("In order to use a Pro feature, please contact us at https://www.vcluster.com/pro-demo or downgrade by running `vcluster upgrade --version v0.19.5`") - os.Exit(1) + if cfg.Platform.API.AccessKey != "" || cfg.Platform.API.SecretRef.Name != "" { + hasPlatformConfiguration = true } // TODO(johannesfrey): We would also need to validate here if the user is about to perform changes which would lead to distro/store changes @@ -259,6 +265,19 @@ func CreateHelm(ctx context.Context, options *CreateOptions, globalFlags *flags. } } + // create platform secret + if !hasPlatformConfiguration && cmd.Activate { + platformClient, err := platform.CreatePlatformClient() + if err == nil { + err = platformClient.ApplyPlatformSecret(ctx, cmd.kubeClient, "vcluster-platform-api-key", cmd.Namespace, cmd.Project) + if err != nil { + return fmt.Errorf("apply platform secret: %w", err) + } + } else { + log.Debugf("Error creating platform client: %v", err) + } + } + // we have to upgrade / install the chart err = cmd.deployChart(ctx, vClusterName, chartValues, helmBinaryPath) if err != nil { diff --git a/pkg/cli/find/find.go b/pkg/cli/find/find.go index 862e27036b..e5586a69c7 100644 --- a/pkg/cli/find/find.go +++ b/pkg/cli/find/find.go @@ -67,7 +67,7 @@ func CurrentContext() (string, *clientcmdapi.Config, error) { } func GetPlatformVCluster(ctx context.Context, platformClient platform.Client, name, project string, log log.Logger) (*platform.VirtualClusterInstanceProject, error) { - platformVClusters, err := platform.ListVClusters(ctx, platformClient, name, project) + platformVClusters, err := platformClient.ListVClusters(ctx, name, project) if err != nil { log.Warnf("Error retrieving platform vclusters: %v", err) } diff --git a/pkg/cli/list_helm.go b/pkg/cli/list_helm.go index 355db92c8c..975d29b510 100644 --- a/pkg/cli/list_helm.go +++ b/pkg/cli/list_helm.go @@ -83,7 +83,7 @@ func printVClusters(ctx context.Context, options *ListOptions, output []ListVClu ctx, cancel := context.WithTimeout(ctx, 2*time.Second) defer cancel() - proVClusters, _ := platform.ListVClusters(ctx, platformClient, "", "") + proVClusters, _ := platformClient.ListVClusters(ctx, "", "") if len(proVClusters) > 0 { logger.Infof("You also have %d virtual clusters in your platform manager context.", len(proVClusters)) logger.Info("If you want to see them, run: 'vcluster list --manager platform' or 'vcluster use manager platform' to change the default") diff --git a/pkg/cli/list_platform.go b/pkg/cli/list_platform.go index 68f9492bdf..e266e252fd 100644 --- a/pkg/cli/list_platform.go +++ b/pkg/cli/list_platform.go @@ -27,7 +27,7 @@ func ListPlatform(ctx context.Context, options *ListOptions, globalFlags *flags. return err } - proVClusters, err := platform.ListVClusters(ctx, platformClient, "", "") + proVClusters, err := platformClient.ListVClusters(ctx, "", "") if err != nil { return err } diff --git a/pkg/cli/pause_helm.go b/pkg/cli/pause_helm.go index b71bddfc3e..701e4b05d0 100644 --- a/pkg/cli/pause_helm.go +++ b/pkg/cli/pause_helm.go @@ -35,12 +35,12 @@ func PauseHelm(ctx context.Context, globalFlags *flags.GlobalFlags, vClusterName return err } - err = lifecycle.DeleteVClusterWorkloads(ctx, kubeClient, "vcluster.loft.sh/managed-by="+vClusterName, globalFlags.Namespace, log) + err = lifecycle.DeletePods(ctx, kubeClient, "vcluster.loft.sh/managed-by="+vClusterName, globalFlags.Namespace, log) if err != nil { return fmt.Errorf("delete vcluster workloads: %w", err) } - err = lifecycle.DeleteMultiNamespaceVclusterWorkloads(ctx, kubeClient, vClusterName, globalFlags.Namespace, log) + err = lifecycle.DeleteMultiNamespaceVClusterWorkloads(ctx, kubeClient, vClusterName, globalFlags.Namespace, log) if err != nil { return fmt.Errorf("delete vcluster multinamespace workloads: %w", err) } diff --git a/pkg/lifecycle/lifecycle.go b/pkg/lifecycle/lifecycle.go index 480cb8710c..bb9cc90ef2 100644 --- a/pkg/lifecycle/lifecycle.go +++ b/pkg/lifecycle/lifecycle.go @@ -54,15 +54,15 @@ func PauseVCluster(ctx context.Context, kubeClient *kubernetes.Clientset, name, return nil } -// DeleteVClusterWorkloads deletes all pods associated with a running vcluster -func DeleteVClusterWorkloads(ctx context.Context, kubeClient *kubernetes.Clientset, labelSelector, namespace string, log log.BaseLogger) error { +// DeletePods deletes all pods associated with a running vcluster +func DeletePods(ctx context.Context, kubeClient *kubernetes.Clientset, labelSelector, namespace string, log log.BaseLogger) error { list, err := kubeClient.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{LabelSelector: labelSelector}) if err != nil { return err } if len(list.Items) > 0 { - log.Infof("Delete %d vcluster workloads", len(list.Items)) + log.Infof("Delete %d vcluster pods", len(list.Items)) for _, item := range list.Items { err = kubeClient.CoreV1().Pods(namespace).Delete(ctx, item.Name, metav1.DeleteOptions{}) @@ -78,7 +78,7 @@ func DeleteVClusterWorkloads(ctx context.Context, kubeClient *kubernetes.Clients return nil } -func DeleteMultiNamespaceVclusterWorkloads(ctx context.Context, client *kubernetes.Clientset, vclusterName, vclusterNamespace string, _ log.BaseLogger) error { +func DeleteMultiNamespaceVClusterWorkloads(ctx context.Context, client *kubernetes.Clientset, vclusterName, vclusterNamespace string, _ log.BaseLogger) error { // get all host namespaces managed by this multinamespace mode enabled vcluster namespaces, err := client.CoreV1().Namespaces().List(ctx, metav1.ListOptions{ LabelSelector: labels.FormatLabels(map[string]string{ diff --git a/pkg/platform/client.go b/pkg/platform/client.go index d6e10bc0fa..8ac0e8c254 100644 --- a/pkg/platform/client.go +++ b/pkg/platform/client.go @@ -15,6 +15,7 @@ import ( "github.com/loft-sh/loftctl/v3/pkg/kube" kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" ) var Self *managementv1.Self @@ -25,6 +26,8 @@ type Client interface { loftclient.Client Self() *managementv1.Self + ApplyPlatformSecret(ctx context.Context, kubeClient kubernetes.Interface, name, namespace, project string) error + ListVClusters(ctx context.Context, virtualClusterName, projectName string) ([]VirtualClusterInstanceProject, error) } type VirtualClusterInstanceProject struct { @@ -88,8 +91,8 @@ func (c *client) Self() *managementv1.Self { // ListVClusters lists all virtual clusters across all projects if virtualClusterName and projectName are empty. // The list can be narrowed down by the given virtual cluster name and project name. -func ListVClusters(ctx context.Context, baseClient Client, virtualClusterName, projectName string) ([]VirtualClusterInstanceProject, error) { - managementClient, err := baseClient.Management() +func (c *client) ListVClusters(ctx context.Context, virtualClusterName, projectName string) ([]VirtualClusterInstanceProject, error) { + managementClient, err := c.Management() if err != nil { return nil, err } diff --git a/pkg/platform/secret.go b/pkg/platform/secret.go new file mode 100644 index 0000000000..63bc5a19ac --- /dev/null +++ b/pkg/platform/secret.go @@ -0,0 +1,125 @@ +package platform + +import ( + "context" + "fmt" + "reflect" + "strconv" + "strings" + "time" + + managementv1 "github.com/loft-sh/api/v3/pkg/apis/management/v1" + storagev1 "github.com/loft-sh/api/v3/pkg/apis/storage/v1" + corev1 "k8s.io/api/core/v1" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" + client2 "sigs.k8s.io/controller-runtime/pkg/client" +) + +func (c *client) ApplyPlatformSecret(ctx context.Context, kubeClient kubernetes.Interface, name, namespace, project string) error { + managementClient, err := c.Management() + if err != nil { + return fmt.Errorf("create management client: %w", err) + } + + // is the access key still valid? + if c.Config().VirtualClusterAccessKey != "" { + selfCtx, cancel := context.WithTimeout(ctx, 1*time.Minute) + self, err := managementClient.Loft().ManagementV1().Selves().Create(selfCtx, &managementv1.Self{ + Spec: managementv1.SelfSpec{ + AccessKey: c.Config().VirtualClusterAccessKey, + }, + }, metav1.CreateOptions{}) + cancel() + if err != nil || self.Status.Subject != c.self.Status.Subject { + c.Config().VirtualClusterAccessKey = "" + } + } + + // check if we need to create a virtual cluster access key + if c.Config().VirtualClusterAccessKey == "" { + user := "" + team := "" + if c.self.Status.User != nil { + user = c.self.Status.User.Name + } + if c.self.Status.Team != nil { + team = c.self.Status.Team.Name + } + + accessKey, err := managementClient.Loft().ManagementV1().OwnedAccessKeys().Create(ctx, &managementv1.OwnedAccessKey{ + Spec: managementv1.OwnedAccessKeySpec{ + AccessKeySpec: storagev1.AccessKeySpec{ + DisplayName: "vCluster CLI Activation Key", + User: user, + Team: team, + Scope: &storagev1.AccessKeyScope{ + Roles: []storagev1.AccessKeyScopeRole{ + { + Role: storagev1.AccessKeyScopeRoleVCluster, + }, + }, + }, + }, + }, + }, metav1.CreateOptions{}) + if err != nil { + return fmt.Errorf("create owned access key: %w", err) + } + + c.Config().VirtualClusterAccessKey = accessKey.Spec.Key + err = c.Save() + if err != nil { + return fmt.Errorf("save vCluster platform config: %w", err) + } + } + + // build secret payload + payload := map[string][]byte{ + "accessKey": []byte(c.Config().VirtualClusterAccessKey), + "host": []byte(strings.TrimPrefix(c.Config().Host, "https://")), + "insecure": []byte(strconv.FormatBool(c.Config().Insecure)), + } + if project != "" { + payload["project"] = []byte(project) + } + + // check if secret already exists + keySecret, err := kubeClient.CoreV1().Secrets(namespace).Get(ctx, name, metav1.GetOptions{}) + if err != nil && !kerrors.IsNotFound(err) { + return fmt.Errorf("error getting platform secret %s/%s: %w", namespace, name, err) + } else if kerrors.IsNotFound(err) { + _, err = kubeClient.CoreV1().Secrets(namespace).Create(ctx, &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + }, + Data: payload, + }, metav1.CreateOptions{}) + if err != nil { + return fmt.Errorf("error creating platform secret %s/%s: %w", namespace, name, err) + } + + return nil + } else if reflect.DeepEqual(keySecret.Data, payload) { + // no update needed, just return + return nil + } + + // create the patch + patch := client2.MergeFrom(keySecret.DeepCopy()) + keySecret.Data = payload + patchBytes, err := patch.Data(keySecret) + if err != nil { + return fmt.Errorf("error creating patch for platform secret %s/%s: %w", namespace, name, err) + } + + // patch the secret + _, err = kubeClient.CoreV1().Secrets(namespace).Patch(ctx, keySecret.Name, patch.Type(), patchBytes, metav1.PatchOptions{}) + if err != nil { + return fmt.Errorf("error patching platform secret %s/%s: %w", namespace, name, err) + } + + return nil +} diff --git a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/install/zz_generated.api.register.go b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/install/zz_generated.api.register.go index 709718d13d..e6f54eeed6 100644 --- a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/install/zz_generated.api.register.go +++ b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/install/zz_generated.api.register.go @@ -4,7 +4,7 @@ package install import ( "github.com/loft-sh/api/v3/pkg/apis/management" - v1 "github.com/loft-sh/api/v3/pkg/apis/management/v1" + "github.com/loft-sh/api/v3/pkg/apis/management/v1" "github.com/loft-sh/apiserver/pkg/builders" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" @@ -50,6 +50,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &management.ClusterRoleTemplateList{}, &management.Config{}, &management.ConfigList{}, + &management.ConvertVirtualClusterConfig{}, + &management.ConvertVirtualClusterConfigList{}, &management.DevPodWorkspaceInstance{}, &management.DevPodWorkspaceInstanceList{}, &management.DevPodDeleteOptions{}, @@ -79,8 +81,6 @@ func addKnownTypes(scheme *runtime.Scheme) error { &management.LoftUpgradeList{}, &management.OwnedAccessKey{}, &management.OwnedAccessKeyList{}, - &management.PolicyViolation{}, - &management.PolicyViolationList{}, &management.Project{}, &management.ProjectList{}, &management.ProjectChartInfo{}, diff --git a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/policyviolation_types.go b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/policyviolation_types.go deleted file mode 100644 index c0f009fab0..0000000000 --- a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/policyviolation_types.go +++ /dev/null @@ -1,43 +0,0 @@ -package v1 - -import ( - clusterv1 "github.com/loft-sh/agentapi/v3/pkg/apis/loft/cluster/v1" - policyv1beta1 "github.com/loft-sh/jspolicy/pkg/apis/policy/v1beta1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// PolicyViolation -// +k8s:openapi-gen=true -// +resource:path=policyviolations,rest=PolicyViolationREST -type PolicyViolation struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec PolicyViolationSpec `json:"spec,omitempty"` - Status PolicyViolationStatus `json:"status,omitempty"` -} - -type PolicyViolationSpec struct { -} - -type PolicyViolationStatus struct { - // Policy is the name of the policy where the violation occurred - // +optional - Policy string `json:"policy,omitempty"` - - // Cluster is the cluster where the violation occurred in - // +optional - Cluster string `json:"cluster,omitempty"` - - // The Loft user that caused the violation - // +optional - User *clusterv1.EntityInfo `json:"user,omitempty"` - - // Violation contains information about the violation - // +optional - Violation policyv1beta1.PolicyViolation `json:"violation,omitempty"` -} diff --git a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/virtualcluster_convertconfig_types.go b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/virtualcluster_convertconfig_types.go new file mode 100644 index 0000000000..f1a892be36 --- /dev/null +++ b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/virtualcluster_convertconfig_types.go @@ -0,0 +1,41 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ConvertVirtualClusterConfig holds config request and response data for virtual clusters +// +k8s:openapi-gen=true +// +resource:path=convertvirtualclusterconfig,rest=ConvertVirtualClusterConfigREST +type ConvertVirtualClusterConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ConvertVirtualClusterConfigSpec `json:"spec,omitempty"` + Status ConvertVirtualClusterConfigStatus `json:"status,omitempty"` +} + +// ConvertVirtualClusterConfigSpec holds the specification +type ConvertVirtualClusterConfigSpec struct { + // Distro is the distro to be used for the config + // +optional + Distro string `json:"distro,omitempty"` + + // Values are the config values for the virtual cluster + // +optional + Values string `json:"values,omitempty"` +} + +// ConvertVirtualClusterConfigStatus holds the status +type ConvertVirtualClusterConfigStatus struct { + // Values are the converted config values for the virtual cluster + // +optional + Values string `json:"values,omitempty"` + + // Converted signals if the Values have been converted from the old format + Converted bool `json:"converted"` +} diff --git a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/virtualclusterinstance_types.go b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/virtualclusterinstance_types.go index 8394585dc9..e810c5bd98 100644 --- a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/virtualclusterinstance_types.go +++ b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/virtualclusterinstance_types.go @@ -49,6 +49,11 @@ type VirtualClusterInstanceStatus struct { // CanUpdate specifies if the requester can update the instance // +optional CanUpdate bool `json:"canUpdate,omitempty"` + + // Online specifies if there is at least one network peer available + // for an agentless vCluster. + // +optional + Online bool `json:"online,omitempty"` } func (a *VirtualClusterInstance) GetConditions() agentstoragev1.Conditions { diff --git a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/zz_generated.api.register.go b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/zz_generated.api.register.go index a081540442..cdae94944c 100644 --- a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/zz_generated.api.register.go +++ b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/zz_generated.api.register.go @@ -41,6 +41,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &ClusterRoleTemplateList{}, &Config{}, &ConfigList{}, + &ConvertVirtualClusterConfig{}, + &ConvertVirtualClusterConfigList{}, &DevPodWorkspaceInstance{}, &DevPodWorkspaceInstanceList{}, &DevPodDeleteOptions{}, @@ -70,8 +72,6 @@ func addKnownTypes(scheme *runtime.Scheme) error { &LoftUpgradeList{}, &OwnedAccessKey{}, &OwnedAccessKeyList{}, - &PolicyViolation{}, - &PolicyViolationList{}, &Project{}, &ProjectList{}, &ProjectChartInfo{}, @@ -192,6 +192,7 @@ var ( management.ManagementClusterConnectStorage, management.ManagementClusterRoleTemplateStorage, management.ManagementConfigStorage, + management.ManagementConvertVirtualClusterConfigStorage, management.ManagementDevPodWorkspaceInstanceStorage, builders.NewApiResourceWithStorage( management.InternalDevPodDeleteOptionsREST, @@ -243,7 +244,6 @@ var ( management.ManagementLicenseTokenStorage, management.ManagementLoftUpgradeStorage, management.ManagementOwnedAccessKeyStorage, - management.ManagementPolicyViolationStorage, management.ManagementProjectStorage, builders.NewApiResourceWithStorage( management.InternalProjectStatus, @@ -561,6 +561,14 @@ type ConfigList struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ConvertVirtualClusterConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ConvertVirtualClusterConfig `json:"items"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + type DevPodWorkspaceInstanceList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` @@ -705,14 +713,6 @@ type OwnedAccessKeyList struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type PolicyViolationList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []PolicyViolation `json:"items"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - type ProjectList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` diff --git a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/zz_generated.conversion.go b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/zz_generated.conversion.go index 255f8d728f..ecfc4fe960 100644 --- a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/zz_generated.conversion.go +++ b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/zz_generated.conversion.go @@ -829,6 +829,46 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*ConvertVirtualClusterConfig)(nil), (*management.ConvertVirtualClusterConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_ConvertVirtualClusterConfig_To_management_ConvertVirtualClusterConfig(a.(*ConvertVirtualClusterConfig), b.(*management.ConvertVirtualClusterConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*management.ConvertVirtualClusterConfig)(nil), (*ConvertVirtualClusterConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_management_ConvertVirtualClusterConfig_To_v1_ConvertVirtualClusterConfig(a.(*management.ConvertVirtualClusterConfig), b.(*ConvertVirtualClusterConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ConvertVirtualClusterConfigList)(nil), (*management.ConvertVirtualClusterConfigList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_ConvertVirtualClusterConfigList_To_management_ConvertVirtualClusterConfigList(a.(*ConvertVirtualClusterConfigList), b.(*management.ConvertVirtualClusterConfigList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*management.ConvertVirtualClusterConfigList)(nil), (*ConvertVirtualClusterConfigList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_management_ConvertVirtualClusterConfigList_To_v1_ConvertVirtualClusterConfigList(a.(*management.ConvertVirtualClusterConfigList), b.(*ConvertVirtualClusterConfigList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ConvertVirtualClusterConfigSpec)(nil), (*management.ConvertVirtualClusterConfigSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_ConvertVirtualClusterConfigSpec_To_management_ConvertVirtualClusterConfigSpec(a.(*ConvertVirtualClusterConfigSpec), b.(*management.ConvertVirtualClusterConfigSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*management.ConvertVirtualClusterConfigSpec)(nil), (*ConvertVirtualClusterConfigSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_management_ConvertVirtualClusterConfigSpec_To_v1_ConvertVirtualClusterConfigSpec(a.(*management.ConvertVirtualClusterConfigSpec), b.(*ConvertVirtualClusterConfigSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ConvertVirtualClusterConfigStatus)(nil), (*management.ConvertVirtualClusterConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_ConvertVirtualClusterConfigStatus_To_management_ConvertVirtualClusterConfigStatus(a.(*ConvertVirtualClusterConfigStatus), b.(*management.ConvertVirtualClusterConfigStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*management.ConvertVirtualClusterConfigStatus)(nil), (*ConvertVirtualClusterConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_management_ConvertVirtualClusterConfigStatus_To_v1_ConvertVirtualClusterConfigStatus(a.(*management.ConvertVirtualClusterConfigStatus), b.(*ConvertVirtualClusterConfigStatus), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*DevPodDeleteOptions)(nil), (*management.DevPodDeleteOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1_DevPodDeleteOptions_To_management_DevPodDeleteOptions(a.(*DevPodDeleteOptions), b.(*management.DevPodDeleteOptions), scope) }); err != nil { @@ -1459,46 +1499,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*PolicyViolation)(nil), (*management.PolicyViolation)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1_PolicyViolation_To_management_PolicyViolation(a.(*PolicyViolation), b.(*management.PolicyViolation), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*management.PolicyViolation)(nil), (*PolicyViolation)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_management_PolicyViolation_To_v1_PolicyViolation(a.(*management.PolicyViolation), b.(*PolicyViolation), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*PolicyViolationList)(nil), (*management.PolicyViolationList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1_PolicyViolationList_To_management_PolicyViolationList(a.(*PolicyViolationList), b.(*management.PolicyViolationList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*management.PolicyViolationList)(nil), (*PolicyViolationList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_management_PolicyViolationList_To_v1_PolicyViolationList(a.(*management.PolicyViolationList), b.(*PolicyViolationList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*PolicyViolationSpec)(nil), (*management.PolicyViolationSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1_PolicyViolationSpec_To_management_PolicyViolationSpec(a.(*PolicyViolationSpec), b.(*management.PolicyViolationSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*management.PolicyViolationSpec)(nil), (*PolicyViolationSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_management_PolicyViolationSpec_To_v1_PolicyViolationSpec(a.(*management.PolicyViolationSpec), b.(*PolicyViolationSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*PolicyViolationStatus)(nil), (*management.PolicyViolationStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1_PolicyViolationStatus_To_management_PolicyViolationStatus(a.(*PolicyViolationStatus), b.(*management.PolicyViolationStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*management.PolicyViolationStatus)(nil), (*PolicyViolationStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_management_PolicyViolationStatus_To_v1_PolicyViolationStatus(a.(*management.PolicyViolationStatus), b.(*PolicyViolationStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*PredefinedApp)(nil), (*management.PredefinedApp)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1_PredefinedApp_To_management_PredefinedApp(a.(*PredefinedApp), b.(*management.PredefinedApp), scope) }); err != nil { @@ -4936,6 +4936,104 @@ func Convert_management_ConnectorWithName_To_v1_ConnectorWithName(in *management return autoConvert_management_ConnectorWithName_To_v1_ConnectorWithName(in, out, s) } +func autoConvert_v1_ConvertVirtualClusterConfig_To_management_ConvertVirtualClusterConfig(in *ConvertVirtualClusterConfig, out *management.ConvertVirtualClusterConfig, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1_ConvertVirtualClusterConfigSpec_To_management_ConvertVirtualClusterConfigSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1_ConvertVirtualClusterConfigStatus_To_management_ConvertVirtualClusterConfigStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1_ConvertVirtualClusterConfig_To_management_ConvertVirtualClusterConfig is an autogenerated conversion function. +func Convert_v1_ConvertVirtualClusterConfig_To_management_ConvertVirtualClusterConfig(in *ConvertVirtualClusterConfig, out *management.ConvertVirtualClusterConfig, s conversion.Scope) error { + return autoConvert_v1_ConvertVirtualClusterConfig_To_management_ConvertVirtualClusterConfig(in, out, s) +} + +func autoConvert_management_ConvertVirtualClusterConfig_To_v1_ConvertVirtualClusterConfig(in *management.ConvertVirtualClusterConfig, out *ConvertVirtualClusterConfig, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_management_ConvertVirtualClusterConfigSpec_To_v1_ConvertVirtualClusterConfigSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_management_ConvertVirtualClusterConfigStatus_To_v1_ConvertVirtualClusterConfigStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_management_ConvertVirtualClusterConfig_To_v1_ConvertVirtualClusterConfig is an autogenerated conversion function. +func Convert_management_ConvertVirtualClusterConfig_To_v1_ConvertVirtualClusterConfig(in *management.ConvertVirtualClusterConfig, out *ConvertVirtualClusterConfig, s conversion.Scope) error { + return autoConvert_management_ConvertVirtualClusterConfig_To_v1_ConvertVirtualClusterConfig(in, out, s) +} + +func autoConvert_v1_ConvertVirtualClusterConfigList_To_management_ConvertVirtualClusterConfigList(in *ConvertVirtualClusterConfigList, out *management.ConvertVirtualClusterConfigList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]management.ConvertVirtualClusterConfig)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1_ConvertVirtualClusterConfigList_To_management_ConvertVirtualClusterConfigList is an autogenerated conversion function. +func Convert_v1_ConvertVirtualClusterConfigList_To_management_ConvertVirtualClusterConfigList(in *ConvertVirtualClusterConfigList, out *management.ConvertVirtualClusterConfigList, s conversion.Scope) error { + return autoConvert_v1_ConvertVirtualClusterConfigList_To_management_ConvertVirtualClusterConfigList(in, out, s) +} + +func autoConvert_management_ConvertVirtualClusterConfigList_To_v1_ConvertVirtualClusterConfigList(in *management.ConvertVirtualClusterConfigList, out *ConvertVirtualClusterConfigList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]ConvertVirtualClusterConfig)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_management_ConvertVirtualClusterConfigList_To_v1_ConvertVirtualClusterConfigList is an autogenerated conversion function. +func Convert_management_ConvertVirtualClusterConfigList_To_v1_ConvertVirtualClusterConfigList(in *management.ConvertVirtualClusterConfigList, out *ConvertVirtualClusterConfigList, s conversion.Scope) error { + return autoConvert_management_ConvertVirtualClusterConfigList_To_v1_ConvertVirtualClusterConfigList(in, out, s) +} + +func autoConvert_v1_ConvertVirtualClusterConfigSpec_To_management_ConvertVirtualClusterConfigSpec(in *ConvertVirtualClusterConfigSpec, out *management.ConvertVirtualClusterConfigSpec, s conversion.Scope) error { + out.Distro = in.Distro + out.Values = in.Values + return nil +} + +// Convert_v1_ConvertVirtualClusterConfigSpec_To_management_ConvertVirtualClusterConfigSpec is an autogenerated conversion function. +func Convert_v1_ConvertVirtualClusterConfigSpec_To_management_ConvertVirtualClusterConfigSpec(in *ConvertVirtualClusterConfigSpec, out *management.ConvertVirtualClusterConfigSpec, s conversion.Scope) error { + return autoConvert_v1_ConvertVirtualClusterConfigSpec_To_management_ConvertVirtualClusterConfigSpec(in, out, s) +} + +func autoConvert_management_ConvertVirtualClusterConfigSpec_To_v1_ConvertVirtualClusterConfigSpec(in *management.ConvertVirtualClusterConfigSpec, out *ConvertVirtualClusterConfigSpec, s conversion.Scope) error { + out.Distro = in.Distro + out.Values = in.Values + return nil +} + +// Convert_management_ConvertVirtualClusterConfigSpec_To_v1_ConvertVirtualClusterConfigSpec is an autogenerated conversion function. +func Convert_management_ConvertVirtualClusterConfigSpec_To_v1_ConvertVirtualClusterConfigSpec(in *management.ConvertVirtualClusterConfigSpec, out *ConvertVirtualClusterConfigSpec, s conversion.Scope) error { + return autoConvert_management_ConvertVirtualClusterConfigSpec_To_v1_ConvertVirtualClusterConfigSpec(in, out, s) +} + +func autoConvert_v1_ConvertVirtualClusterConfigStatus_To_management_ConvertVirtualClusterConfigStatus(in *ConvertVirtualClusterConfigStatus, out *management.ConvertVirtualClusterConfigStatus, s conversion.Scope) error { + out.Values = in.Values + out.Converted = in.Converted + return nil +} + +// Convert_v1_ConvertVirtualClusterConfigStatus_To_management_ConvertVirtualClusterConfigStatus is an autogenerated conversion function. +func Convert_v1_ConvertVirtualClusterConfigStatus_To_management_ConvertVirtualClusterConfigStatus(in *ConvertVirtualClusterConfigStatus, out *management.ConvertVirtualClusterConfigStatus, s conversion.Scope) error { + return autoConvert_v1_ConvertVirtualClusterConfigStatus_To_management_ConvertVirtualClusterConfigStatus(in, out, s) +} + +func autoConvert_management_ConvertVirtualClusterConfigStatus_To_v1_ConvertVirtualClusterConfigStatus(in *management.ConvertVirtualClusterConfigStatus, out *ConvertVirtualClusterConfigStatus, s conversion.Scope) error { + out.Values = in.Values + out.Converted = in.Converted + return nil +} + +// Convert_management_ConvertVirtualClusterConfigStatus_To_v1_ConvertVirtualClusterConfigStatus is an autogenerated conversion function. +func Convert_management_ConvertVirtualClusterConfigStatus_To_v1_ConvertVirtualClusterConfigStatus(in *management.ConvertVirtualClusterConfigStatus, out *ConvertVirtualClusterConfigStatus, s conversion.Scope) error { + return autoConvert_management_ConvertVirtualClusterConfigStatus_To_v1_ConvertVirtualClusterConfigStatus(in, out, s) +} + func autoConvert_v1_DevPodDeleteOptions_To_management_DevPodDeleteOptions(in *DevPodDeleteOptions, out *management.DevPodDeleteOptions, s conversion.Scope) error { out.Options = in.Options return nil @@ -6555,104 +6653,6 @@ func Convert_management_OwnedAccessKeyStatus_To_v1_OwnedAccessKeyStatus(in *mana return autoConvert_management_OwnedAccessKeyStatus_To_v1_OwnedAccessKeyStatus(in, out, s) } -func autoConvert_v1_PolicyViolation_To_management_PolicyViolation(in *PolicyViolation, out *management.PolicyViolation, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1_PolicyViolationSpec_To_management_PolicyViolationSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1_PolicyViolationStatus_To_management_PolicyViolationStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1_PolicyViolation_To_management_PolicyViolation is an autogenerated conversion function. -func Convert_v1_PolicyViolation_To_management_PolicyViolation(in *PolicyViolation, out *management.PolicyViolation, s conversion.Scope) error { - return autoConvert_v1_PolicyViolation_To_management_PolicyViolation(in, out, s) -} - -func autoConvert_management_PolicyViolation_To_v1_PolicyViolation(in *management.PolicyViolation, out *PolicyViolation, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_management_PolicyViolationSpec_To_v1_PolicyViolationSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_management_PolicyViolationStatus_To_v1_PolicyViolationStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_management_PolicyViolation_To_v1_PolicyViolation is an autogenerated conversion function. -func Convert_management_PolicyViolation_To_v1_PolicyViolation(in *management.PolicyViolation, out *PolicyViolation, s conversion.Scope) error { - return autoConvert_management_PolicyViolation_To_v1_PolicyViolation(in, out, s) -} - -func autoConvert_v1_PolicyViolationList_To_management_PolicyViolationList(in *PolicyViolationList, out *management.PolicyViolationList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]management.PolicyViolation)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_v1_PolicyViolationList_To_management_PolicyViolationList is an autogenerated conversion function. -func Convert_v1_PolicyViolationList_To_management_PolicyViolationList(in *PolicyViolationList, out *management.PolicyViolationList, s conversion.Scope) error { - return autoConvert_v1_PolicyViolationList_To_management_PolicyViolationList(in, out, s) -} - -func autoConvert_management_PolicyViolationList_To_v1_PolicyViolationList(in *management.PolicyViolationList, out *PolicyViolationList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]PolicyViolation)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_management_PolicyViolationList_To_v1_PolicyViolationList is an autogenerated conversion function. -func Convert_management_PolicyViolationList_To_v1_PolicyViolationList(in *management.PolicyViolationList, out *PolicyViolationList, s conversion.Scope) error { - return autoConvert_management_PolicyViolationList_To_v1_PolicyViolationList(in, out, s) -} - -func autoConvert_v1_PolicyViolationSpec_To_management_PolicyViolationSpec(in *PolicyViolationSpec, out *management.PolicyViolationSpec, s conversion.Scope) error { - return nil -} - -// Convert_v1_PolicyViolationSpec_To_management_PolicyViolationSpec is an autogenerated conversion function. -func Convert_v1_PolicyViolationSpec_To_management_PolicyViolationSpec(in *PolicyViolationSpec, out *management.PolicyViolationSpec, s conversion.Scope) error { - return autoConvert_v1_PolicyViolationSpec_To_management_PolicyViolationSpec(in, out, s) -} - -func autoConvert_management_PolicyViolationSpec_To_v1_PolicyViolationSpec(in *management.PolicyViolationSpec, out *PolicyViolationSpec, s conversion.Scope) error { - return nil -} - -// Convert_management_PolicyViolationSpec_To_v1_PolicyViolationSpec is an autogenerated conversion function. -func Convert_management_PolicyViolationSpec_To_v1_PolicyViolationSpec(in *management.PolicyViolationSpec, out *PolicyViolationSpec, s conversion.Scope) error { - return autoConvert_management_PolicyViolationSpec_To_v1_PolicyViolationSpec(in, out, s) -} - -func autoConvert_v1_PolicyViolationStatus_To_management_PolicyViolationStatus(in *PolicyViolationStatus, out *management.PolicyViolationStatus, s conversion.Scope) error { - out.Policy = in.Policy - out.Cluster = in.Cluster - out.User = (*clusterv1.EntityInfo)(unsafe.Pointer(in.User)) - out.Violation = in.Violation - return nil -} - -// Convert_v1_PolicyViolationStatus_To_management_PolicyViolationStatus is an autogenerated conversion function. -func Convert_v1_PolicyViolationStatus_To_management_PolicyViolationStatus(in *PolicyViolationStatus, out *management.PolicyViolationStatus, s conversion.Scope) error { - return autoConvert_v1_PolicyViolationStatus_To_management_PolicyViolationStatus(in, out, s) -} - -func autoConvert_management_PolicyViolationStatus_To_v1_PolicyViolationStatus(in *management.PolicyViolationStatus, out *PolicyViolationStatus, s conversion.Scope) error { - out.Policy = in.Policy - out.Cluster = in.Cluster - out.User = (*clusterv1.EntityInfo)(unsafe.Pointer(in.User)) - out.Violation = in.Violation - return nil -} - -// Convert_management_PolicyViolationStatus_To_v1_PolicyViolationStatus is an autogenerated conversion function. -func Convert_management_PolicyViolationStatus_To_v1_PolicyViolationStatus(in *management.PolicyViolationStatus, out *PolicyViolationStatus, s conversion.Scope) error { - return autoConvert_management_PolicyViolationStatus_To_v1_PolicyViolationStatus(in, out, s) -} - func autoConvert_v1_PredefinedApp_To_management_PredefinedApp(in *PredefinedApp, out *management.PredefinedApp, s conversion.Scope) error { out.Chart = in.Chart out.InitialVersion = in.InitialVersion @@ -9725,6 +9725,7 @@ func autoConvert_v1_VirtualClusterInstanceStatus_To_management_VirtualClusterIns out.SleepModeConfig = (*clusterv1.SleepModeConfig)(unsafe.Pointer(in.SleepModeConfig)) out.CanUse = in.CanUse out.CanUpdate = in.CanUpdate + out.Online = in.Online return nil } @@ -9738,6 +9739,7 @@ func autoConvert_management_VirtualClusterInstanceStatus_To_v1_VirtualClusterIns out.SleepModeConfig = (*clusterv1.SleepModeConfig)(unsafe.Pointer(in.SleepModeConfig)) out.CanUse = in.CanUse out.CanUpdate = in.CanUpdate + out.Online = in.Online return nil } diff --git a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/zz_generated.deepcopy.go b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/zz_generated.deepcopy.go index 27be303c2d..bcddc2a09d 100644 --- a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/zz_generated.deepcopy.go +++ b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/v1/zz_generated.deepcopy.go @@ -2246,6 +2246,99 @@ func (in *ConnectorWithName) DeepCopy() *ConnectorWithName { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConvertVirtualClusterConfig) DeepCopyInto(out *ConvertVirtualClusterConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConvertVirtualClusterConfig. +func (in *ConvertVirtualClusterConfig) DeepCopy() *ConvertVirtualClusterConfig { + if in == nil { + return nil + } + out := new(ConvertVirtualClusterConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConvertVirtualClusterConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConvertVirtualClusterConfigList) DeepCopyInto(out *ConvertVirtualClusterConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ConvertVirtualClusterConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConvertVirtualClusterConfigList. +func (in *ConvertVirtualClusterConfigList) DeepCopy() *ConvertVirtualClusterConfigList { + if in == nil { + return nil + } + out := new(ConvertVirtualClusterConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConvertVirtualClusterConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConvertVirtualClusterConfigSpec) DeepCopyInto(out *ConvertVirtualClusterConfigSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConvertVirtualClusterConfigSpec. +func (in *ConvertVirtualClusterConfigSpec) DeepCopy() *ConvertVirtualClusterConfigSpec { + if in == nil { + return nil + } + out := new(ConvertVirtualClusterConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConvertVirtualClusterConfigStatus) DeepCopyInto(out *ConvertVirtualClusterConfigStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConvertVirtualClusterConfigStatus. +func (in *ConvertVirtualClusterConfigStatus) DeepCopy() *ConvertVirtualClusterConfigStatus { + if in == nil { + return nil + } + out := new(ConvertVirtualClusterConfigStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DevPodDeleteOptions) DeepCopyInto(out *DevPodDeleteOptions) { *out = *in @@ -3829,105 +3922,6 @@ func (in *OwnedAccessKeyStatus) DeepCopy() *OwnedAccessKeyStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PolicyViolation) DeepCopyInto(out *PolicyViolation) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyViolation. -func (in *PolicyViolation) DeepCopy() *PolicyViolation { - if in == nil { - return nil - } - out := new(PolicyViolation) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PolicyViolation) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PolicyViolationList) DeepCopyInto(out *PolicyViolationList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]PolicyViolation, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyViolationList. -func (in *PolicyViolationList) DeepCopy() *PolicyViolationList { - if in == nil { - return nil - } - out := new(PolicyViolationList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PolicyViolationList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PolicyViolationSpec) DeepCopyInto(out *PolicyViolationSpec) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyViolationSpec. -func (in *PolicyViolationSpec) DeepCopy() *PolicyViolationSpec { - if in == nil { - return nil - } - out := new(PolicyViolationSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PolicyViolationStatus) DeepCopyInto(out *PolicyViolationStatus) { - *out = *in - if in.User != nil { - in, out := &in.User, &out.User - *out = new(clusterv1.EntityInfo) - **out = **in - } - in.Violation.DeepCopyInto(&out.Violation) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyViolationStatus. -func (in *PolicyViolationStatus) DeepCopy() *PolicyViolationStatus { - if in == nil { - return nil - } - out := new(PolicyViolationStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PredefinedApp) DeepCopyInto(out *PredefinedApp) { *out = *in diff --git a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/zz_generated.api.register.go b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/zz_generated.api.register.go index 89b7f458f2..67645577d1 100644 --- a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/zz_generated.api.register.go +++ b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/zz_generated.api.register.go @@ -117,7 +117,17 @@ var ( NewConfigREST = func(getter generic.RESTOptionsGetter) rest.Storage { return NewConfigRESTFunc(Factory) } - NewConfigRESTFunc NewRESTFunc + NewConfigRESTFunc NewRESTFunc + ManagementConvertVirtualClusterConfigStorage = builders.NewApiResourceWithStorage( // Resource status endpoint + InternalConvertVirtualClusterConfig, + func() runtime.Object { return &ConvertVirtualClusterConfig{} }, // Register versioned resource + func() runtime.Object { return &ConvertVirtualClusterConfigList{} }, // Register versioned resource list + NewConvertVirtualClusterConfigREST, + ) + NewConvertVirtualClusterConfigREST = func(getter generic.RESTOptionsGetter) rest.Storage { + return NewConvertVirtualClusterConfigRESTFunc(Factory) + } + NewConvertVirtualClusterConfigRESTFunc NewRESTFunc ManagementDevPodWorkspaceInstanceStorage = builders.NewApiResourceWithStorage( // Resource status endpoint InternalDevPodWorkspaceInstance, func() runtime.Object { return &DevPodWorkspaceInstance{} }, // Register versioned resource @@ -231,18 +241,8 @@ var ( NewOwnedAccessKeyREST = func(getter generic.RESTOptionsGetter) rest.Storage { return NewOwnedAccessKeyRESTFunc(Factory) } - NewOwnedAccessKeyRESTFunc NewRESTFunc - ManagementPolicyViolationStorage = builders.NewApiResourceWithStorage( // Resource status endpoint - InternalPolicyViolation, - func() runtime.Object { return &PolicyViolation{} }, // Register versioned resource - func() runtime.Object { return &PolicyViolationList{} }, // Register versioned resource list - NewPolicyViolationREST, - ) - NewPolicyViolationREST = func(getter generic.RESTOptionsGetter) rest.Storage { - return NewPolicyViolationRESTFunc(Factory) - } - NewPolicyViolationRESTFunc NewRESTFunc - ManagementProjectStorage = builders.NewApiResourceWithStorage( // Resource status endpoint + NewOwnedAccessKeyRESTFunc NewRESTFunc + ManagementProjectStorage = builders.NewApiResourceWithStorage( // Resource status endpoint InternalProject, func() runtime.Object { return &Project{} }, // Register versioned resource func() runtime.Object { return &ProjectList{} }, // Register versioned resource list @@ -608,6 +608,18 @@ var ( func() runtime.Object { return &Config{} }, func() runtime.Object { return &ConfigList{} }, ) + InternalConvertVirtualClusterConfig = builders.NewInternalResource( + "convertvirtualclusterconfig", + "ConvertVirtualClusterConfig", + func() runtime.Object { return &ConvertVirtualClusterConfig{} }, + func() runtime.Object { return &ConvertVirtualClusterConfigList{} }, + ) + InternalConvertVirtualClusterConfigStatus = builders.NewInternalResourceStatus( + "convertvirtualclusterconfig", + "ConvertVirtualClusterConfigStatus", + func() runtime.Object { return &ConvertVirtualClusterConfig{} }, + func() runtime.Object { return &ConvertVirtualClusterConfigList{} }, + ) InternalDevPodWorkspaceInstance = builders.NewInternalResource( "devpodworkspaceinstances", "DevPodWorkspaceInstance", @@ -796,18 +808,6 @@ var ( func() runtime.Object { return &OwnedAccessKey{} }, func() runtime.Object { return &OwnedAccessKeyList{} }, ) - InternalPolicyViolation = builders.NewInternalResource( - "policyviolations", - "PolicyViolation", - func() runtime.Object { return &PolicyViolation{} }, - func() runtime.Object { return &PolicyViolationList{} }, - ) - InternalPolicyViolationStatus = builders.NewInternalResourceStatus( - "policyviolations", - "PolicyViolationStatus", - func() runtime.Object { return &PolicyViolation{} }, - func() runtime.Object { return &PolicyViolationList{} }, - ) InternalProject = builders.NewInternalResource( "projects", "Project", @@ -1210,6 +1210,8 @@ var ( InternalClusterRoleTemplateStatus, InternalConfig, InternalConfigStatus, + InternalConvertVirtualClusterConfig, + InternalConvertVirtualClusterConfigStatus, InternalDevPodWorkspaceInstance, InternalDevPodWorkspaceInstanceStatus, InternalDevPodDeleteOptionsREST, @@ -1239,8 +1241,6 @@ var ( InternalLoftUpgradeStatus, InternalOwnedAccessKey, InternalOwnedAccessKeyStatus, - InternalPolicyViolation, - InternalPolicyViolationStatus, InternalProject, InternalProjectStatus, InternalProjectChartInfoREST, @@ -1810,6 +1810,27 @@ type ConnectorWithName struct { Connector `json:",inline"` } +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type ConvertVirtualClusterConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec ConvertVirtualClusterConfigSpec `json:"spec,omitempty"` + Status ConvertVirtualClusterConfigStatus `json:"status,omitempty"` +} + +type ConvertVirtualClusterConfigSpec struct { + Distro string `json:"distro,omitempty"` + Values string `json:"values,omitempty"` +} + +type ConvertVirtualClusterConfigStatus struct { + Values string `json:"values,omitempty"` + Converted bool `json:"converted"` +} + // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type DevPodDeleteOptions struct { @@ -2014,7 +2035,7 @@ type KioskStatus struct { } // +genclient -// +genclient:nonNamespaced +// +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type License struct { @@ -2122,27 +2143,6 @@ type OwnedAccessKeyStatus struct { storagev1.AccessKeyStatus `json:",inline"` } -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -type PolicyViolation struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec PolicyViolationSpec `json:"spec,omitempty"` - Status PolicyViolationStatus `json:"status,omitempty"` -} - -type PolicyViolationSpec struct { -} - -type PolicyViolationStatus struct { - Policy string `json:"policy,omitempty"` - Cluster string `json:"cluster,omitempty"` - User *clusterv1.EntityInfo `json:"user,omitempty"` - Violation policyv1beta1.PolicyViolation `json:"violation,omitempty"` -} - type PredefinedApp struct { Chart string `json:"chart"` InitialVersion string `json:"initialVersion,omitempty"` @@ -2712,6 +2712,7 @@ type VirtualClusterInstanceStatus struct { SleepModeConfig *clusterv1.SleepModeConfig `json:"sleepModeConfig,omitempty"` CanUse bool `json:"canUse,omitempty"` CanUpdate bool `json:"canUpdate,omitempty"` + Online bool `json:"online,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object @@ -3894,6 +3895,125 @@ func (s *storageConfig) DeleteConfig(ctx context.Context, id string) (bool, erro return sync, err } +// ConvertVirtualClusterConfig Functions and Structs +// +// +k8s:deepcopy-gen=false +type ConvertVirtualClusterConfigStrategy struct { + builders.DefaultStorageStrategy +} + +// +k8s:deepcopy-gen=false +type ConvertVirtualClusterConfigStatusStrategy struct { + builders.DefaultStatusStorageStrategy +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type ConvertVirtualClusterConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ConvertVirtualClusterConfig `json:"items"` +} + +func (ConvertVirtualClusterConfig) NewStatus() interface{} { + return ConvertVirtualClusterConfigStatus{} +} + +func (pc *ConvertVirtualClusterConfig) GetStatus() interface{} { + return pc.Status +} + +func (pc *ConvertVirtualClusterConfig) SetStatus(s interface{}) { + pc.Status = s.(ConvertVirtualClusterConfigStatus) +} + +func (pc *ConvertVirtualClusterConfig) GetSpec() interface{} { + return pc.Spec +} + +func (pc *ConvertVirtualClusterConfig) SetSpec(s interface{}) { + pc.Spec = s.(ConvertVirtualClusterConfigSpec) +} + +func (pc *ConvertVirtualClusterConfig) GetObjectMeta() *metav1.ObjectMeta { + return &pc.ObjectMeta +} + +func (pc *ConvertVirtualClusterConfig) SetGeneration(generation int64) { + pc.ObjectMeta.Generation = generation +} + +func (pc ConvertVirtualClusterConfig) GetGeneration() int64 { + return pc.ObjectMeta.Generation +} + +// Registry is an interface for things that know how to store ConvertVirtualClusterConfig. +// +k8s:deepcopy-gen=false +type ConvertVirtualClusterConfigRegistry interface { + ListConvertVirtualClusterConfigs(ctx context.Context, options *internalversion.ListOptions) (*ConvertVirtualClusterConfigList, error) + GetConvertVirtualClusterConfig(ctx context.Context, id string, options *metav1.GetOptions) (*ConvertVirtualClusterConfig, error) + CreateConvertVirtualClusterConfig(ctx context.Context, id *ConvertVirtualClusterConfig) (*ConvertVirtualClusterConfig, error) + UpdateConvertVirtualClusterConfig(ctx context.Context, id *ConvertVirtualClusterConfig) (*ConvertVirtualClusterConfig, error) + DeleteConvertVirtualClusterConfig(ctx context.Context, id string) (bool, error) +} + +// NewRegistry returns a new Registry interface for the given Storage. Any mismatched types will panic. +func NewConvertVirtualClusterConfigRegistry(sp builders.StandardStorageProvider) ConvertVirtualClusterConfigRegistry { + return &storageConvertVirtualClusterConfig{sp} +} + +// Implement Registry +// storage puts strong typing around storage calls +// +k8s:deepcopy-gen=false +type storageConvertVirtualClusterConfig struct { + builders.StandardStorageProvider +} + +func (s *storageConvertVirtualClusterConfig) ListConvertVirtualClusterConfigs(ctx context.Context, options *internalversion.ListOptions) (*ConvertVirtualClusterConfigList, error) { + if options != nil && options.FieldSelector != nil && !options.FieldSelector.Empty() { + return nil, fmt.Errorf("field selector not supported yet") + } + st := s.GetStandardStorage() + obj, err := st.List(ctx, options) + if err != nil { + return nil, err + } + return obj.(*ConvertVirtualClusterConfigList), err +} + +func (s *storageConvertVirtualClusterConfig) GetConvertVirtualClusterConfig(ctx context.Context, id string, options *metav1.GetOptions) (*ConvertVirtualClusterConfig, error) { + st := s.GetStandardStorage() + obj, err := st.Get(ctx, id, options) + if err != nil { + return nil, err + } + return obj.(*ConvertVirtualClusterConfig), nil +} + +func (s *storageConvertVirtualClusterConfig) CreateConvertVirtualClusterConfig(ctx context.Context, object *ConvertVirtualClusterConfig) (*ConvertVirtualClusterConfig, error) { + st := s.GetStandardStorage() + obj, err := st.Create(ctx, object, nil, &metav1.CreateOptions{}) + if err != nil { + return nil, err + } + return obj.(*ConvertVirtualClusterConfig), nil +} + +func (s *storageConvertVirtualClusterConfig) UpdateConvertVirtualClusterConfig(ctx context.Context, object *ConvertVirtualClusterConfig) (*ConvertVirtualClusterConfig, error) { + st := s.GetStandardStorage() + obj, _, err := st.Update(ctx, object.Name, rest.DefaultUpdatedObjectInfo(object), nil, nil, false, &metav1.UpdateOptions{}) + if err != nil { + return nil, err + } + return obj.(*ConvertVirtualClusterConfig), nil +} + +func (s *storageConvertVirtualClusterConfig) DeleteConvertVirtualClusterConfig(ctx context.Context, id string) (bool, error) { + st := s.GetStandardStorage() + _, sync, err := st.Delete(ctx, id, nil, &metav1.DeleteOptions{}) + return sync, err +} + // DevPodWorkspaceInstance Functions and Structs // // +k8s:deepcopy-gen=false @@ -5259,125 +5379,6 @@ func (s *storageOwnedAccessKey) DeleteOwnedAccessKey(ctx context.Context, id str return sync, err } -// PolicyViolation Functions and Structs -// -// +k8s:deepcopy-gen=false -type PolicyViolationStrategy struct { - builders.DefaultStorageStrategy -} - -// +k8s:deepcopy-gen=false -type PolicyViolationStatusStrategy struct { - builders.DefaultStatusStorageStrategy -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -type PolicyViolationList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []PolicyViolation `json:"items"` -} - -func (PolicyViolation) NewStatus() interface{} { - return PolicyViolationStatus{} -} - -func (pc *PolicyViolation) GetStatus() interface{} { - return pc.Status -} - -func (pc *PolicyViolation) SetStatus(s interface{}) { - pc.Status = s.(PolicyViolationStatus) -} - -func (pc *PolicyViolation) GetSpec() interface{} { - return pc.Spec -} - -func (pc *PolicyViolation) SetSpec(s interface{}) { - pc.Spec = s.(PolicyViolationSpec) -} - -func (pc *PolicyViolation) GetObjectMeta() *metav1.ObjectMeta { - return &pc.ObjectMeta -} - -func (pc *PolicyViolation) SetGeneration(generation int64) { - pc.ObjectMeta.Generation = generation -} - -func (pc PolicyViolation) GetGeneration() int64 { - return pc.ObjectMeta.Generation -} - -// Registry is an interface for things that know how to store PolicyViolation. -// +k8s:deepcopy-gen=false -type PolicyViolationRegistry interface { - ListPolicyViolations(ctx context.Context, options *internalversion.ListOptions) (*PolicyViolationList, error) - GetPolicyViolation(ctx context.Context, id string, options *metav1.GetOptions) (*PolicyViolation, error) - CreatePolicyViolation(ctx context.Context, id *PolicyViolation) (*PolicyViolation, error) - UpdatePolicyViolation(ctx context.Context, id *PolicyViolation) (*PolicyViolation, error) - DeletePolicyViolation(ctx context.Context, id string) (bool, error) -} - -// NewRegistry returns a new Registry interface for the given Storage. Any mismatched types will panic. -func NewPolicyViolationRegistry(sp builders.StandardStorageProvider) PolicyViolationRegistry { - return &storagePolicyViolation{sp} -} - -// Implement Registry -// storage puts strong typing around storage calls -// +k8s:deepcopy-gen=false -type storagePolicyViolation struct { - builders.StandardStorageProvider -} - -func (s *storagePolicyViolation) ListPolicyViolations(ctx context.Context, options *internalversion.ListOptions) (*PolicyViolationList, error) { - if options != nil && options.FieldSelector != nil && !options.FieldSelector.Empty() { - return nil, fmt.Errorf("field selector not supported yet") - } - st := s.GetStandardStorage() - obj, err := st.List(ctx, options) - if err != nil { - return nil, err - } - return obj.(*PolicyViolationList), err -} - -func (s *storagePolicyViolation) GetPolicyViolation(ctx context.Context, id string, options *metav1.GetOptions) (*PolicyViolation, error) { - st := s.GetStandardStorage() - obj, err := st.Get(ctx, id, options) - if err != nil { - return nil, err - } - return obj.(*PolicyViolation), nil -} - -func (s *storagePolicyViolation) CreatePolicyViolation(ctx context.Context, object *PolicyViolation) (*PolicyViolation, error) { - st := s.GetStandardStorage() - obj, err := st.Create(ctx, object, nil, &metav1.CreateOptions{}) - if err != nil { - return nil, err - } - return obj.(*PolicyViolation), nil -} - -func (s *storagePolicyViolation) UpdatePolicyViolation(ctx context.Context, object *PolicyViolation) (*PolicyViolation, error) { - st := s.GetStandardStorage() - obj, _, err := st.Update(ctx, object.Name, rest.DefaultUpdatedObjectInfo(object), nil, nil, false, &metav1.UpdateOptions{}) - if err != nil { - return nil, err - } - return obj.(*PolicyViolation), nil -} - -func (s *storagePolicyViolation) DeletePolicyViolation(ctx context.Context, id string) (bool, error) { - st := s.GetStandardStorage() - _, sync, err := st.Delete(ctx, id, nil, &metav1.DeleteOptions{}) - return sync, err -} - // Project Functions and Structs // // +k8s:deepcopy-gen=false diff --git a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/zz_generated.deepcopy.go b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/zz_generated.deepcopy.go index bba2ad10e3..886c57eff9 100644 --- a/vendor/github.com/loft-sh/api/v3/pkg/apis/management/zz_generated.deepcopy.go +++ b/vendor/github.com/loft-sh/api/v3/pkg/apis/management/zz_generated.deepcopy.go @@ -2205,6 +2205,99 @@ func (in *ConnectorWithName) DeepCopy() *ConnectorWithName { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConvertVirtualClusterConfig) DeepCopyInto(out *ConvertVirtualClusterConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConvertVirtualClusterConfig. +func (in *ConvertVirtualClusterConfig) DeepCopy() *ConvertVirtualClusterConfig { + if in == nil { + return nil + } + out := new(ConvertVirtualClusterConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConvertVirtualClusterConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConvertVirtualClusterConfigList) DeepCopyInto(out *ConvertVirtualClusterConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ConvertVirtualClusterConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConvertVirtualClusterConfigList. +func (in *ConvertVirtualClusterConfigList) DeepCopy() *ConvertVirtualClusterConfigList { + if in == nil { + return nil + } + out := new(ConvertVirtualClusterConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConvertVirtualClusterConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConvertVirtualClusterConfigSpec) DeepCopyInto(out *ConvertVirtualClusterConfigSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConvertVirtualClusterConfigSpec. +func (in *ConvertVirtualClusterConfigSpec) DeepCopy() *ConvertVirtualClusterConfigSpec { + if in == nil { + return nil + } + out := new(ConvertVirtualClusterConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConvertVirtualClusterConfigStatus) DeepCopyInto(out *ConvertVirtualClusterConfigStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConvertVirtualClusterConfigStatus. +func (in *ConvertVirtualClusterConfigStatus) DeepCopy() *ConvertVirtualClusterConfigStatus { + if in == nil { + return nil + } + out := new(ConvertVirtualClusterConfigStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DevPodDeleteOptions) DeepCopyInto(out *DevPodDeleteOptions) { *out = *in @@ -3788,105 +3881,6 @@ func (in *OwnedAccessKeyStatus) DeepCopy() *OwnedAccessKeyStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PolicyViolation) DeepCopyInto(out *PolicyViolation) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyViolation. -func (in *PolicyViolation) DeepCopy() *PolicyViolation { - if in == nil { - return nil - } - out := new(PolicyViolation) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PolicyViolation) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PolicyViolationList) DeepCopyInto(out *PolicyViolationList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]PolicyViolation, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyViolationList. -func (in *PolicyViolationList) DeepCopy() *PolicyViolationList { - if in == nil { - return nil - } - out := new(PolicyViolationList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PolicyViolationList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PolicyViolationSpec) DeepCopyInto(out *PolicyViolationSpec) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyViolationSpec. -func (in *PolicyViolationSpec) DeepCopy() *PolicyViolationSpec { - if in == nil { - return nil - } - out := new(PolicyViolationSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PolicyViolationStatus) DeepCopyInto(out *PolicyViolationStatus) { - *out = *in - if in.User != nil { - in, out := &in.User, &out.User - *out = new(clusterv1.EntityInfo) - **out = **in - } - in.Violation.DeepCopyInto(&out.Violation) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyViolationStatus. -func (in *PolicyViolationStatus) DeepCopy() *PolicyViolationStatus { - if in == nil { - return nil - } - out := new(PolicyViolationStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PredefinedApp) DeepCopyInto(out *PredefinedApp) { *out = *in diff --git a/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/accesskey_types.go b/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/accesskey_types.go index affa82193e..19da8fd986 100644 --- a/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/accesskey_types.go +++ b/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/accesskey_types.go @@ -105,10 +105,9 @@ type AccessKeySpec struct { } type AccessKeyScope struct { - // AllowLoftCLI allows certain read-only management requests to - // make sure loft cli works correctly with this specific access key. + // Roles is a set of managed permissions to apply to the access key. // +optional - AllowLoftCLI bool `json:"allowLoftCli,omitempty"` + Roles []AccessKeyScopeRole `json:"roles,omitempty"` // Projects specifies the projects the access key should have access to. // +optional @@ -130,8 +129,56 @@ type AccessKeyScope struct { // Rules specifies the rules that should apply to the access key. // +optional Rules []AccessKeyScopeRule `json:"rules,omitempty"` + + // AllowLoftCLI allows certain read-only management requests to + // make sure loft cli works correctly with this specific access key. + // + // Deprecated: Use the `roles` field instead + // ```yaml + // # Example: + // roles: + // - role: loftCLI + // ``` + // +optional + AllowLoftCLI bool `json:"allowLoftCli,omitempty"` } +func (a AccessKeyScope) ContainsRole(val AccessKeyScopeRoleName) bool { + if a.AllowLoftCLI && val == AccessKeyScopeRoleLoftCLI { + return true + } + + for _, entry := range a.Roles { + if entry.Role == val { + return true + } + + // (ThomasK33): As the vcluster role implicitly allows network peering + // add a dedicated role check here + if entry.Role == AccessKeyScopeRoleVCluster && val == AccessKeyScopeRoleNetworkPeer { + return true + } + } + + return false +} + +type AccessKeyScopeRole struct { + // Role is the name of the role to apply to the access key scope. + // +optional + Role AccessKeyScopeRoleName `json:"role,omitempty"` +} + +// AccessKeyScopeRoleName is the role name for a given scope +// +enum +type AccessKeyScopeRoleName string + +const ( + AccessKeyScopeRoleVCluster AccessKeyScopeRoleName = "vcluster" + AccessKeyScopeRoleNetworkPeer AccessKeyScopeRoleName = "network-peer" + AccessKeyScopeRoleLoftCLI AccessKeyScopeRoleName = "loft-cli" +) + type AccessKeyScopeCluster struct { // Cluster is the name of the cluster to access. You can specify * to select all clusters. // +optional diff --git a/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/devpodworkspacetemplate_types.go b/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/devpodworkspacetemplate_types.go index b5ace38fbc..b983160c1e 100644 --- a/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/devpodworkspacetemplate_types.go +++ b/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/devpodworkspacetemplate_types.go @@ -83,15 +83,15 @@ type DevPodWorkspaceTemplateDefinition struct { // Provider holds the DevPod provider configuration Provider DevPodWorkspaceProvider `json:"provider"` - // SpaceTemplate is the space that should get created for this DevPod. If this is specified, the - // Kubernetes provider will be selected automatically. + // SpaceTemplateRef is a reference to the space that should get created for this DevPod. + // If this is specified, the kubernetes provider will be selected automatically. // +optional - SpaceTemplate *TemplateRef `json:"spaceTemplate,omitempty"` + SpaceTemplateRef *TemplateRef `json:"spaceTemplateRef,omitempty"` - // VirtualClusterTemplate is the virtual cluster that should get created for this DevPod. If this is specified, the - // Kubernetes provider will be selected automatically. + // SpaceTemplate is the inline template for a space that should get created for this DevPod. + // If this is specified, the kubernetes provider will be selected automatically. // +optional - VirtualClusterTemplate *TemplateRef `json:"virtualClusterTemplate,omitempty"` + SpaceTemplate *SpaceTemplateDefinition `json:"spaceTemplate,omitempty"` // WorkspaceEnv are environment variables that should be available within the created workspace. // +optional diff --git a/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/project_types.go b/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/project_types.go index 4cbfcc38e0..6083272be0 100644 --- a/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/project_types.go +++ b/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/project_types.go @@ -516,8 +516,13 @@ type SyncMembersSpec struct { } type DevPodProjectSpec struct { + // Git defines additional git related settings like credentials // +optional Git *GitProjectSpec `json:"git,omitempty"` + + // FallbackImage defines an image all workspace will fall back to if no devcontainer.json could be detected + // +optional + FallbackImage string `json:"fallbackImage,omitempty"` } type GitProjectSpec struct { diff --git a/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/virtualclusterinstance_types.go b/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/virtualclusterinstance_types.go index 4ee4d10373..6700d6b7f5 100644 --- a/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/virtualclusterinstance_types.go +++ b/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/virtualclusterinstance_types.go @@ -15,6 +15,8 @@ const ( InstanceVirtualClusterReady agentstoragev1.ConditionType = "VirtualClusterReady" InstanceProjectsSecretsSynced agentstoragev1.ConditionType = "ProjectSecretsSynced" + InstanceVirtualClusterAppsAndObjectsSynced agentstoragev1.ConditionType = "VirtualClusterAppsAndObjectsSynced" + // Workload VirtualCluster conditions InstanceWorkloadSpaceSynced agentstoragev1.ConditionType = "WorkloadSpaceSynced" @@ -24,16 +26,14 @@ const ( InstanceWorkloadVirtualClusterReady agentstoragev1.ConditionType = "WorkloadVirtualClusterReady" ) -var ( - VirtualClusterConditions = []agentstoragev1.ConditionType{ - InstanceScheduled, - InstanceTemplateResolved, - InstanceSpaceSynced, - InstanceSpaceReady, - InstanceVirtualClusterSynced, - InstanceVirtualClusterReady, - } -) +var VirtualClusterConditions = []agentstoragev1.ConditionType{ + InstanceScheduled, + InstanceTemplateResolved, + InstanceSpaceSynced, + InstanceSpaceReady, + InstanceVirtualClusterSynced, + InstanceVirtualClusterReady, +} // +genclient // +genclient:noStatus @@ -118,6 +118,12 @@ type VirtualClusterInstanceSpec struct { // Access to the virtual cluster object itself // +optional Access []Access `json:"access,omitempty"` + + // NetworkPeer specifies if the cluster is connected via tailscale. + // When this is specified, the vCluster will not be scheduled to any connected cluster + // and no templates will be applied to it. + // +optional + NetworkPeer bool `json:"networkPeer,omitempty"` } type VirtualClusterInstanceStatus struct { diff --git a/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/zz_generated.deepcopy.go b/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/zz_generated.deepcopy.go index 52389e1212..2d4edf234d 100644 --- a/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/zz_generated.deepcopy.go +++ b/vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/zz_generated.deepcopy.go @@ -189,6 +189,11 @@ func (in *AccessKeyOIDCProvider) DeepCopy() *AccessKeyOIDCProvider { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AccessKeyScope) DeepCopyInto(out *AccessKeyScope) { *out = *in + if in.Roles != nil { + in, out := &in.Roles, &out.Roles + *out = make([]AccessKeyScopeRole, len(*in)) + copy(*out, *in) + } if in.Projects != nil { in, out := &in.Projects, &out.Projects *out = make([]AccessKeyScopeProject, len(*in)) @@ -261,6 +266,22 @@ func (in *AccessKeyScopeProject) DeepCopy() *AccessKeyScopeProject { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AccessKeyScopeRole) DeepCopyInto(out *AccessKeyScopeRole) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AccessKeyScopeRole. +func (in *AccessKeyScopeRole) DeepCopy() *AccessKeyScopeRole { + if in == nil { + return nil + } + out := new(AccessKeyScopeRole) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AccessKeyScopeRule) DeepCopyInto(out *AccessKeyScopeRule) { *out = *in @@ -1727,15 +1748,15 @@ func (in *DevPodWorkspaceTemplate) DeepCopyObject() runtime.Object { func (in *DevPodWorkspaceTemplateDefinition) DeepCopyInto(out *DevPodWorkspaceTemplateDefinition) { *out = *in in.Provider.DeepCopyInto(&out.Provider) - if in.SpaceTemplate != nil { - in, out := &in.SpaceTemplate, &out.SpaceTemplate + if in.SpaceTemplateRef != nil { + in, out := &in.SpaceTemplateRef, &out.SpaceTemplateRef *out = new(TemplateRef) **out = **in } - if in.VirtualClusterTemplate != nil { - in, out := &in.VirtualClusterTemplate, &out.VirtualClusterTemplate - *out = new(TemplateRef) - **out = **in + if in.SpaceTemplate != nil { + in, out := &in.SpaceTemplate, &out.SpaceTemplate + *out = new(SpaceTemplateDefinition) + (*in).DeepCopyInto(*out) } if in.WorkspaceEnv != nil { in, out := &in.WorkspaceEnv, &out.WorkspaceEnv diff --git a/vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/convertvirtualclusterconfig.go b/vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/convertvirtualclusterconfig.go new file mode 100644 index 0000000000..167b39cd04 --- /dev/null +++ b/vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/convertvirtualclusterconfig.go @@ -0,0 +1,168 @@ +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + "time" + + v1 "github.com/loft-sh/api/v3/pkg/apis/management/v1" + scheme "github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ConvertVirtualClusterConfigsGetter has a method to return a ConvertVirtualClusterConfigInterface. +// A group's client should implement this interface. +type ConvertVirtualClusterConfigsGetter interface { + ConvertVirtualClusterConfigs() ConvertVirtualClusterConfigInterface +} + +// ConvertVirtualClusterConfigInterface has methods to work with ConvertVirtualClusterConfig resources. +type ConvertVirtualClusterConfigInterface interface { + Create(ctx context.Context, convertVirtualClusterConfig *v1.ConvertVirtualClusterConfig, opts metav1.CreateOptions) (*v1.ConvertVirtualClusterConfig, error) + Update(ctx context.Context, convertVirtualClusterConfig *v1.ConvertVirtualClusterConfig, opts metav1.UpdateOptions) (*v1.ConvertVirtualClusterConfig, error) + UpdateStatus(ctx context.Context, convertVirtualClusterConfig *v1.ConvertVirtualClusterConfig, opts metav1.UpdateOptions) (*v1.ConvertVirtualClusterConfig, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ConvertVirtualClusterConfig, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ConvertVirtualClusterConfigList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ConvertVirtualClusterConfig, err error) + ConvertVirtualClusterConfigExpansion +} + +// convertVirtualClusterConfigs implements ConvertVirtualClusterConfigInterface +type convertVirtualClusterConfigs struct { + client rest.Interface +} + +// newConvertVirtualClusterConfigs returns a ConvertVirtualClusterConfigs +func newConvertVirtualClusterConfigs(c *ManagementV1Client) *convertVirtualClusterConfigs { + return &convertVirtualClusterConfigs{ + client: c.RESTClient(), + } +} + +// Get takes name of the convertVirtualClusterConfig, and returns the corresponding convertVirtualClusterConfig object, and an error if there is any. +func (c *convertVirtualClusterConfigs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ConvertVirtualClusterConfig, err error) { + result = &v1.ConvertVirtualClusterConfig{} + err = c.client.Get(). + Resource("convertvirtualclusterconfigs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ConvertVirtualClusterConfigs that match those selectors. +func (c *convertVirtualClusterConfigs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ConvertVirtualClusterConfigList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ConvertVirtualClusterConfigList{} + err = c.client.Get(). + Resource("convertvirtualclusterconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested convertVirtualClusterConfigs. +func (c *convertVirtualClusterConfigs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("convertvirtualclusterconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a convertVirtualClusterConfig and creates it. Returns the server's representation of the convertVirtualClusterConfig, and an error, if there is any. +func (c *convertVirtualClusterConfigs) Create(ctx context.Context, convertVirtualClusterConfig *v1.ConvertVirtualClusterConfig, opts metav1.CreateOptions) (result *v1.ConvertVirtualClusterConfig, err error) { + result = &v1.ConvertVirtualClusterConfig{} + err = c.client.Post(). + Resource("convertvirtualclusterconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(convertVirtualClusterConfig). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a convertVirtualClusterConfig and updates it. Returns the server's representation of the convertVirtualClusterConfig, and an error, if there is any. +func (c *convertVirtualClusterConfigs) Update(ctx context.Context, convertVirtualClusterConfig *v1.ConvertVirtualClusterConfig, opts metav1.UpdateOptions) (result *v1.ConvertVirtualClusterConfig, err error) { + result = &v1.ConvertVirtualClusterConfig{} + err = c.client.Put(). + Resource("convertvirtualclusterconfigs"). + Name(convertVirtualClusterConfig.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(convertVirtualClusterConfig). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *convertVirtualClusterConfigs) UpdateStatus(ctx context.Context, convertVirtualClusterConfig *v1.ConvertVirtualClusterConfig, opts metav1.UpdateOptions) (result *v1.ConvertVirtualClusterConfig, err error) { + result = &v1.ConvertVirtualClusterConfig{} + err = c.client.Put(). + Resource("convertvirtualclusterconfigs"). + Name(convertVirtualClusterConfig.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(convertVirtualClusterConfig). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the convertVirtualClusterConfig and deletes it. Returns an error if one occurs. +func (c *convertVirtualClusterConfigs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("convertvirtualclusterconfigs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *convertVirtualClusterConfigs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("convertvirtualclusterconfigs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched convertVirtualClusterConfig. +func (c *convertVirtualClusterConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ConvertVirtualClusterConfig, err error) { + result = &v1.ConvertVirtualClusterConfig{} + err = c.client.Patch(pt). + Resource("convertvirtualclusterconfigs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/generated_expansion.go b/vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/generated_expansion.go index c1baa7f979..4627cd0687 100644 --- a/vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/generated_expansion.go +++ b/vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/generated_expansion.go @@ -20,6 +20,8 @@ type ClusterRoleTemplateExpansion interface{} type ConfigExpansion interface{} +type ConvertVirtualClusterConfigExpansion interface{} + type DevPodWorkspaceInstanceExpansion interface{} type DevPodWorkspaceTemplateExpansion interface{} @@ -40,8 +42,6 @@ type LoftUpgradeExpansion interface{} type OwnedAccessKeyExpansion interface{} -type PolicyViolationExpansion interface{} - type ProjectExpansion interface{} type ProjectSecretExpansion interface{} diff --git a/vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/management_client.go b/vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/management_client.go index 26afb356c3..92d5f47286 100644 --- a/vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/management_client.go +++ b/vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/management_client.go @@ -21,6 +21,7 @@ type ManagementV1Interface interface { ClusterConnectsGetter ClusterRoleTemplatesGetter ConfigsGetter + ConvertVirtualClusterConfigsGetter DevPodWorkspaceInstancesGetter DevPodWorkspaceTemplatesGetter DirectClusterEndpointTokensGetter @@ -31,7 +32,6 @@ type ManagementV1Interface interface { LicenseTokensGetter LoftUpgradesGetter OwnedAccessKeysGetter - PolicyViolationsGetter ProjectsGetter ProjectSecretsGetter RedirectTokensGetter @@ -92,6 +92,10 @@ func (c *ManagementV1Client) Configs() ConfigInterface { return newConfigs(c) } +func (c *ManagementV1Client) ConvertVirtualClusterConfigs() ConvertVirtualClusterConfigInterface { + return newConvertVirtualClusterConfigs(c) +} + func (c *ManagementV1Client) DevPodWorkspaceInstances(namespace string) DevPodWorkspaceInstanceInterface { return newDevPodWorkspaceInstances(c, namespace) } @@ -132,10 +136,6 @@ func (c *ManagementV1Client) OwnedAccessKeys() OwnedAccessKeyInterface { return newOwnedAccessKeys(c) } -func (c *ManagementV1Client) PolicyViolations() PolicyViolationInterface { - return newPolicyViolations(c) -} - func (c *ManagementV1Client) Projects() ProjectInterface { return newProjects(c) } diff --git a/vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/policyviolation.go b/vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/policyviolation.go deleted file mode 100644 index acea4dd000..0000000000 --- a/vendor/github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/typed/management/v1/policyviolation.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/loft-sh/api/v3/pkg/apis/management/v1" - scheme "github.com/loft-sh/api/v3/pkg/client/clientset_generated/clientset/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// PolicyViolationsGetter has a method to return a PolicyViolationInterface. -// A group's client should implement this interface. -type PolicyViolationsGetter interface { - PolicyViolations() PolicyViolationInterface -} - -// PolicyViolationInterface has methods to work with PolicyViolation resources. -type PolicyViolationInterface interface { - Create(ctx context.Context, policyViolation *v1.PolicyViolation, opts metav1.CreateOptions) (*v1.PolicyViolation, error) - Update(ctx context.Context, policyViolation *v1.PolicyViolation, opts metav1.UpdateOptions) (*v1.PolicyViolation, error) - UpdateStatus(ctx context.Context, policyViolation *v1.PolicyViolation, opts metav1.UpdateOptions) (*v1.PolicyViolation, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.PolicyViolation, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.PolicyViolationList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PolicyViolation, err error) - PolicyViolationExpansion -} - -// policyViolations implements PolicyViolationInterface -type policyViolations struct { - client rest.Interface -} - -// newPolicyViolations returns a PolicyViolations -func newPolicyViolations(c *ManagementV1Client) *policyViolations { - return &policyViolations{ - client: c.RESTClient(), - } -} - -// Get takes name of the policyViolation, and returns the corresponding policyViolation object, and an error if there is any. -func (c *policyViolations) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PolicyViolation, err error) { - result = &v1.PolicyViolation{} - err = c.client.Get(). - Resource("policyviolations"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of PolicyViolations that match those selectors. -func (c *policyViolations) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PolicyViolationList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.PolicyViolationList{} - err = c.client.Get(). - Resource("policyviolations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested policyViolations. -func (c *policyViolations) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("policyviolations"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a policyViolation and creates it. Returns the server's representation of the policyViolation, and an error, if there is any. -func (c *policyViolations) Create(ctx context.Context, policyViolation *v1.PolicyViolation, opts metav1.CreateOptions) (result *v1.PolicyViolation, err error) { - result = &v1.PolicyViolation{} - err = c.client.Post(). - Resource("policyviolations"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(policyViolation). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a policyViolation and updates it. Returns the server's representation of the policyViolation, and an error, if there is any. -func (c *policyViolations) Update(ctx context.Context, policyViolation *v1.PolicyViolation, opts metav1.UpdateOptions) (result *v1.PolicyViolation, err error) { - result = &v1.PolicyViolation{} - err = c.client.Put(). - Resource("policyviolations"). - Name(policyViolation.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(policyViolation). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *policyViolations) UpdateStatus(ctx context.Context, policyViolation *v1.PolicyViolation, opts metav1.UpdateOptions) (result *v1.PolicyViolation, err error) { - result = &v1.PolicyViolation{} - err = c.client.Put(). - Resource("policyviolations"). - Name(policyViolation.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(policyViolation). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the policyViolation and deletes it. Returns an error if one occurs. -func (c *policyViolations) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("policyviolations"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *policyViolations) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("policyviolations"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched policyViolation. -func (c *policyViolations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PolicyViolation, err error) { - result = &v1.PolicyViolation{} - err = c.client.Patch(pt). - Resource("policyviolations"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd/devpod/rebuild.go b/vendor/github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd/devpod/rebuild.go index 7b18c61d62..f1c5327e9a 100644 --- a/vendor/github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd/devpod/rebuild.go +++ b/vendor/github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd/devpod/rebuild.go @@ -80,7 +80,6 @@ func (cmd *RebuildCmd) Run(ctx context.Context, args []string) error { if err != nil { return err } - // TODO: needs git credentials and configure logging _, err = remotecommand.ExecuteConn(ctx, conn, os.Stdin, os.Stdout, os.Stderr, cmd.Log.ErrorStreamOnly()) if err != nil { diff --git a/vendor/github.com/loft-sh/loftctl/v3/pkg/client/config.go b/vendor/github.com/loft-sh/loftctl/v3/pkg/client/config.go index 786e5f7ac9..0ebc14f37e 100644 --- a/vendor/github.com/loft-sh/loftctl/v3/pkg/client/config.go +++ b/vendor/github.com/loft-sh/loftctl/v3/pkg/client/config.go @@ -26,6 +26,10 @@ type Config struct { // +optional AccessKey string `json:"accesskey,omitempty"` + // virtual cluster access key is the access key for the given loft host to create virtual clusters + // +optional + VirtualClusterAccessKey string `json:"virtualClusterAccessKey,omitempty"` + // DEPRECATED: do not use anymore // the direct cluster endpoint token // +optional diff --git a/vendor/modules.txt b/vendor/modules.txt index 59add269f9..8a45c9a25b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -346,8 +346,8 @@ github.com/liggitt/tabwriter # github.com/loft-sh/admin-apis v0.0.0-20240203010124-3600c1c582a8 ## explicit; go 1.21.1 github.com/loft-sh/admin-apis/pkg/licenseapi -# github.com/loft-sh/agentapi/v3 v3.4.5 -## explicit; go 1.21.5 +# github.com/loft-sh/agentapi/v3 v3.4.6-beta.0 +## explicit; go 1.22.2 github.com/loft-sh/agentapi/v3/pkg/apis/loft/cluster github.com/loft-sh/agentapi/v3/pkg/apis/loft/cluster/v1 github.com/loft-sh/agentapi/v3/pkg/apis/loft/storage/v1 @@ -358,8 +358,8 @@ github.com/loft-sh/agentapi/v3/pkg/client/loft/clientset_generated/clientset/typ # github.com/loft-sh/analytics-client v0.0.0-20240219162240-2f4c64b2494e ## explicit; go 1.21 github.com/loft-sh/analytics-client/client -# github.com/loft-sh/api/v3 v3.4.5 -## explicit; go 1.21.5 +# github.com/loft-sh/api/v3 v3.5.0-alpha.1.0.20240426152201-dfdce426ab92 +## explicit; go 1.22.2 github.com/loft-sh/api/v3/pkg/apis/audit/v1 github.com/loft-sh/api/v3/pkg/apis/management github.com/loft-sh/api/v3/pkg/apis/management/install @@ -382,7 +382,7 @@ github.com/loft-sh/apiserver/pkg/builders # github.com/loft-sh/jspolicy v0.2.2 ## explicit; go 1.16 github.com/loft-sh/jspolicy/pkg/apis/policy/v1beta1 -# github.com/loft-sh/loftctl/v3 v3.5.0-alpha.0.0.20240425091019-24b84e25c22a +# github.com/loft-sh/loftctl/v3 v3.5.0-alpha.1.0.20240430082516-88fe061dbac1 ## explicit; go 1.22.2 github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd/connect