remove debugging
parent
5ddf54b32f
commit
ed03df5b0a
|
@ -106,7 +106,6 @@ func Endpoint(contextName string, configPath ...string) (string, int, error) {
|
|||
|
||||
// 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) {
|
||||
fmt.Println("insude update endpoint")
|
||||
if hostname == "" {
|
||||
return false, fmt.Errorf("empty ip")
|
||||
}
|
||||
|
@ -138,10 +137,7 @@ func UpdateEndpoint(contextName string, hostname string, port int, confpath stri
|
|||
KeepContext: false,
|
||||
}
|
||||
if ext != nil {
|
||||
|
||||
kcs.ExtensionCluster = ext
|
||||
} else {
|
||||
fmt.Println("extension is niLL update Endpoint")
|
||||
}
|
||||
err = PopulateFromSettings(kcs, cfg)
|
||||
if err != nil {
|
||||
|
|
|
@ -183,6 +183,28 @@ users:
|
|||
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) {
|
||||
setupCfg := &Settings{
|
||||
ClusterName: "test",
|
||||
|
|
|
@ -17,10 +17,8 @@ limitations under the License.
|
|||
package kubeconfig
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"runtime/debug"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/juju/mutex"
|
||||
|
@ -95,10 +93,7 @@ func PopulateFromSettings(cfg *Settings, apiCfg *api.Config) error {
|
|||
|
||||
if cfg.ExtensionCluster != nil {
|
||||
cluster.Extensions = map[string]runtime.Object{"cluster_info": cfg.ExtensionCluster.DeepCopy()}
|
||||
} else {
|
||||
fmt.Println("extension cluster is niLL populate")
|
||||
}
|
||||
|
||||
apiCfg.Clusters[clusterName] = cluster
|
||||
|
||||
// user
|
||||
|
@ -127,9 +122,6 @@ func PopulateFromSettings(cfg *Settings, apiCfg *api.Config) error {
|
|||
context.AuthInfo = userName
|
||||
if cfg.ExtensionContext != nil {
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue