kc

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package kc manage local kubeconfig file

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete added in v0.1.3

func Delete(kubeconfig string)

Delete delete a context from kubeconfig

func GetContext added in v0.1.4

func GetContext(kubeconfig string)

GetContext get a context want

func Ls added in v0.1.3

func Ls(kubeconfig string)

Ls show the context list

func Merge added in v0.1.2

func Merge(src, kubeconfig string)

Merge merge kubeconfig

func Namespace added in v0.1.3

func Namespace(kubeconfig, namespace string)

Namespace switch default work namespace

func Show

func Show(kubeconfig string)

Show show the context

func Switch added in v0.1.2

func Switch(kubeconfig, cluster string, ns bool)

Switch switch context for kubeconfig

Types

type AuthInfo

type AuthInfo struct {
	Name string                 `json:"name"`
	User *clientcmdapi.AuthInfo `json:"user"`
}

AuthInfo k8sconfig user object

type Cluster

type Cluster struct {
	Name    string                `json:"name"`
	Cluster *clientcmdapi.Cluster `json:"cluster"`
}

Cluster k8s cluster object

type Context

type Context struct {
	Name    string                `json:"name"`
	Context *clientcmdapi.Context `json:"context"`
}

Context k8s context object

type KubeConfig

type KubeConfig struct {
	Kind           string     `json:"kind,omitempty"`
	APIVersion     string     `json:"apiVersion,omitempty"`
	Clusters       []Cluster  `json:"clusters"`
	AuthInfos      []AuthInfo `json:"users"`
	Contexts       []Context  `json:"contexts"`
	CurrentContext string     `json:"current-context"`
}

KubeConfig kubeconfig object

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL