Skip to content

Commit

Permalink
add util: new KubeConfig struct
Browse files Browse the repository at this point in the history
  • Loading branch information
neargle committed Oct 28, 2024
1 parent 5940304 commit fdd8dd7
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions pkg/util/kubectl.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
package util

type KubeConfig struct {
APIVersion string `yaml:"apiVersion"`
Clusters []Cluster `yaml:"clusters"`
Contexts []Context `yaml:"contexts"`
CurrentContext string `yaml:"current-context"`
Kind string `yaml:"kind"`
Preferences struct{} `yaml:"preferences"`
Users []User `yaml:"users"`
}

type Cluster struct {
Cluster ClusterInfo `yaml:"cluster"`
Name string `yaml:"name"`
}

type ClusterInfo struct {
CertificateAuthorityData string `yaml:"certificate-authority-data"`
Server string `yaml:"server"`
}

type Context struct {
Context ContextInfo `yaml:"context"`
Name string `yaml:"name"`
}

type ContextInfo struct {
Cluster string `yaml:"cluster"`
User string `yaml:"user"`
}

type User struct {
Name string `yaml:"name"`
User UserInfo `yaml:"user"`
}

type UserInfo struct {
ClientCertificateData string `yaml:"client-certificate-data"`
ClientKeyData string `yaml:"client-key-data"`
}

func RunKubectlCmd(args ...string) (string, error) {
var stdoutStr string
var err error
Expand Down

0 comments on commit fdd8dd7

Please sign in to comment.