cmd

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 115 Imported by: 80

Documentation

Index

Constants

View Source
const (
	// Fatal is a type of DeletionError
	Fatal typeOfError = 0
	// MissingProfile is a type of DeletionError
	MissingProfile typeOfError = 1
	// MissingCluster is a type of DeletionError
	MissingCluster typeOfError = 2
)
View Source
const (
	// Configured means configured
	Configured = "Configured" // ~state.Saved
	// Misconfigured means misconfigured
	Misconfigured = "Misconfigured" // ~state.Error
	// Nonexistent means the resource does not exist
	Nonexistent = "Nonexistent" // ~state.None
	// Irrelevant is used for statuses that aren't meaningful for worker nodes
	Irrelevant = "Irrelevant"
)

Additional legacy states

View Source
const (
	Starting  = 100
	Pausing   = 101
	Unpausing = 102
	Stopping  = 110
	Deleting  = 120

	OK      = 200
	Warning = 203

	NotFound = 404
	Stopped  = 405
	Paused   = 418 // I'm a teapot!

	Error               = 500
	InsufficientStorage = 507
	Unknown             = 520
)

New status modes, based roughly on HTTP/SMTP standards

Variables

View Source
var (
	// ErrKubernetesPatchNotFound is when a patch was not found for the given <major>.<minor> version
	ErrKubernetesPatchNotFound = errors.New("Unable to detect the latest patch release for specified Kubernetes version")
)
View Source
var RootCmd = &cobra.Command{
	Use:   "minikube",
	Short: "minikube quickly sets up a local Kubernetes cluster",
	Long:  `minikube provisions and manages local Kubernetes clusters optimized for development workflows.`,
	PersistentPreRun: func(_ *cobra.Command, _ []string) {
		for _, path := range dirs {
			if err := os.MkdirAll(path, 0777); err != nil {
				exit.Error(reason.HostHomeMkdir, "Error creating minikube directory", err)
			}
		}
		userName := viper.GetString(config.UserFlag)
		if !validateUsername(userName) {
			out.WarningT("User name '{{.username}}' is not valid", out.V{"username": userName})
			exit.Message(reason.Usage, "User name must be 60 chars or less.")
		}
		var err error
		auditID, err = audit.LogCommandStart()
		if err != nil {
			klog.Warningf("failed to log command start to audit: %v", err)
		}

		if viper.GetBool(config.Rootless) {
			os.Setenv(constants.MinikubeRootlessEnv, "true")
		}
	},
	PersistentPostRun: func(_ *cobra.Command, _ []string) {
		if err := audit.LogCommandEnd(auditID); err != nil {
			klog.Warningf("failed to log command end to audit: %v", err)
		}
	},
}

RootCmd represents the base command when called without any subcommands

Functions

func ClusterFlagValue added in v1.9.0

func ClusterFlagValue() string

ClusterFlagValue returns the current cluster name based on flags

func DeleteProfiles added in v1.5.0

func DeleteProfiles(profiles []*config.Profile) []error

DeleteProfiles deletes one or more profiles

func Execute

func Execute()

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GenerateBashCompletion added in v0.12.1

func GenerateBashCompletion(w io.Writer, cmd *cobra.Command) error

GenerateBashCompletion generates the completion for the bash shell

func GenerateFishCompletion added in v1.10.0

func GenerateFishCompletion(w io.Writer, cmd *cobra.Command) error

GenerateFishCompletion generates the completion for the bash shell

func GeneratePowerShellCompletion added in v1.31.0

func GeneratePowerShellCompletion(w io.Writer, cmd *cobra.Command) error

GeneratePowerShellCompletion generates the completion for the PowerShell

func GenerateZshCompletion added in v0.24.0

func GenerateZshCompletion(out io.Writer, cmd *cobra.Command) error

GenerateZshCompletion generates the completion for the zsh shell

func HandleDeletionErrors added in v1.5.0

