Documentation ¶
Index ¶
- Constants
- func CopyFileContent(src, dst string) (err error)
- func GetBackupFilePath(cmd *cobra.Command) (string, error)
- func GetKubeconfigPath(cmd *cobra.Command) (string, error)
- func GetOutputFilePath(cmd *cobra.Command) (string, error)
- func PrettyPrint(k Kubeconfig)
- type Cluster
- type ClusterEntry
- type Context
- type ContextEntry
- type Extension
- type ExtensionEntry
- type Kubeconfig
- type Preferences
- type User
- type UserEntry
Constants ¶
const DefaultBackupFolder = ".konfig"
DefaultBackupFolder is path where backups are stored
const DefaultKubeconfigFile = "config"
DefaultKubeconfigFile is default backup file name
const DefaultKubeconfigFolder = ".kube"
DefaultKubeconfigFolder is path where kubectl config is stored by default
const OptionBackup = "backup"
OptionBackup is cli flag name for setting custom backup file
const OptionKubeconfig = "kubeconfig"
OptionKubeconfig is cli flag name for setting custom kubeconfig file
const OptionOutput = "output"
OptionOutput is cli flag name for setting custom output file
Variables ¶
This section is empty.
Functions ¶
func CopyFileContent ¶
CopyFileContent copies file content from src to dst If file exist, it gives it new uniq name prefix
func GetBackupFilePath ¶
GetBackupFilePath returns valid path to backup according to cmd flags & defaults
func GetKubeconfigPath ¶
GetKubeconfigPath returns valid path to kubeconfig according to cmd flags & defaults
func GetOutputFilePath ¶
GetOutputFilePath returns valid path to output file according to cmd flags & defaults
Types ¶
type Cluster ¶
type Cluster struct { Server string `yaml:"server"` CertificateAuthorityData string `yaml:"certificate-authority-data"` Extensions []ExtensionEntry `yaml:"extensions"` CertificateAuthority string `yaml:"certificate-authority"` }
Cluster represents k8s cluster section of kubectl config file
type ClusterEntry ¶
ClusterEntry represents list of clusters in kubectl config file
type ContextEntry ¶
ContextEntry represents list of contexts in kubectl config file
type Extension ¶
type Extension struct { Provider string `yaml:"provider"` Version string `yaml:"version"` LastUpdate string `yaml:"last-update"` }
Extension represents k8s extension section of kubectl config file
type ExtensionEntry ¶
ExtensionEntry represents list of extensions in kubectl config file
type Kubeconfig ¶
type Kubeconfig struct { APIVersion string `yaml:"apiVersion"` Kind string `yaml:"kind"` Clusters []ClusterEntry `yaml:"clusters"` Contexts []ContextEntry `yaml:"contexts"` CurrentContext string `yaml:"current-context"` Users []UserEntry `yaml:"users"` Preferences Preferences `yaml:"preferences"` }
Kubeconfig represents kubectl config file
func Merge ¶
func Merge(MainConf, ExtraConf Kubeconfig) (Kubeconfig, error)
Merge merges two kubeconfigs. If error happens, it always returns main config, which is assumed to be always correct, in order to continue working, because fails during merge kubeconfigs are assumed as normal usage of program
func ReadConf ¶
func ReadConf(path string) (Kubeconfig, error)
ReadConf is a helper func for reading kubeconfig files
type Preferences ¶
type Preferences struct{}
Preferences represents k8s preferences section of kubectl config file