config

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2020 License: Apache-2.0 Imports: 16 Imported by: 315

Documentation

Index

Constants

View Source
const (
	// WantUpdateNotification is the key for WantUpdateNotification
	WantUpdateNotification = "WantUpdateNotification"
	// ReminderWaitPeriodInHours is the key for WantUpdateNotification
	ReminderWaitPeriodInHours = "ReminderWaitPeriodInHours"
	// WantReportError is the key for WantReportError
	WantReportError = "WantReportError"
	// WantReportErrorPrompt is the key for WantReportErrorPrompt
	WantReportErrorPrompt = "WantReportErrorPrompt"
	// WantKubectlDownloadMsg is the key for WantKubectlDownloadMsg
	WantKubectlDownloadMsg = "WantKubectlDownloadMsg"
	// WantNoneDriverWarning is the key for WantNoneDriverWarning
	WantNoneDriverWarning = "WantNoneDriverWarning"
	// MachineProfile is the key for MachineProfile
	MachineProfile = "profile"
	// ShowDriverDeprecationNotification is the key for ShowDriverDeprecationNotification
	ShowDriverDeprecationNotification = "ShowDriverDeprecationNotification"
	// ShowBootstrapperDeprecationNotification is the key for ShowBootstrapperDeprecationNotification
	ShowBootstrapperDeprecationNotification = "ShowBootstrapperDeprecationNotification"
)

Variables

View Source
var (
	// ErrKeyNotFound is the error returned when a key doesn't exist in the config file
	ErrKeyNotFound = errors.New("specified key could not be found in config")
)

Functions

func AddNode added in v1.7.0

func AddNode(cc *MachineConfig, name string, controlPlane bool, k8sVersion string, profileName string) error

AddNode adds a new node config to an existing cluster.

func ContainsParam added in v1.4.0

func ContainsParam(slice []string, s string) bool

ContainsParam checks if a given slice of strings contains the provided string. If a modifier func is provided, it is called with the slice item before the comparison.

func CreateEmptyProfile added in v1.4.0

func CreateEmptyProfile(name string, miniHome ...string) error

CreateEmptyProfile creates an empty profile and stores in $MINIKUBE_HOME/profiles/<profilename>/config.json

func DeleteProfile added in v1.4.0

func DeleteProfile(profile string, miniHome ...string) error

DeleteProfile deletes a profile and removes the profile dir

func Get added in v0.12.0

func Get(name string) (string, error)

Get gets a named value from config

func IsNotExist added in v1.7.0

func IsNotExist(err error) bool

IsNotExist returns whether the error means a nonexistent configuration

func ListProfiles added in v1.3.0

func ListProfiles(miniHome ...string) (validPs []*Profile, inValidPs []*Profile, err error)

ListProfiles returns all valid and invalid (if any) minikube profiles invalidPs are the profiles that have a directory or config file but not usable invalidPs would be suggested to be deleted

func ProfileExists added in v1.4.0

func ProfileExists(name string, miniHome ...string) bool

ProfileExists returns true if there is a profile config (regardless of being valid)

func ProfileFolderPath added in v1.5.0

func ProfileFolderPath(profile string, miniHome ...string) string

ProfileFolderPath returns path of profile folder

func ProfileNameInReservedKeywords added in v1.5.0

func ProfileNameInReservedKeywords(name string) bool

ProfileNameInReservedKeywords checks if the profile is an internal keywords

func SaveProfile added in v1.7.0

func SaveProfile(name string, cfg *MachineConfig, miniHome ...string) error

SaveProfile creates an profile out of the cfg and stores in $MINIKUBE_HOME/profiles/<profilename>/config.json

func Write added in v1.7.0

func Write(profile string, cc *MachineConfig) error

Write writes the kubernetes and machine config for the current machine

func WriteConfig added in v1.3.1

func WriteConfig(configFile string, m MinikubeConfig) error

WriteConfig writes a minikube config to the JSON file

Types

type ComponentExtraOptionMap added in v1.4.0

type ComponentExtraOptionMap map[string]map[string]string

ComponentExtraOptionMap maps components to their extra opts, which is a map of keys to values

func (ComponentExtraOptionMap) Get added in v1.4.0

func (cm ComponentExtraOptionMap) Get(component string) map[string]string

Get returns the extra option map of keys to values for the specified component

type ErrNotExist added in v1.7.0

type ErrNotExist struct {
	// contains filtered or unexported fields
}

func (*ErrNotExist) Error added in v1.7.0

func (e *ErrNotExist) Error() string

type ExtraOption added in v1.4.0

type ExtraOption struct {
	Component string
	Key       string
	Value     string
}

ExtraOption is an extra option

func (*ExtraOption) String added in v1.4.0

func (e *ExtraOption) String() string

type ExtraOptionSlice added in v1.4.0

type ExtraOptionSlice []ExtraOption

ExtraOptionSlice is a slice of ExtraOption

func (*ExtraOptionSlice) AsMap added in v1.4.0

AsMap converts the slice to a map of components to a map of keys and values.

func (*ExtraOptionSlice) Get added in v1.4.0

func (es *ExtraOptionSlice) Get(key string, component ...string) string

Get finds and returns the value of an argument with the specified key and component (optional) or an empty string if not found. If component contains more than one value, the value for the first component found is returned. If component is not specified, all of the components are used.