func HandleDeletionErrors(errors []error)

HandleDeletionErrors handles deletion errors from DeleteProfiles

func KubectlCommand added in v1.9.1

func KubectlCommand(version, binaryURL string, args ...string) (*exec.Cmd, error)

KubectlCommand will return kubectl command with a version matching the cluster

Types

type BaseState added in v1.12.2

type BaseState struct {
	// Name is the name of the object
	Name string

	// StatusCode is an HTTP-like status code for this object
	StatusCode int
	// Name is a human-readable name for the status code
	StatusName string
	// StatusDetail is long human-readable string describing why this particular status code was chosen
	StatusDetail string `json:",omitempty"` // Not yet implemented

	// Step is which workflow step the object is at.
	Step string `json:",omitempty"`
	// StepDetail is a long human-readable string describing the step
	StepDetail string `json:",omitempty"`
}

BaseState holds a component state representation, such as "apiserver" or "kubeconfig"

type CacheListTemplate added in v0.25.0

type CacheListTemplate struct {
	CacheImage string
}

CacheListTemplate represents the cache list template

type ClusterState added in v1.12.2

type ClusterState struct {
	BaseState

	BinaryVersion string
	TimeToStop    string `json:",omitempty"`
	Components    map[string]BaseState
	Nodes         []NodeState
}

ClusterState holds a cluster state representation

type DeletionError added in v1.5.0

type DeletionError struct {
	Err     error
	Errtype typeOfError
}

DeletionError can be returned from DeleteProfiles

func (DeletionError) Error added in v1.5.0

func (error DeletionError) Error() string

type DockerEnvConfig added in v1.7.3

type DockerEnvConfig struct {
	shell.EnvConfig
	// contains filtered or unexported fields
}

DockerEnvConfig encapsulates all external inputs into shell generation for Docker

type DockerShellConfig added in v1.7.3

type DockerShellConfig struct {
	shell.Config
	DockerCertPath         string
	DockerHost             string
	DockerTLSVerify        string
	MinikubeDockerdProfile string
	NoProxyVar             string
	NoProxyValue           string

	ExistingDockerCertPath  string
	ExistingDockerHost      string
	ExistingDockerTLSVerify string

	SSHAuthSock string
	SSHAgentPID string
}

DockerShellConfig represents the shell config for Docker

type EnvNoProxyGetter added in v0.17.0

type EnvNoProxyGetter struct{}

EnvNoProxyGetter gets the no_proxy variable, using environment

func (EnvNoProxyGetter) GetNoProxyVar added in v0.17.0

func (EnvNoProxyGetter) GetNoProxyVar() (string, string)

GetNoProxyVar gets the no_proxy var

type NoProxyGetter added in v0.17.0

type NoProxyGetter interface {
	GetNoProxyVar() (string, string)
}

NoProxyGetter gets the no_proxy variable

type NodeState added in v1.12.2

type NodeState struct {
	BaseState
	Components map[string]BaseState `json:",omitempty"`
}

NodeState holds a node state representation

type PodmanEnvConfig added in v1.7.3

type PodmanEnvConfig struct {
	shell.EnvConfig
	// contains filtered or unexported fields
}

PodmanEnvConfig encapsulates all external inputs into shell generation for Podman

type PodmanShellConfig added in v1.7.3

type PodmanShellConfig struct {
	shell.Config
	VarlinkBridge         string
	ContainerHost         string
	ContainerSSHKey       string
	MinikubePodmanProfile string

	ExistingContainerHost string
}

PodmanShellConfig represents the shell config for Podman

type Status added in v0.10.0

type Status struct {
	Name       string
	Host       string
	Kubelet    string
	APIServer  string
	Kubeconfig string
	Worker     bool
	TimeToStop string `json:",omitempty"`
	DockerEnv  string `json:",omitempty"`
	PodManEnv  string `json:",omitempty"`
}

Status holds string representations of component states

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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