Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
anujc25 committed Jan 19, 2024
1 parent 7673f90 commit 3affdb0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions config/tanzu_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ func TestGetKubeconfigForContext(t *testing.T) {
_, err = GetKubeconfigForContext(nonTanzuCtx.Name, ForProject("project2"))
assert.Error(t, err)
assert.ErrorContains(t, err, "context must be of type: tanzu")

// Test getting the kubeconfig for a custom endpoint path
tanzuCtx, err := GetContext("test-tanzu")
assert.NoError(t, err)
kubeconfigBytes, err = GetKubeconfigForContext(tanzuCtx.Name, ForCustomPath("/custom-path"))
assert.NoError(t, err)
err = yaml.Unmarshal(kubeconfigBytes, &kc)
assert.NoError(t, err)
cluster = kubeconfig.GetCluster(&kc, "tanzu-cli-mytanzu/current")
assert.Equal(t, cluster.Cluster.Server, tanzuCtx.GlobalOpts.Endpoint+"/custom-path")
}

func TestGetTanzuContextActiveResource(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion config/types/clientconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ type KubernetesDiscovery struct {
Path string `json:"path,omitempty" yaml:"path,omitempty"`
// The context to use (if required), defaults to current.
Context string `json:"context,omitempty" yaml:"context,omitempty"`
// The bytes with the entire kube configuration
// KubeConfigBytes is the entire kube configuration
// Note: Either Path or KubeConfigBytes should be configured and not both
KubeConfigBytes []byte `json:"kubeConfigBytes,omitempty" yaml:"kubeConfigBytes,omitempty"`
// Version of the CLIPlugins API to query.
// E.g., v1alpha1
Expand Down

0 comments on commit 3affdb0

Please sign in to comment.