remove debugging

pull/10126/head
Medya Gh 2021-01-12 18:49:14 -08:00
parent 5ddf54b32f
commit ed03df5b0a
3 changed files with 22 additions and 12 deletions

View File

@ -106,7 +106,6 @@ func Endpoint(contextName string, configPath ...string) (string, int, error) {
// UpdateEndpoint overwrites the IP stored in kubeconfig with the provided IP. // UpdateEndpoint overwrites the IP stored in kubeconfig with the provided IP.
func UpdateEndpoint(contextName string, hostname string, port int, confpath string, ext *Extension) (bool, error) { func UpdateEndpoint(contextName string, hostname string, port int, confpath string, ext *Extension) (bool, error) {
fmt.Println("insude update endpoint")
if hostname == "" { if hostname == "" {
return false, fmt.Errorf("empty ip") return false, fmt.Errorf("empty ip")
} }
@ -138,10 +137,7 @@ func UpdateEndpoint(contextName string, hostname string, port int, confpath stri
KeepContext: false, KeepContext: false,
} }
if ext != nil { if ext != nil {
kcs.ExtensionCluster = ext kcs.ExtensionCluster = ext
} else {
fmt.Println("extension is niLL update Endpoint")
} }
err = PopulateFromSettings(kcs, cfg) err = PopulateFromSettings(kcs, cfg)
if err != nil { if err != nil {

View File

@ -183,6 +183,28 @@ users:
client-key: /home/la-croix/.minikube/profiles/minikube/client.key client-key: /home/la-croix/.minikube/profiles/minikube/client.key
`) `)
var kubeConfigWithExtension = []byte(`
apiVersion: v1
clusters:
- cluster:
certificate-authority: /home/la-croix/.minikube/ca.crt
server: https://192.168.10.100:8080
name: minikube
contexts:
- context:
cluster: minikube
user: minikube
name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
user:
client-certificate: /home/la-croix/.minikube/profiles/minikube/client.crt
client-key: /home/la-croix/.minikube/profiles/minikube/client.key
`)
func TestUpdate(t *testing.T) { func TestUpdate(t *testing.T) {
setupCfg := &Settings{ setupCfg := &Settings{
ClusterName: "test", ClusterName: "test",

View File

@ -17,10 +17,8 @@ limitations under the License.
package kubeconfig package kubeconfig
import ( import (
"fmt"
"io/ioutil" "io/ioutil"
"path/filepath" "path/filepath"
"runtime/debug"
"sync/atomic" "sync/atomic"
"github.com/juju/mutex" "github.com/juju/mutex"
@ -95,10 +93,7 @@ func PopulateFromSettings(cfg *Settings, apiCfg *api.Config) error {
if cfg.ExtensionCluster != nil { if cfg.ExtensionCluster != nil {
cluster.Extensions = map[string]runtime.Object{"cluster_info": cfg.ExtensionCluster.DeepCopy()} cluster.Extensions = map[string]runtime.Object{"cluster_info": cfg.ExtensionCluster.DeepCopy()}
} else {
fmt.Println("extension cluster is niLL populate")
} }
apiCfg.Clusters[clusterName] = cluster apiCfg.Clusters[clusterName] = cluster
// user // user
@ -127,9 +122,6 @@ func PopulateFromSettings(cfg *Settings, apiCfg *api.Config) error {
context.AuthInfo = userName context.AuthInfo = userName
if cfg.ExtensionContext != nil { if cfg.ExtensionContext != nil {
context.Extensions = map[string]runtime.Object{"context_info": cfg.ExtensionContext.DeepCopy()} context.Extensions = map[string]runtime.Object{"context_info": cfg.ExtensionContext.DeepCopy()}
} else {
debug.PrintStack()
fmt.Println("extension context is niLL populate")
} }
apiCfg.Contexts[contextName] = context apiCfg.Contexts[contextName] = context