machinery

package
v0.0.0-...-e9fdbb8 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AutoResolver = &autoResolver{}
View Source
var ErrAlreadyInitialized = errors.New("already initialized")
View Source
var ErrItemAlreadyExists = errors.New("an item with this name already exists")
View Source
var ErrKubeconfigDoesNotExist = errors.New("KUBECONFIG environment variable is set to a nonexistent file")
View Source
var ErrMultipleKubeconfigs = errors.New("KUBECONFIG environment variable contains more than one path")
View Source
var ErrRemoteDataNotFound = errors.New("remote cache does not exist")
View Source
var ErrVaultNoKVMount = errors.New("kv secret engine is not enabled in vault")
View Source
var ErrVaultNotInitialized = errors.New("vault is not initialized")
View Source
var ErrVaultSealed = errors.New("vault is sealed")

Functions

func AuthInfosEqual

func AuthInfosEqual(a, b *api.AuthInfo) bool

func ClustersEqual

func ClustersEqual(a, b *api.Cluster) bool

func DefaultKubeconfigPath

func DefaultKubeconfigPath() string

func DotKitPath

func DotKitPath() string

func FindKubeconfigStore

func FindKubeconfigStore() (string, error)

func InitLocal

func InitLocal(remote string) error

func InitRemote

func InitRemote(client *RemoteClient) error

func IsAlreadyInitialized

func IsAlreadyInitialized(err error) bool

func IsNotFound

func IsNotFound(err error) bool

func KitConfigPath

func KitConfigPath() string

func RemoteCacheExists

func RemoteCacheExists() bool

func RemoteCachePath

func RemoteCachePath() string

Types

type ChangeType

type ChangeType int
const (
	// A new kubeconfig was added and does not interfere with any existing ones
	ChangeTypeNew ChangeType = 1 << iota

	// A kubeconfig was renamed but otherwise has no conflicts
	ChangeTypeRename

	// An existing kubeconfig was removed
	ChangeTypeDelete

	// A new kubeconfig completely replaces an existing one
	ChangeTypeReplace

	// A new kubeconfig completely replaces an existing one
	ChangeTypeModify

	// Some additional things need to be taken care of
	ChangeTypeComplex
)

type ComplexDiffType

type ComplexDiffType int
const (
	ComplexDiffTypeNone ComplexDiffType = 0

	// The server URL has been changed
	ComplexDiffServerChanged ComplexDiffType = 1 << iota

	// The user auth info has changed
	ComplexDiffUserAuthChanged

	// The cluster CA has changed
	ComplexDiffClusterCAChanged

	// The preferences have changed (this field is currently unused)
	ComplexDiffPreferencesChanged

	// The kubeconfig needs to be renamed as it conflicts with an existing one
	ComplexDiffRenameRequired
)

type ConflictResolver

type ConflictResolver interface {
	Rename(kind string, oldName string, validator func(string) error) string
}

type Diff

type Diff struct {
	Items []DiffItem
}

func ComputeDiff

func ComputeDiff(existing *api.Config, incoming *api.Config) (*Diff, error)

func ComputeIncomingDiff

func ComputeIncomingDiff(config *KitConfig, client *RemoteClient) (*Diff, error)

func (*Diff) Apply

func (d *Diff) Apply(existing, incoming *api.Config, handler ConflictResolver) error

type DiffItem

type DiffItem struct {
	AffectedIncoming NamedContext
	AffectedExisting NamedContext
	ChangeType       ChangeType
	Complex          ComplexDiffType
}

type KitConfig

type KitConfig struct {
	RemoteURL      string `json:"remoteUrl"`
	KubeconfigPath string `json:"kubeconfigPath"`
}

func ReadConfig

func ReadConfig() (*KitConfig, error)

func (*KitConfig) WriteToDisk

func (c *KitConfig) WriteToDisk() error

type LocalData

type LocalData struct {
	Config *api.Config
}

func ReadLocalData

func ReadLocalData(conf *KitConfig) (*LocalData, error)

type NamedContext

type NamedContext struct {
	*api.Context
	Name string
}

func NamedContextFrom

func NamedContextFrom(contexts map[string]*api.Context, name string) NamedContext

func NewNamedContext

func NewNamedContext(name string, context *api.Context) NamedContext

type RemoteCache

type RemoteCache struct {
	Latest  api.Config   `json:"latest"`
	History []api.Config `json:"history"`
}

func ReadRemoteCache

func ReadRemoteCache() (*RemoteCache, error)

func (*RemoteCache) WriteToDisk

func (cache *RemoteCache) WriteToDisk() error

type RemoteClient

type RemoteClient struct {
	VaultConfig *vaultapi.Config
	VaultClient *vaultapi.Client
}

func NewRemoteClient

func NewRemoteClient(config *KitConfig) (*RemoteClient, error)

func (*RemoteClient) CheckConnection

func (r *RemoteClient) CheckConnection() error

func (*RemoteClient) CreateKitMount

func (r *RemoteClient) CreateKitMount() error

func (*RemoteClient) KitMountExists

func (r *RemoteClient) KitMountExists() (bool, error)

func (*RemoteClient) LoadRemoteData

func (r *RemoteClient) LoadRemoteData() (*RemoteCache, error)

Jump to

Keyboard shortcuts

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