internal

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBackupFolder = ".konfig"

DefaultBackupFolder is path where backups are stored

View Source
const DefaultKubeconfigFile = "config"

DefaultKubeconfigFile is default backup file name

View Source
const DefaultKubeconfigFolder = ".kube"

DefaultKubeconfigFolder is path where kubectl config is stored by default

View Source
const OptionBackup = "backup"

OptionBackup is cli flag name for setting custom backup file

View Source
const OptionKubeconfig = "kubeconfig"

OptionKubeconfig is cli flag name for setting custom kubeconfig file

View Source
const OptionOutput = "output"

OptionOutput is cli flag name for setting custom output file

Variables

This section is empty.

Functions

func CopyFileContent

func CopyFileContent(src, dst string) (err error)

CopyFileContent copies file content from src to dst If file exist, it gives it new uniq name prefix

func GetBackupFilePath

func GetBackupFilePath(cmd *cobra.Command) (string, error)

GetBackupFilePath returns valid path to backup according to cmd flags & defaults

func GetKubeconfigPath

func GetKubeconfigPath(cmd *cobra.Command) (string, error)

GetKubeconfigPath returns valid path to kubeconfig according to cmd flags & defaults

func GetOutputFilePath

func GetOutputFilePath(cmd *cobra.Command) (string, error)

GetOutputFilePath returns valid path to output file according to cmd flags & defaults

func PrettyPrint

func PrettyPrint(k Kubeconfig)

PrettyPrint print current kubeconfig with colors

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

type ClusterEntry struct {
	Cluster Cluster `yaml:"cluster"`
	Name    string  `yaml:"name"`
}

ClusterEntry represents list of clusters in kubectl config file

type Context

type Context struct {
	Cluster string `yaml:"cluster"`
	User    string `yaml:"user"`
}

Context represents k8s context section of kubectl config file

type ContextEntry

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

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

type ExtensionEntry struct {
	Name      string    `yaml:"name"`
	Extension Extension `yaml:"extension"`
}

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

type User

type User struct {
	ClientCertificateData string `yaml:"client-certificate-data"`
	ClientKeyData         string `yaml:"client-key-data"`
}

User represents k8s user section of kubectl config file

type UserEntry

type UserEntry struct {
	Name string `yaml:"name"`
	User User   `yaml:"user"`
}

UserEntry represents list of users in kubectl config file

Jump to

Keyboard shortcuts

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