Documentation
¶
Index ¶
- Variables
- func CheckOrInitConfig()
- func Client(kubeConfigFile, ctx string) (kubernetes.Interface, error)
- func ClientOrDie(kubeConfigFile, ctx string) kubernetes.Interface
- func CreateSecret(kubeClientset kubernetes.Interface, secret *v1.Secret, namespace string) *v1.Secret
- func CreateServiceAccountTokenSecret(kubeClientset kubernetes.Interface, serviceAccountName, namespace string) *v1.Secret
- func DiscoveryClient(kubeConfigFile, ctx string) (discovery.DiscoveryInterface, error)
- func GenerateConfigForServiceAccount(kubeconfig, context, namespace, serviceAccount string) *clientcmdapi.Config
- func GetSecret(kubeClientset kubernetes.Interface, secretName, namespace string) *v1.Secret
- func GetServiceAccount(kubeClientset kubernetes.Interface, serviceAccountName, namespace string) *v1.ServiceAccount
- func ListContexts(config *clientcmdapi.Config) []*types.ContextProfile
- func ListNamespaces(kubeClientset kubernetes.Interface) []string
- func ListServiceAccounts(kubeClientset kubernetes.Interface, namespace string) []string
- func LoadConfigFromFile(file string) *clientcmdapi.Config
- func NewConfig() *clientcmdapi.Config
- func PrintConfig(config *clientcmdapi.Config)
- func SaveConfigToFile(config *clientcmdapi.Config, file string)
- func ServerVersion(discoveryClient discovery.DiscoveryInterface) (string, error)
- func StandardizeConfig(config *clientcmdapi.Config)
Constants ¶
This section is empty.
Variables ¶
var ( DefaultConfigDir = filepath.Join(homedir.HomeDir(), ".kube") DefaultConfigFile = filepath.Join(DefaultConfigDir, "config") DefaultNamespace = "default" )
Functions ¶
func CheckOrInitConfig ¶
func CheckOrInitConfig()
CheckOrInitConfig checks if the kubeconfig exists, if not, create it
func Client ¶
func Client(kubeConfigFile, ctx string) (kubernetes.Interface, error)
Client creates a new kubernetes client from the given kubeconfig file and context.
func ClientOrDie ¶
func ClientOrDie(kubeConfigFile, ctx string) kubernetes.Interface
ClientOrDie creates a new kubernetes client from the given kubeconfig file and context, and panics if it fails.
func CreateSecret ¶
func CreateSecret(kubeClientset kubernetes.Interface, secret *v1.Secret, namespace string) *v1.Secret
CreateSecret creates a secret
func CreateServiceAccountTokenSecret ¶
func CreateServiceAccountTokenSecret(kubeClientset kubernetes.Interface, serviceAccountName, namespace string) *v1.Secret
CreateServiceAccountTokenSecret creates a secret for a service account
func DiscoveryClient ¶
func DiscoveryClient(kubeConfigFile, ctx string) (discovery.DiscoveryInterface, error)
DiscoveryClient creates a new kubernetes discovery client from the given kubeconfig file and context.
func GenerateConfigForServiceAccount ¶
func GenerateConfigForServiceAccount(kubeconfig, context, namespace, serviceAccount string) *clientcmdapi.Config
GenerateConfigForServiceAccount generates kubeconfig for service account
func GetSecret ¶
func GetSecret(kubeClientset kubernetes.Interface, secretName, namespace string) *v1.Secret
GetSecret returns a secret
func GetServiceAccount ¶
func GetServiceAccount(kubeClientset kubernetes.Interface, serviceAccountName, namespace string) *v1.ServiceAccount
GetServiceAccount returns a service account
func ListContexts ¶
func ListContexts(config *clientcmdapi.Config) []*types.ContextProfile
ListContexts lists all contexts in the kubeconfig
func ListNamespaces ¶
func ListNamespaces(kubeClientset kubernetes.Interface) []string
ListNamespaces returns a list of namespaces
func ListServiceAccounts ¶
func ListServiceAccounts(kubeClientset kubernetes.Interface, namespace string) []string
ListServiceAccounts returns a list of service accounts
func LoadConfigFromFile ¶
func LoadConfigFromFile(file string) *clientcmdapi.Config
LoadConfigFromFile loads the kubeconfig from the file
func SaveConfigToFile ¶
func SaveConfigToFile(config *clientcmdapi.Config, file string)
SaveConfigToFile saves the kubeconfig to the file
func ServerVersion ¶
func ServerVersion(discoveryClient discovery.DiscoveryInterface) (string, error)
ServerVersion returns the Kubernetes server version.
func StandardizeConfig ¶
func StandardizeConfig(config *clientcmdapi.Config)
StandardizeConfig standardizes the cluster and user names in the kubeconfig
Types ¶
This section is empty.