config

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 16 Imported by: 278

Documentation

Index

Constants

View Source
const (
	// WantUpdateNotification is the key for WantUpdateNotification
	WantUpdateNotification = "WantUpdateNotification"
	// WantBetaUpdateNotification is the key for WantBetaUpdateNotification
	WantBetaUpdateNotification = "WantBetaUpdateNotification"
	// ReminderWaitPeriodInHours is the key for ReminderWaitPeriodInHours
	ReminderWaitPeriodInHours = "ReminderWaitPeriodInHours"
	// WantNoneDriverWarning is the key for WantNoneDriverWarning
	WantNoneDriverWarning = "WantNoneDriverWarning"
	// WantVirtualBoxDriverWarning is the key for WantVirtualBoxDriverWarning
	WantVirtualBoxDriverWarning = "WantVirtualBoxDriverWarning"
	// ProfileName represents the key for the global profile parameter
	ProfileName = "profile"
	// UserFlag is the key for the global user flag (ex. --user=user1)
	UserFlag = "user"
	// Rootless is the key for the global rootless parameter (boolean)
	Rootless = "rootless"
	// AddonImages stores custom addon images config
	AddonImages = "addon-images"
	// AddonRegistries stores custom addon images config
	AddonRegistries = "addon-registries"
	// AddonListFlag represents the key for addons parameter
	AddonListFlag = "addons"
	// EmbedCerts represents the config for embedding certificates in kubeconfig
	EmbedCerts = "EmbedCerts"
	// MaxAuditEntries is the maximum number of audit entries to retain
	MaxAuditEntries = "MaxAuditEntries"
)

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")
	// DockerEnv contains the environment variables
	DockerEnv []string
	// DockerOpt contains the option parameters
	DockerOpt []string
	// ExtraOptions contains extra options (if any)
	ExtraOptions ExtraOptionSlice
)
View Source
var DockerContainers = func() ([]string, error) {
	return oci.ListOwnedContainers(oci.Docker)
}

DockerContainers lists all containers created by docker driver

Functions

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 IsPermissionDenied added in v1.14.0

func IsPermissionDenied(err error) bool

IsPermissionDenied returns whether the error is a ErrPermissionDenied instance

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 MachineName added in v1.17.0

func MachineName(cc ClusterConfig, n Node) string

MachineName returns the name of the machine, as seen by the hypervisor given the cluster and node names

func MultiNode added in v1.10.0

func MultiNode(cc ClusterConfig) bool

MultiNode returns true if the cluster has multiple nodes or if the request is asking for multinode

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 ProfileNameValid added in v1.10.0

func ProfileNameValid(name string) bool

ProfileNameValid checks if the profile name is container name and DNS hostname/label friendly.

func SaveNode added in v1.9.0

func SaveNode(cfg *ClusterConfig, node *Node) error

SaveNode saves a node to a cluster

func SaveProfile added in v1.7.0

func SaveProfile(name string, cfg *ClusterConfig, 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 *ClusterConfig) 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 ClusterConfig added in v1.8.0

