Skip to content

Commit

Permalink
fix: use proper config location
Browse files Browse the repository at this point in the history
Signed-off-by: Rohan CJ <rohantmp@gmail.com>
  • Loading branch information
rohantmp committed Sep 5, 2024
1 parent 29efe25 commit 16f6ebd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pkg/cli/connect_platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func ConnectPlatform(ctx context.Context, options *ConnectOptions, globalFlags *
}

// retrieve vCluster kube config
kubeConfig, err := cmd.getVClusterKubeConfig(ctx, platformClient, vCluster)
kubeConfig, err := cmd.getVClusterKubeConfig(ctx, platformClient, globalFlags, vCluster)
if err != nil {
return err
}
Expand Down Expand Up @@ -101,12 +101,12 @@ func (cmd *connectPlatform) validateProFlags() error {
return nil
}

func (cmd *connectPlatform) getVClusterKubeConfig(ctx context.Context, platformClient platform.Client, vCluster *platform.VirtualClusterInstanceProject) (*clientcmdapi.Config, error) {
func (cmd *connectPlatform) getVClusterKubeConfig(ctx context.Context, platformClient platform.Client, globalFlags *flags.GlobalFlags, vCluster *platform.VirtualClusterInstanceProject) (*clientcmdapi.Config, error) {
if vCluster == nil || vCluster.Project == nil || vCluster.VirtualCluster == nil {
return nil, errors.New("invalid vcluster VirtualClusterInstanceProject object")
}

contextOptions, err := platform.CreateVirtualClusterInstanceOptions(ctx, platformClient, "", vCluster.Project.Name, vCluster.VirtualCluster, false)
contextOptions, err := platform.CreateVirtualClusterInstanceOptions(ctx, platformClient, globalFlags.Config, vCluster.Project.Name, vCluster.VirtualCluster, false)
if err != nil {
return nil, fmt.Errorf("prepare vCluster kube config: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/create_platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func CreatePlatform(ctx context.Context, options *CreateOptions, globalFlags *fl

if options.CreateContext {
// create kube context options
contextOptions, err := platform.CreateVirtualClusterInstanceOptions(ctx, platformClient, "", options.Project, virtualClusterInstance, options.SwitchContext)
contextOptions, err := platform.CreateVirtualClusterInstanceOptions(ctx, platformClient, globalFlags.Config, options.Project, virtualClusterInstance, options.SwitchContext)
if err != nil {
return err
}
Expand Down

0 comments on commit 16f6ebd

Please sign in to comment.