Documentation ¶
Index ¶
- Constants
- Variables
- func AddToLocal(newConfig *clientcmdapi.Config, path, contextPrefix string, cover bool, ...) error
- func BoolUI(label string) string
- func CheckAndTransformDirPath(path string) (string, error)
- func CheckAndTransformFilePath(path string, autoCreate bool) (string, error)
- func CheckNamespaceExist(namespace string, clientset kubernetes.Interface) (bool, error)
- func CheckValidContext(clear bool, config *clientcmdapi.Config) *clientcmdapi.Config
- func GetClientSet(configFile string) (kubernetes.Interface, error)
- func Hash(data string) string
- func HashSuf(config *clientcmdapi.Config) string
- func HashSufString(data string) string
- func IsFile(path string) bool
- func MacNotifier(msg string) error
- func MoreInfo(clientSet kubernetes.Interface, writer io.Writer) error
- func PrintTable(config *clientcmdapi.Config) error
- func PromptUI(label string, name string) string
- func SelectUI(kubeItems []Needle, label string) int
- func UpdateConfigFile(file string, updateConfig *clientcmdapi.Config) error
- func WriteConfig(cover bool, file string, outConfig *clientcmdapi.Config) error
- type AddCommand
- type AliasCommand
- type BaseCommand
- type ClearCommand
- type Cli
- type CloudAddCommand
- type CloudCommand
- type CloudInfo
- type CloudListCommand
- type ClusterStatusCheck
- type Command
- type CompletionCommand
- type CreateCommand
- type CreateOptions
- type DeleteCommand
- type DocsCommand
- type ExportCommand
- type KubeConfigOption
- type ListCommand
- type MergeCommand
- type NamespaceCommand
- type Namespaces
- type Needle
- type PromptRunner
- type RenameCommand
- type SelectRunner
- type SwitchCommand
- type VersionCommand
Constants ¶
const ( Filename = "filename" Context = "context" User = "user" Cluster = "cluster" Namespace = "namespace" )
const SourceCmd = "[[ ! -f ~/.kubecm ]] || source ~/.kubecm"
SourceCmd source command
Variables ¶
var Clouds = []CloudInfo{ { Name: "AlibabaCloud", Alias: []string{"alibabacloud", "alicloud", "aliyun", "ack"}, HomePage: "https://cs.console.aliyun.com", Service: "ACK", }, { Name: "TencentCloud", Alias: []string{"tencentcloud", "tencent", "tke"}, HomePage: "https://console.cloud.tencent.com/tke", Service: "TKE", }, { Name: "Rancher", Alias: []string{"rancher"}, HomePage: "https://rancher.com", Service: "Rancher", }, { Name: "AWS", Alias: []string{"aws", "eks"}, HomePage: "https://console.aws.amazon.com/eks/home", Service: "EKS", }, { Name: "Azure", Alias: []string{"azure", "aks"}, HomePage: "https://portal.azure.com", Service: "AKS", }, }
Clouds date of clouds
var DOCS = "https://kubecm.cloud/"
Functions ¶
func AddToLocal ¶ added in v0.16.0
func AddToLocal(newConfig *clientcmdapi.Config, path, contextPrefix string, cover bool, selectContext bool, contextTemplate []string, context []string, insecureSkipTLSVerify bool) error
AddToLocal add kubeConfig to local
func CheckAndTransformDirPath ¶ added in v0.30.0
CheckAndTransformFilePath return converted path
func CheckAndTransformFilePath ¶ added in v0.12.0
CheckAndTransformFilePath return converted path
func CheckNamespaceExist ¶ added in v0.27.1
func CheckNamespaceExist(namespace string, clientset kubernetes.Interface) (bool, error)
CheckNamespaceExist check namespace exist
func CheckValidContext ¶ added in v0.13.0
func CheckValidContext(clear bool, config *clientcmdapi.Config) *clientcmdapi.Config
CheckValidContext check and clean mismatched AuthInfo and Cluster
func GetClientSet ¶ added in v0.27.1
func GetClientSet(configFile string) (kubernetes.Interface, error)
GetClientSet return clientset
func HashSuf ¶ added in v0.3.0
func HashSuf(config *clientcmdapi.Config) string
HashSuf return the string of kubeconfig.
func HashSufString ¶ added in v0.14.0
HashSufString return the string of HashSuf.
func MacNotifier ¶ added in v0.20.0
MacNotifier send notify message in macOS
func MoreInfo ¶ added in v0.15.0
func MoreInfo(clientSet kubernetes.Interface, writer io.Writer) error
MoreInfo output more info
func PrintTable ¶ added in v0.13.0
func PrintTable(config *clientcmdapi.Config) error
PrintTable generate table
func UpdateConfigFile ¶ added in v0.13.0
func UpdateConfigFile(file string, updateConfig *clientcmdapi.Config) error
UpdateConfigFile update kubeconfig
func WriteConfig ¶ added in v0.3.0
func WriteConfig(cover bool, file string, outConfig *clientcmdapi.Config) error
WriteConfig write kubeconfig
Types ¶
type AddCommand ¶ added in v0.7.0
type AddCommand struct {
BaseCommand
}
AddCommand add command struct
type AliasCommand ¶ added in v0.10.0
type AliasCommand struct {
BaseCommand
}
AliasCommand alias command struct
type BaseCommand ¶ added in v0.10.1
type BaseCommand struct {
// contains filtered or unexported fields
}
BaseCommand struct
func (*BaseCommand) AddCommands ¶ added in v0.10.4
func (bc *BaseCommand) AddCommands(children ...Command)
AddCommands adds children commands to the parent command
func (*BaseCommand) CobraCmd ¶ added in v0.10.1
func (bc *BaseCommand) CobraCmd() *cobra.Command
CobraCmd returns BaseCommand
func (*BaseCommand) Name ¶ added in v0.10.1
func (bc *BaseCommand) Name() string
Name returns name of BaseCommand
type ClearCommand ¶ added in v0.13.0
type ClearCommand struct {
BaseCommand
}
ClearCommand clean command struct
type Cli ¶ added in v0.7.0
type Cli struct {
// contains filtered or unexported fields
}
Cli cmd struct
type CloudAddCommand ¶ added in v0.19.0
type CloudAddCommand struct {
CloudCommand
}
CloudAddCommand add command struct
type CloudCommand ¶ added in v0.16.0
type CloudCommand struct {
BaseCommand
}
CloudCommand cloud command struct
type CloudListCommand ¶ added in v0.19.0
type CloudListCommand struct {
CloudCommand
}
CloudListCommand add command struct
type ClusterStatusCheck ¶ added in v0.20.0
type ClusterStatusCheck struct { Version *v.Info ClientSet *kubernetes.Clientset Config *rest.Config }
ClusterStatusCheck check cluster status
func ClusterStatus ¶ added in v0.2.1
func ClusterStatus(duration time.Duration) (*ClusterStatusCheck, error)
ClusterStatus output cluster status
type CompletionCommand ¶ added in v0.7.0
type CompletionCommand struct {
BaseCommand
}
CompletionCommand completion cmd struct
func (*CompletionCommand) Init ¶ added in v0.7.0
func (cc *CompletionCommand) Init()
Init CompletionCommand
type CreateCommand ¶ added in v0.15.0
type CreateCommand struct {
BaseCommand
}
CreateCommand clean command struct
type CreateOptions ¶ added in v0.15.0
type CreateOptions struct {
// contains filtered or unexported fields
}
type DeleteCommand ¶ added in v0.7.0
type DeleteCommand struct {
BaseCommand
}
DeleteCommand delete cmd struct
type DocsCommand ¶ added in v0.27.0
type DocsCommand struct {
BaseCommand
}
type ExportCommand ¶ added in v0.24.0
type ExportCommand struct {
BaseCommand
}
AddCommand add command struct
type KubeConfigOption ¶ added in v0.14.0
type KubeConfigOption struct {
// contains filtered or unexported fields
}
KubeConfigOption kubeConfig option
type ListCommand ¶ added in v0.9.0
type ListCommand struct {
BaseCommand
}
ListCommand list cmd struct
type MergeCommand ¶ added in v0.7.0
type MergeCommand struct {
BaseCommand
}
MergeCommand merge cmd struct
type NamespaceCommand ¶ added in v0.8.0
type NamespaceCommand struct {
BaseCommand
}
NamespaceCommand namespace cmd struct
func (*NamespaceCommand) Init ¶ added in v0.8.0
func (nc *NamespaceCommand) Init()
Init NamespaceCommand
type Namespaces ¶ added in v0.10.1
Namespaces namespaces struct
func GetNamespaceList ¶ added in v0.8.0
func GetNamespaceList(currentNamespace string, clientset kubernetes.Interface) ([]Namespaces, error)
GetNamespaceList return namespace list
type Needle ¶ added in v0.10.1
Needle use for switch
func ExitOption ¶ added in v0.7.4
ExitOption exit option of SelectUI
type PromptRunner ¶ added in v0.22.1
PromptRunner interface - For better unit testing
type RenameCommand ¶ added in v0.7.0
type RenameCommand struct {
BaseCommand
}
RenameCommand rename cmd struce
type SelectRunner ¶ added in v0.22.1
SelectRunner interface - For better unit testing
type SwitchCommand ¶ added in v0.7.0
type SwitchCommand struct {
BaseCommand
}
SwitchCommand switch cmd struct
type VersionCommand ¶ added in v0.7.0
type VersionCommand struct {
BaseCommand
}
VersionCommand version cmd struct