pkg

package
v0.0.0-...-4620744 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoArgs = iota
	Dir
	File
	Paste
	Remove
	NS
)
View Source
const KONTEXT_FILE = "KONTEXT_FILE"

Variables

View Source
var Args struct {
	Paste  bool   `short:"p" long:"paste" description:"Adds context from clipboard"`
	File   string `short:"f" long:"file" description:"Adds the context from the given FILE" value-name:"FILE"`
	Dir    string `short:"d" long:"directory" description:"Adds the contexts from yaml files in the given DIR" value-name:"DIR"`
	Remove string `short:"r" long:"remove" description:"Removes the given CONTEXT-NAME from the config" value-name:"CONTEXT-NAME"`
	NS     string `short:"n" long:"namespace" description:"Sets the given NAMESPACE as the default ns" value-name:"NAMESPACE"`
}
View Source
var CLEAR = "\033[0m"
View Source
var CMD = NoArgs
View Source
var DefaultConfigFileName string
View Source
var GREEN = "\033[32m"
View Source
var IS_DEBUG = true
View Source
var RED = "\033[31m"
View Source
var YELLOW = "\033[33m   "

Functions

func AddNamespace

func AddNamespace()

func Commit

func Commit(doBackup bool)

func Debug

func Debug(v ...interface{})

func DeleteContext

func DeleteContext(deleteContext string) bool

func Directory

func Directory()

func Error

func Error(v ...interface{})

func Fatal

func Fatal(v ...interface{})

func Info

func Info(v ...interface{})

func ListDefaultContexts

func ListDefaultContexts() (contexts []string, currentContext string)

func MergeContexts

func MergeContexts(newConfig *Config)

func NoArgsRun

func NoArgsRun()

func OneFile

func OneFile()

func PasteFromClipboard

func PasteFromClipboard()

func ReadDefaultConfig

func ReadDefaultConfig()

func RemoveContext

func RemoveContext()

func Warn

func Warn(v ...interface{})

Types

type Cluster

type Cluster struct {
	CertificateAuthorityData string `yaml:"certificate-authority-data,omitempty"`
	CertificateAuthority     string `yaml:"certificate-authority,omitempty"`
	Server                   string `yaml:"server"`
}

type Config

type Config struct {
	ApiVersion     string         `yaml:"apiVersion"`
	Kind           string         `yaml:"kind"`
	Preferences    Preferences    `yaml:"preferences"`
	Clusters       []NamedCluster `yaml:"clusters,omitempty"`
	Contexts       []NamedContext `yaml:"contexts"`
	CurrentContext string         `yaml:"current-context"`
	Users          []NamedUser    `yaml:"users"`
}
var DefaultConfig *Config

func ReadConfig

func ReadConfig(configFileName string) (config *Config, err error)

func ReadDir

func ReadDir(dirName string) (configs []*Config)

type Context

type Context struct {
	Cluster   string `yaml:"cluster"`
	User      string `yaml:"user"`
	Namespace string `yaml:"namespace,omitempty"`
}

type Exec

type Exec struct {
	ApiVersion string      `yaml:"apiVersion"`
	Args       []string    `yaml:"args"`
	Command    string      `yaml:"command"`
	Env        interface{} `yaml:"env"`
}

type NamedCluster

type NamedCluster struct {
	*Cluster `yaml:"cluster,omitempty"`
	Name     string `yaml:"name"`
}

func GetClusterByName

func GetClusterByName(cName string, config *Config) *NamedCluster

type NamedContext

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

func GetContextByName

func GetContextByName(cName string, config *Config) *NamedContext

type NamedUser

type NamedUser struct {
	Name  string `yaml:"name"`
	*User `yaml:"user,omitempty"`
}

func GetUserByName

func GetUserByName(cName string, config *Config) *NamedUser

type Preferences

type Preferences struct {
}

type User

type User struct {
	Token                 string `yaml:"token,omitempty"`
	ClientCertificate     string `yaml:"client-certificate,omitempty"`
	ClientKey             string `yaml:"client-key,omitempty"`
	ClientCertificateData string `yaml:"client-certificate-data,omitempty"`
	ClientKeyData         string `yaml:"client-key-data,omitempty"`
	*Exec                 `yaml:"exec,omitempty"`
}

Jump to

Keyboard shortcuts

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