func (*ExtraOptionSlice) Set added in v1.4.0

func (es *ExtraOptionSlice) Set(value string) error

Set parses the string value into a slice

func (*ExtraOptionSlice) String added in v1.4.0

func (es *ExtraOptionSlice) String() string

String converts the slice to a string value

func (*ExtraOptionSlice) Type added in v1.4.0

func (es *ExtraOptionSlice) Type() string

Type returns the type

type KubernetesConfig added in v0.26.0

type KubernetesConfig struct {
	KubernetesVersion string
	APIServerName     string
	APIServerNames    []string
	APIServerIPs      []net.IP
	DNSDomain         string
	ContainerRuntime  string
	CRISocket         string
	NetworkPlugin     string
	FeatureGates      string // https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/
	ServiceCIDR       string // the subnet which kubernetes services will be deployed to
	ImageRepository   string
	ExtraOptions      ExtraOptionSlice

	ShouldLoadCachedImages bool
	EnableDefaultCNI       bool
}

KubernetesConfig contains the parameters used to configure the VM Kubernetes.

type Loader added in v0.31.0

type Loader interface {
	LoadConfigFromFile(profile string, miniHome ...string) (*MachineConfig, error)
	WriteConfigToFile(profileName string, cc *MachineConfig, miniHome ...string) error
}

Loader loads the kubernetes and machine config based on the machine profile name

var DefaultLoader Loader = &simpleConfigLoader{}

DefaultLoader is the default config loader

type MachineConfig added in v0.26.0

type MachineConfig struct {
	Name                string
	KeepContext         bool // used by start and profile command to or not to switch kubectl's current context
	EmbedCerts          bool // used by kubeconfig.Setup
	MinikubeISO         string
	Memory              int
	CPUs                int
	DiskSize            int
	VMDriver            string
	HyperkitVpnKitSock  string   // Only used by the Hyperkit driver
	HyperkitVSockPorts  []string // Only used by the Hyperkit driver
	DockerEnv           []string // Each entry is formatted as KEY=VALUE.
	InsecureRegistry    []string
	RegistryMirror      []string
	HostOnlyCIDR        string // Only used by the virtualbox driver
	HypervVirtualSwitch string
	KVMNetwork          string             // Only used by the KVM driver
	KVMQemuURI          string             // Only used by kvm2
	KVMGPU              bool               // Only used by kvm2
	KVMHidden           bool               // Only used by kvm2
	Downloader          util.ISODownloader `json:"-"`
	DockerOpt           []string           // Each entry is formatted as KEY=VALUE.
	DisableDriverMounts bool               // Only used by virtualbox
	NFSShare            []string
	NFSSharesRoot       string
	UUID                string // Only used by hyperkit to restore the mac address
	NoVTXCheck          bool   // Only used by virtualbox
	DNSProxy            bool   // Only used by virtualbox
	HostDNSResolver     bool   // Only used by virtualbox
	HostOnlyNicType     string // Only used by virtualbox
	NatNicType          string // Only used by virtualbox
	KubernetesConfig    KubernetesConfig
	Nodes               []Node
	Addons              map[string]bool
}

MachineConfig contains the parameters used to start a cluster.

func Load added in v0.31.0

func Load(profile string) (*MachineConfig, error)

Load loads the kubernetes and machine config for the current machine

type MinikubeConfig added in v0.12.0

type MinikubeConfig map[string]interface{}

MinikubeConfig represents minikube config

func ReadConfig added in v0.12.0

func ReadConfig(configFile string) (MinikubeConfig, error)

ReadConfig reads in the JSON minikube config

type Node added in v1.7.0

type Node struct {
	Name              string
	IP                string
	Port              int
	KubernetesVersion string
	ControlPlane      bool
	Worker            bool
}

Node contains information about specific nodes in a cluster

func PrimaryControlPlane added in v1.7.0

func PrimaryControlPlane(cc MachineConfig) (Node, error)

PrimaryControlPlane gets the node specific config for the first created control plane

type Profile added in v1.3.0

type Profile struct {
	Name   string
	Status string // running, stopped
	Config *MachineConfig
}

Profile represents a minikube profile

func LoadProfile added in v1.5.0

func LoadProfile(name string, miniHome ...string) (*Profile, error)

LoadProfile loads type Profile based on its name

func (*Profile) IsValid added in v1.5.0

func (p *Profile) IsValid() bool

IsValid checks if the profile has the essential info needed for a profile

type VersionedExtraOption added in v1.4.0

type VersionedExtraOption struct {

	// The flag and component that will be set
	Option ExtraOption

	// This flag will only be applied to versions before or equal to this version
	// If it is the default value, it will have no upper bound on versions the
	// flag is applied to
	LessThanOrEqual semver.Version

	// The flag will only be applied to versions after or equal to this version
	// If it is the default value, it will have no lower bound on versions the
	// flag is applied to
	GreaterThanOrEqual semver.Version
}

VersionedExtraOption holds information on flags to apply to a specific range of versions

func NewUnversionedOption added in v1.4.0

func NewUnversionedOption(component, k, v string) VersionedExtraOption

NewUnversionedOption returns a VersionedExtraOption that applies to all versions.

Jump to

Keyboard shortcuts

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