func (dply *Deployment) MakeKubesConfig(user *User, configPath string, server int) error {
	config := kubes.DefaultConfig
	config.Clusters[0].Cluster.Server = dply.KubeServers[server].Server
	config.Clusters[0].Cluster.CertificateAuthority = dply.KubeServers[server].CA
	config.Contexts[0].Context.Cluster = config.Clusters[0].Name
	config.Contexts[0].Context.Namespace = dply.KubeNamespace
	config.Contexts[0].Context.User = config.Users[0].Name
	config.Users[0].User.Token = user.Token
	config.Users[0].User.ClientCertificate = user.ClientCertificate
	config.Users[0].User.ClientKey = user.ClientKey

	configPath = os.ExpandEnv(configPath)
	configDir := filepath.Dir(configPath)
	err := os.MkdirAll(configDir, os.ModePerm)
	if err != nil {
		return err
	}

	f, err := os.Create(configPath)
	if err != nil {
		return err
	}

	return yaml.NewEncoder(f).Encode(&config)
}
// MakeKubesConfig makes the kubes config
MakeKubesConfig makes the kubes config
// MakeKubesConfig makes the kubes config
func (dply *Deployment) MakeKubesConfig(user *User, configPath string, server int) error {
	config := kubes.DefaultConfig
	config.Clusters[0].Cluster.Server = dply.KubeServers[server].Server
	config.Clusters[0].Cluster.CertificateAuthority = dply.KubeServers[server].CA
	config.Contexts[0].Context.Cluster = config.Clusters[0].Name
	config.Contexts[0].Context.Namespace = dply.KubeNamespace
	config.Contexts[0].Context.User = config.Users[0].Name
	config.Users[0].User.Token = user.Token
	config.Users[0].User.ClientCertificate = user.ClientCertificate
	config.Users[0].User.ClientKey = user.ClientKey
	configPath = os.ExpandEnv(configPath)
	configDir := filepath.Dir(configPath)
	err := os.MkdirAll(configDir, os.ModePerm)
	if err != nil {
		return err
	}
	f, err := os.Create(configPath)
	if err != nil {
		return err
	}
	return yaml.NewEncoder(f).Encode(&config)
}
func ( dply * Deployment ) MakeKubesConfig ( user * User , configPath string , server int ) error { config := kubes . DefaultConfig config . Clusters [ 0 ] . Cluster . Server = dply . KubeServers [ server ] . Server config . Clusters [ 0 ] . Cluster . CertificateAuthority = dply . KubeServers [ server ] . CA config . Contexts [ 0 ] . Context . Cluster = config . Clusters [ 0 ] . Name config . Contexts [ 0 ] . Context . Namespace = dply . KubeNamespace config . Contexts [ 0 ] . Context . User = config . Users [ 0 ] . Name config . Users [ 0 ] . User . Token = user . Token config . Users [ 0 ] . User . ClientCertificate = user . ClientCertificate config . Users [ 0 ] . User . ClientKey = user . ClientKey configPath = os . ExpandEnv ( configPath ) configDir := filepath . Dir ( configPath ) err := os . MkdirAll ( configDir , os . ModePerm ) if err != nil { return err } f , err := os . Create ( configPath ) if err != nil { return err } return yaml . NewEncoder ( f ) . Encode ( & config ) }
MakeKubesConfig makes the kubes config
MakeKubesConfig makes the kubes config