Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateSizeInMB(humanReadableSize string) int
- func CanReadFile(path string) bool
- func ChownR(path string, uid, gid int) error
- func ConcatStrings(src []string, prefix string, postfix string) []string
- func ContainsString(slice []string, s string) bool
- func DeleteKubeConfigContext(kubeCfgPath, machineName string) error
- func FindAndSet(path string, c interface{}, value string) error
- func GenerateCACert(certPath, keyPath string, name string) error
- func GenerateSignedCert(certPath, keyPath, cn string, ips []net.IP, alternateDNS []string, ...) error
- func GetAlternateDNS(domain string) []string
- func GetBinaryDownloadURL(version, platform string) string
- func GetClient(kubectlContext ...string) (kubernetes.Interface, error)
- func GetDNSIP(serviceCIDR string) (net.IP, error)
- func GetKubeConfigStatus(ip net.IP, filename string, machineName string) (bool, error)
- func GetPortFromKubeConfig(filename, machineName string) (int, error)
- func GetServiceClusterIP(serviceCIDR string) (net.IP, error)
- func IsDirectory(path string) (bool, error)
- func IsRetryableAPIError(err error) bool
- func MaybeChownDirRecursiveToMinikubeUser(dir string) error
- func Pad(str string) string
- func PopulateKubeConfig(cfg *KubeConfigSetup, kubecfg *api.Config) error
- func ReadConfigOrNew(filename string) (*api.Config, error)
- func ReplaceChars(src []string, replacer *strings.Replacer) []string
- func Retry(attempts int, callback func() error) (err error)
- func RetryAfter(attempts int, callback func() error, d time.Duration) (err error)
- func SetCurrentContext(kubeCfgPath, name string) error
- func SetupKubeConfig(cfg *KubeConfigSetup) error
- func StartPods(c kubernetes.Interface, namespace string, pod core.Pod, waitForRunning bool) error
- func TeePrefix(prefix string, r io.Reader, w io.Writer, ...) error
- func UnsetCurrentContext(filename, machineName string) error
- func Until(fn func() error, w io.Writer, name string, sleep time.Duration, ...)
- func UpdateKubeconfigIP(ip net.IP, filename string, machineName string) (bool, error)
- func WaitForDeploymentToStabilize(c kubernetes.Interface, ns, name string, timeout time.Duration) error
- func WaitForEvent(c kubernetes.Interface, ns string, reason string) error
- func WaitForPodDelete(c kubernetes.Interface, ns string, label fmt.Stringer) error
- func WaitForPodsWithLabelRunning(c kubernetes.Interface, ns string, label labels.Selector) error
- func WaitForRCToStabilize(c kubernetes.Interface, ns, name string, timeout time.Duration) error
- func WaitForService(c kubernetes.Interface, namespace, name string, exist bool, ...) error
- func WaitForServiceEndpointsNum(c kubernetes.Interface, namespace, serviceName string, expectNum int, ...) error
- func WriteConfig(config *api.Config, filename string) error
- type ComponentExtraOptionMap
- type DefaultDownloader
- func (f DefaultDownloader) CacheMinikubeISOFromURL(isoURL string) error
- func (f DefaultDownloader) GetISOCacheFilepath(isoURL string) string
- func (f DefaultDownloader) GetISOFileURI(isoURL string) string
- func (f DefaultDownloader) IsMinikubeISOCached(isoURL string) bool
- func (f DefaultDownloader) ShouldCacheMinikubeISO(isoURL string) bool
- type ExtraOption
- type ExtraOptionSlice
- type ISODownloader
- type KubeConfigSetup
- type MultiError
- type PodStore
- type RetriableError
Constants ¶
const ( APIServerPort = 8443 DefaultMinikubeDirectory = "/var/lib/minikube" DefaultCertPath = DefaultMinikubeDirectory + "/certs/" DefaultKubeConfigPath = DefaultMinikubeDirectory + "/kubeconfig" DefaultDNSDomain = "cluster.local" DefaultServiceCIDR = "10.96.0.0/12" )
These constants are used by both minikube
const ErrPrefix = "! "
ErrPrefix notes an error
const OutPrefix = "> "
OutPrefix notes output
Variables ¶
var ( // ReasonableMutateTime is how long to wait for basic object mutations, such as deletions, to show up ReasonableMutateTime = time.Minute * 2 // ReasonableStartTime is how long to wait for pods to start ReasonableStartTime = time.Minute * 5 )
var DefaultLegacyAdmissionControllers = append([]string{"Initializers"}, DefaultV114AdmissionControllers...)
DefaultLegacyAdmissionControllers are admission controllers we include with Kubernetes <1.14.0
var DefaultV114AdmissionControllers = []string{
"NamespaceLifecycle",
"LimitRanger",
"ServiceAccount",
"DefaultStorageClass",
"DefaultTolerationSeconds",
"NodeRestriction",
"MutatingAdmissionWebhook",
"ValidatingAdmissionWebhook",
"ResourceQuota",
}
DefaultV114AdmissionControllers are admission controllers we default to in v1.14.x
Functions ¶
func CalculateSizeInMB ¶ added in v1.3.0
CalculateSizeInMB returns the number of MB in the human readable string
func CanReadFile ¶
CanReadFile returns true if the file represented by path exists and is readable, otherwise false.
func ConcatStrings ¶ added in v1.0.1
ConcatStrings concatenates each string in the src slice with prefix and postfix and returns a new slice
func ContainsString ¶ added in v1.1.0
ContainsString 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 comparation.
func DeleteKubeConfigContext ¶ added in v1.3.0
DeleteKubeConfigContext deletes the specified machine's kubeconfig context
func FindAndSet ¶ added in v0.11.0
FindAndSet sets the nested value.
func GenerateCACert ¶ added in v0.6.0
GenerateCACert generates a CA certificate and RSA key for a common name
func GenerateSignedCert ¶ added in v0.6.0
func GenerateSignedCert(certPath, keyPath, cn string, ips []net.IP, alternateDNS []string, signerCertPath, signerKeyPath string) error
GenerateSignedCert generates a signed certificate and key
func GetAlternateDNS ¶
GetAlternateDNS returns a list of alternate names for a domain
func GetBinaryDownloadURL ¶ added in v0.26.0
GetBinaryDownloadURL returns a suitable URL for the platform
func GetClient ¶ added in v0.22.2
func GetClient(kubectlContext ...string) (kubernetes.Interface, error)
GetClient gets the client from config
func GetKubeConfigStatus ¶ added in v1.0.0
GetKubeConfigStatus verifies the ip stored in kubeconfig.
func GetPortFromKubeConfig ¶ added in v1.0.1
GetPortFromKubeConfig returns the Port number stored for minikube in the kubeconfig specified
func GetServiceClusterIP ¶ added in v0.24.0
GetServiceClusterIP returns the first IP of the ServiceCIDR
func IsDirectory ¶ added in v0.9.0
IsDirectory checks if path is a directory
func IsRetryableAPIError ¶ added in v0.22.2
IsRetryableAPIError returns if this error is retryable or not
func MaybeChownDirRecursiveToMinikubeUser ¶ added in v0.21.0
MaybeChownDirRecursiveToMinikubeUser changes ownership of a dir, if requested
func PopulateKubeConfig ¶ added in v1.0.0
func PopulateKubeConfig(cfg *KubeConfigSetup, kubecfg *api.Config) error
PopulateKubeConfig populates an api.Config object.
func ReadConfigOrNew ¶ added in v1.0.0
ReadConfigOrNew retrieves Kubernetes client configuration from a file. If no files exists, an empty configuration is returned.
func ReplaceChars ¶ added in v1.0.1
ReplaceChars returns a copy of the src slice with each string modified by the replacer
func RetryAfter ¶ added in v0.2.0
RetryAfter retries a number of attempts, after a delay
func SetCurrentContext ¶ added in v1.2.0
SetCurrentContext sets the kubectl's current-context
func SetupKubeConfig ¶ added in v1.0.0
func SetupKubeConfig(cfg *KubeConfigSetup) error
SetupKubeConfig reads config from disk, adds the minikube settings, and writes it back. activeContext is true when minikube is the CurrentContext If no CurrentContext is set, the given name will be used.
func TeePrefix ¶ added in v0.32.0
func TeePrefix(prefix string, r io.Reader, w io.Writer, logger func(format string, args ...interface{})) error
TeePrefix copies bytes from a reader to writer, logging each new line.
func UnsetCurrentContext ¶ added in v1.1.0
UnsetCurrentContext unsets the current-context from minikube to "" on minikube stop
func Until ¶
Until endlessly loops the provided function until a message is received on the done channel. The function will wait the duration provided in sleep between function calls. Errors will be sent on provider Writer.
func UpdateKubeconfigIP ¶ added in v1.0.0
UpdateKubeconfigIP overwrites the IP stored in kubeconfig with the provided IP.
func WaitForDeploymentToStabilize ¶ added in v0.25.0
func WaitForDeploymentToStabilize(c kubernetes.Interface, ns, name string, timeout time.Duration) error
WaitForDeploymentToStabilize waits till the Deployment has a matching generation/replica count between spec and status.
func WaitForEvent ¶ added in v0.31.0
func WaitForEvent(c kubernetes.Interface, ns string, reason string) error
WaitForEvent waits for the given event to appear
func WaitForPodDelete ¶ added in v0.31.0
WaitForPodDelete waits for a pod to be deleted
func WaitForPodsWithLabelRunning ¶ added in v0.22.2
WaitForPodsWithLabelRunning waits for all matching pods to become Running and at least one matching pod exists.
func WaitForRCToStabilize ¶ added in v0.22.2
WaitForRCToStabilize waits till the RC has a matching generation/replica count between spec and status.
func WaitForService ¶ added in v0.22.2
func WaitForService(c kubernetes.Interface, namespace, name string, exist bool, interval, timeout time.Duration) error
WaitForService waits until the service appears (exist == true), or disappears (exist == false)
func WaitForServiceEndpointsNum ¶ added in v0.22.2
func WaitForServiceEndpointsNum(c kubernetes.Interface, namespace, serviceName string, expectNum int, interval, timeout time.Duration) error
WaitForServiceEndpointsNum waits until the amount of endpoints that implement service to expectNum.
Types ¶
type ComponentExtraOptionMap ¶ added in v1.1.0
ComponentExtraOptionMap maps components to their extra opts, which is a map of keys to values
type DefaultDownloader ¶ added in v0.16.0
type DefaultDownloader struct{}
DefaultDownloader is the default ISODownloader
func (DefaultDownloader) CacheMinikubeISOFromURL ¶ added in v0.16.0
func (f DefaultDownloader) CacheMinikubeISOFromURL(isoURL string) error
CacheMinikubeISOFromURL downloads the ISO, if it doesn't exist in cache
func (DefaultDownloader) GetISOCacheFilepath ¶ added in v0.17.0
func (f DefaultDownloader) GetISOCacheFilepath(isoURL string) string
GetISOCacheFilepath returns the path of an ISO in the local cache
func (DefaultDownloader) GetISOFileURI ¶ added in v0.16.0
func (f DefaultDownloader) GetISOFileURI(isoURL string) string
GetISOFileURI gets the local destination for a remote source
func (DefaultDownloader) IsMinikubeISOCached ¶ added in v0.17.0
func (f DefaultDownloader) IsMinikubeISOCached(isoURL string) bool
IsMinikubeISOCached returns if an ISO exists in the local cache
func (DefaultDownloader) ShouldCacheMinikubeISO ¶ added in v0.17.0
func (f DefaultDownloader) ShouldCacheMinikubeISO(isoURL string) bool
ShouldCacheMinikubeISO returns if we need to download the ISO
type ExtraOption ¶ added in v0.11.0
ExtraOption is an extra option
func (*ExtraOption) String ¶ added in v0.11.0
func (e *ExtraOption) String() string
type ExtraOptionSlice ¶ added in v0.11.0
type ExtraOptionSlice []ExtraOption
ExtraOptionSlice is a slice of ExtraOption
func (*ExtraOptionSlice) AsMap ¶ added in v1.1.0
func (es *ExtraOptionSlice) AsMap() ComponentExtraOptionMap
AsMap converts the slice to a map of components to a map of keys and values.
func (*ExtraOptionSlice) Get ¶ added in v1.1.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 v0.11.0
func (es *ExtraOptionSlice) Set(value string) error
Set parses the string value into a slice
func (*ExtraOptionSlice) String ¶ added in v0.11.0
func (es *ExtraOptionSlice) String() string
String converts the slice to a string value
func (*ExtraOptionSlice) Type ¶ added in v0.11.0
func (es *ExtraOptionSlice) Type() string
Type returns the type
type ISODownloader ¶ added in v0.16.0
type ISODownloader interface { GetISOFileURI(isoURL string) string CacheMinikubeISOFromURL(isoURL string) error }
ISODownloader downloads an ISO
type KubeConfigSetup ¶ added in v1.0.0
type KubeConfigSetup struct { // The name of the cluster for this context ClusterName string // ClusterServerAddress is the address of the kubernetes cluster ClusterServerAddress string // ClientCertificate is the path to a client cert file for TLS. ClientCertificate string // CertificateAuthority is the path to a cert file for the certificate authority. CertificateAuthority string // ClientKey is the path to a client key file for TLS. ClientKey string // Should the current context be kept when setting up this one KeepContext bool // Should the certificate files be embedded instead of referenced by path EmbedCerts bool // contains filtered or unexported fields }
KubeConfigSetup is the kubeconfig setup
func (*KubeConfigSetup) GetKubeConfigFile ¶ added in v1.0.0
func (k *KubeConfigSetup) GetKubeConfigFile() string
GetKubeConfigFile gets the kubeconfig file
func (*KubeConfigSetup) SetKubeConfigFile ¶ added in v1.0.0
func (k *KubeConfigSetup) SetKubeConfigFile(kubeConfigFile string)
SetKubeConfigFile sets the kubeconfig file
type MultiError ¶ added in v0.8.0
type MultiError struct {
Errors []error
}
MultiError holds multiple errors
func (*MultiError) Collect ¶ added in v0.8.0
func (m *MultiError) Collect(err error)
Collect adds the error
func (MultiError) ToError ¶ added in v0.8.0
func (m MultiError) ToError() error
ToError converts all errors into one
type PodStore ¶ added in v0.22.2
type PodStore struct { cache.Store Reflector *cache.Reflector // contains filtered or unexported fields }
PodStore stores pods
func NewPodStore ¶ added in v0.22.2
func NewPodStore(c kubernetes.Interface, namespace string, label fmt.Stringer, field fmt.Stringer) *PodStore
NewPodStore creates a new PodStore
type RetriableError ¶ added in v0.12.0
type RetriableError struct {
Err error
}
RetriableError is an error that can be tried again
func (RetriableError) Error ¶ added in v0.12.0
func (r RetriableError) Error() string