type ClusterConfig 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 // ISO used for VM-drivers.
	KicBaseImage            string // base-image used for docker/podman drivers.
	Memory                  int
	CPUs                    int
	DiskSize                int
	VMDriver                string // Legacy use only
	Driver                  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.
	ContainerVolumeMounts   []string // Only used by container drivers: Docker, Podman
	InsecureRegistry        []string
	RegistryMirror          []string
	HostOnlyCIDR            string // Only used by the virtualbox driver
	HypervVirtualSwitch     string
	HypervUseExternalSwitch bool
	HypervExternalAdapter   string
	KVMNetwork              string // Only used by the KVM2 driver
	KVMQemuURI              string // Only used by the KVM2 driver
	KVMGPU                  bool   // Only used by the KVM2 driver
	KVMHidden               bool   // Only used by the KVM2 driver
	KVMNUMACount            int    // Only used by the KVM2 driver
	APIServerPort           int
	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
	SSHIPAddress            string // Only used by ssh driver
	SSHUser                 string // Only used by ssh driver
	SSHKey                  string // Only used by ssh driver
	SSHPort                 int    // Only used by ssh driver
	KubernetesConfig        KubernetesConfig
	Nodes                   []Node
	Addons                  map[string]bool
	CustomAddonImages       map[string]string // Maps image names to the image to use for addons. e.g. Dashboard -> k8s.gcr.io/echoserver:1.4 makes dashboard addon use echoserver for its Dashboard deployment.
	CustomAddonRegistries   map[string]string // Maps image names to the registry to use for addons. See CustomAddonImages for example.
	VerifyComponents        map[string]bool   // map of components to verify and wait for after start.
	StartHostTimeout        time.Duration
	ScheduledStop           *ScheduledStopConfig
	ExposedPorts            []string // Only used by the docker and podman driver
	ListenAddress           string   // Only used by the docker and podman driver
	Network                 string   // only used by docker driver
	Subnet                  string   // only used by the docker and podman driver
	MultiNodeRequested      bool
	ExtraDisks              int // currently only implemented for hyperkit and kvm2
	CertExpiration          time.Duration
	Mount                   bool
	MountString             string
	Mount9PVersion          string
	MountGID                string
	MountIP                 string
	MountMSize              int
	MountOptions            []string
	MountPort               uint16
	MountType               string
	MountUID                string
	BinaryMirror            string // Mirror location for kube binaries (kubectl, kubelet, & kubeadm)
	DisableOptimizations    bool
	DisableMetrics          bool
	CustomQemuFirmwarePath  string
}

ClusterConfig contains the parameters used to start a cluster.

func Load added in v0.31.0

func Load(profile string, miniHome ...string) (*ClusterConfig, error)

Load loads the Kubernetes and machine config for the current machine

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
}

ErrNotExist is the error returned when a config does not exist

func (*ErrNotExist) Error added in v1.7.0

func (e *ErrNotExist) Error() string

type ErrPermissionDenied added in v1.14.0

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

ErrPermissionDenied is the error returned when the config cannot be read due to insufficient permissions

func (*ErrPermissionDenied) Error added in v1.14.0

func (e *ErrPermissionDenied) 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) Exists added in v1.12.1

func (es *ExtraOptionSlice) Exists(value string) bool

Exists returns true if component.key (parsed from value) is already in ExtraOptionSlice

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
	ClusterName         string
	Namespace           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
	LoadBalancerStartIP string // currently only used by MetalLB addon
	LoadBalancerEndIP   string // currently only used by MetalLB addon
	CustomIngressCert   string // used by Ingress addon
	RegistryAliases     string // currently only used by registry-aliases addon
	ExtraOptions        ExtraOptionSlice

	ShouldLoadCachedImages bool

	EnableDefaultCNI bool   // deprecated in preference to CNI
	CNI              string // CNI to use

	// We need to keep these in the short term for backwards compatibility
	NodeIP   string
	NodePort int
	NodeName string
}

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) (*ClusterConfig, error)
	WriteConfigToFile(profileName string, cc *ClusterConfig, 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 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
	ContainerRuntime  string
	ControlPlane      bool
	Worker            bool
}

Node contains information about specific nodes in a cluster

func PrimaryControlPlane added in v1.7.0

func PrimaryControlPlane(cc *ClusterConfig) (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, paused, unknown
	Config *ClusterConfig
	Active bool
}

Profile represents a minikube profile

func ListValidProfiles added in v1.18.0

func ListValidProfiles(miniHome ...string) (ps []*Profile, err error)

ListValidProfiles returns profiles in minikube home dir Unlike `ListProfiles` this function doesn't try to get profile from container

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 ScheduledStopConfig added in v1.15.0

type ScheduledStopConfig struct {
	InitiationTime int64
	Duration       time.Duration
}

ScheduledStopConfig contains information around scheduled stop not yet used, will be used to show status of scheduled stop

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