registry

package
Version: v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: Apache-2.0 Imports: 8 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// Podman is Kubernetes in container using podman driver
	Podman = "podman"
	// Docker is Kubernetes in container using docker driver
	Docker = "docker"
	// Mock driver
	Mock = "mock"
	// None driver
	None = "none"
)

Variables

This section is empty.

Functions

func BareMetal

func BareMetal(name string) bool

BareMetal returns if this driver is unisolated

func IsKIC

func IsKIC(name string) bool

IsKIC checks if the driver is a Kubernetes in container

func IsMock

func IsMock(name string) bool

IsMock checks if the driver is a mock

func IsVM

func IsVM(name string) bool

IsVM checks if the driver is a VM

func Register

func Register(driver DriverDef) error

Register registers driver with the global registry

Types

type Configurator

type Configurator func(config.ClusterConfig, config.Node) (interface{}, error)

Configurator emits a struct to be marshalled into JSON for Machine Driver

type DriverDef

type DriverDef struct {
	// Name of the machine driver. It has to be unique.
	Name string

	// Alias contains a list of machine driver aliases. Each alias should also be unique.
	Alias []string

	// Config is a function that emits a configured driver struct
	Config Configurator

	// Init is a function that initializes a machine driver, if built-in to the minikube binary
	Init Loader

	// Status returns the installation status of the driver
	Status StatusChecker

	// Default is whether this driver is selected by default or not (opt-in).
	Default bool

	// Priority returns the prioritization for selecting a driver by default.
	Priority Priority
}

DriverDef defines how to initialize and load a machine driver

func Driver

func Driver(name string) DriverDef

Driver gets a named driver from the global registry

func List

func List() []DriverDef

List lists drivers in global registry

func (DriverDef) Empty

func (d DriverDef) Empty() bool

Empty returns true if the driver is nil

func (DriverDef) String

func (d DriverDef) String() string

type DriverState

type DriverState struct {
	// Name is the name of the driver used internally
	Name string
	// Default drivers are selected automatically
	Default bool
	// Preference is the original priority from driver
	Preference Priority
	// Priority is the effective priority with health
	Priority Priority
	// State is the state of driver and dependencies
	State State
	// Rejection is why we chose not to use this driver
	Rejection string
	// Suggestion is how the user could improve health
	Suggestion string
}

DriverState is metadata relating to a driver and status

func Available

func Available(vm bool) []DriverState

Available returns a list of available drivers in the global registry

func (DriverState) String

func (d DriverState) String() string

type Loader

type Loader func() drivers.Driver

Loader is a function that loads a byte stream and creates a driver.

type Priority

type Priority int

Priority is how we determine what driver to default to

const (
	// Unknown is when there is no status check available
	Unknown Priority = iota
	// Obsolete is when a driver has been removed
	Obsolete
	// Unhealthy is when a driver does not pass health checks
	Unhealthy
	// Experimental is when a driver is not officially supported because it's still experimental
	Experimental
	// Discouraged is when a driver has caveats that preclude it's recommendation
	Discouraged
	// Deprecated is when a driver has been formally deprecated
	Deprecated
	// Fallback is when a driver works well, but may not be high performance
	Fallback
	// Default is what most 3rd party drivers are
	Default
	// Preferred is for drivers that use a native hypervisor interface
	Preferred
	// HighlyPreferred is the ultimate driver preferences
	HighlyPreferred
)

type Registry

type Registry interface {
	// Register a driver in registry
	Register(driver DriverDef) error

	// Driver returns the registered driver from a given name
	Driver(name string) (DriverDef, error)

	// List
	List() []DriverDef
}

Registry contains all the supported driver definitions on the host

type State

type State struct {
	Installed        bool
	Healthy          bool
	Running          bool // it at least appears to be running
	NeedsImprovement bool // healthy but could be improved
	Error            error

	Reason string // A reason ID, propagated to reason.Kind.ID
	Fix    string
	Doc    string
}

State is the current state of the driver and its dependencies

func Status

func Status(name string) State

Status returns the state of a driver within the global registry

type StatusChecker

type StatusChecker func() State

StatusChecker checks if a driver is available, offering a

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto