corrected how the kubeconfig info are stored in /admiralty/kubeconfig (POST)
This commit is contained in:
parent
3ae9f69525
commit
bb03307b9e
@ -484,7 +484,7 @@ func (c *AdmiraltyController) GetAdmiraltyKubeconfig() {
|
||||
return
|
||||
}
|
||||
|
||||
b, err := yaml.Marshal(kubeconfig)
|
||||
b, err := json.Marshal(kubeconfig)
|
||||
if err != nil {
|
||||
fmt.Println("Error while marshalling kubeconfig")
|
||||
c.Ctx.Output.SetStatus(500)
|
||||
@ -517,7 +517,7 @@ func NewHostKubeWithToken(token string) (*models.KubeConfigValue, error){
|
||||
{
|
||||
Name: "default",
|
||||
Cluster: models.KubeconfigCluster{
|
||||
Server: conf.GetConfig().KubeHost,
|
||||
Server: "https://" + conf.GetConfig().KubeHost + ":6443",
|
||||
CertificateAuthorityData: encodedCA,
|
||||
},
|
||||
},
|
||||
|
@ -2,55 +2,55 @@ package models
|
||||
|
||||
// KubeConfigValue is a struct used to create a kubectl configuration YAML file.
|
||||
type KubeConfigValue struct {
|
||||
APIVersion string `yaml:"apiVersion"`
|
||||
Kind string `yaml:"kind"`
|
||||
Clusters []KubeconfigNamedCluster `yaml:"clusters"`
|
||||
Users []KubeconfigUser `yaml:"users"`
|
||||
Contexts []KubeconfigNamedContext `yaml:"contexts"`
|
||||
CurrentContext string `yaml:"current-context"`
|
||||
Preferences struct{} `yaml:"preferences"`
|
||||
APIVersion string `yaml:"apiVersion" json:"apiVersion"`
|
||||
Kind string `yaml:"kind" json:"kind"`
|
||||
Clusters []KubeconfigNamedCluster `yaml:"clusters" json:"clusters"`
|
||||
Users []KubeconfigUser `yaml:"users" json:"users"`
|
||||
Contexts []KubeconfigNamedContext `yaml:"contexts" json:"contexts"`
|
||||
CurrentContext string `yaml:"current-context" json:"current-context"`
|
||||
Preferences struct{} `yaml:"preferences" json:"preferences"`
|
||||
}
|
||||
|
||||
// KubeconfigUser is a struct used to create a kubectl configuration YAML file
|
||||
type KubeconfigUser struct {
|
||||
Name string `yaml:"name"`
|
||||
User KubeconfigUserKeyPair `yaml:"user"`
|
||||
Name string `yaml:"name" json:"name"`
|
||||
User KubeconfigUserKeyPair `yaml:"user" json:"user"`
|
||||
|
||||
}
|
||||
|
||||
// KubeconfigUserKeyPair is a struct used to create a kubectl configuration YAML file
|
||||
type KubeconfigUserKeyPair struct {
|
||||
Token string `yaml:"token"`
|
||||
Token string `yaml:"token" json:"token"`
|
||||
}
|
||||
|
||||
// KubeconfigAuthProvider is a struct used to create a kubectl authentication provider
|
||||
type KubeconfigAuthProvider struct {
|
||||
Name string `yaml:"name"`
|
||||
Config map[string]string `yaml:"config"`
|
||||
Name string `yaml:"name" json:"name"`
|
||||
Config map[string]string `yaml:"config" json:"config"`
|
||||
}
|
||||
|
||||
// KubeconfigNamedCluster is a struct used to create a kubectl configuration YAML file
|
||||
type KubeconfigNamedCluster struct {
|
||||
Name string `yaml:"name"`
|
||||
Cluster KubeconfigCluster `yaml:"cluster"`
|
||||
Name string `yaml:"name" json:"name"`
|
||||
Cluster KubeconfigCluster `yaml:"cluster" json:"cluster"`
|
||||
}
|
||||
|
||||
// KubeconfigCluster is a struct used to create a kubectl configuration YAML file
|
||||
type KubeconfigCluster struct {
|
||||
Server string `yaml:"server"`
|
||||
CertificateAuthorityData string `yaml:"certificate-authority-data"`
|
||||
CertificateAuthority string `yaml:"certificate-authority"`
|
||||
Server string `yaml:"server" json:"server"`
|
||||
CertificateAuthorityData string `yaml:"certificate-authority-data" json:"certificate-authority-data"`
|
||||
CertificateAuthority string `yaml:"certificate-authority" json:"certificate-authority"`
|
||||
}
|
||||
|
||||
// KubeconfigNamedContext is a struct used to create a kubectl configuration YAML file
|
||||
type KubeconfigNamedContext struct {
|
||||
Name string `yaml:"name"`
|
||||
Context KubeconfigContext `yaml:"context"`
|
||||
Name string `yaml:"name" json:"name"`
|
||||
Context KubeconfigContext `yaml:"context" json:"context"`
|
||||
}
|
||||
|
||||
// KubeconfigContext is a struct used to create a kubectl configuration YAML file
|
||||
type KubeconfigContext struct {
|
||||
Cluster string `yaml:"cluster"`
|
||||
Namespace string `yaml:"namespace,omitempty"`
|
||||
User string `yaml:"user"`
|
||||
Cluster string `yaml:"cluster" json:"cluster"`
|
||||
Namespace string `yaml:"namespace,omitempty" json:"namespace,omitempty"`
|
||||
User string `yaml:"user" json:"user"`
|
||||
}
|
Loading…
Reference in New Issue
Block a user