Skip to content

Commit

Permalink
kubectl-kcp: readd parent logic dropped in rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
sttts committed Mar 10, 2022
1 parent d61eddc commit 1960353
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/cliplugins/workspace/plugin/kubeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,12 @@ func (kc *KubeConfig) ensureWorkspaceDirectoryContextExists(options *Options, pa
} else if org == "system:" {
return nil, fmt.Errorf("no workspaces are accessible from %s", clusterName)
} else if org == tenancyhelpers.RootCluster {
// already in an org workspace
orgClusterName = clusterName
if parent {
orgClusterName = tenancyhelpers.RootCluster
} else {
// already in an org workspace
orgClusterName = clusterName
}
} else {
// some other workspace, return org cluster name
orgClusterName, err = tenancyhelpers.ParentClusterName(clusterName)
Expand Down Expand Up @@ -252,7 +256,7 @@ func (kc *KubeConfig) UseWorkspace(ctx context.Context, opts *Options, workspace

kc.startingConfig.CurrentContext = workspaceContextName

if err := write(opts, fmt.Sprintf("Current workspace is \"%s\".\n", workspaceName)); err != nil {
if err := write(opts, fmt.Sprintf("Current workspace is %q.\n", workspaceName)); err != nil {
return err
}
return clientcmd.ModifyConfig(kc.configAccess, *kc.startingConfig, true)
Expand Down

0 comments on commit 1960353

Please sign in to comment.