Documentation ¶
Overview ¶
Description: This file has the package kubernetesruntime.
Package kubernetesruntime stores kubernetes cluster providers which implement a common interface for interaction with them.
Index ¶
- Constants
- Variables
- type KindRuntime
- func (kr *KindRuntime) Configure(log logrus.FieldLogger, _ *box.Config)
- func (kr *KindRuntime) Create(ctx context.Context) error
- func (kr *KindRuntime) Destroy(ctx context.Context) error
- func (kr *KindRuntime) GetClusters(ctx context.Context) ([]*RuntimeCluster, error)
- func (*KindRuntime) GetConfig() RuntimeConfig
- func (kr *KindRuntime) GetKubeConfig(ctx context.Context) (*api.Config, error)
- func (*KindRuntime) IsAccessible(ctx context.Context) (bool, error)
- func (*KindRuntime) PreCreate(ctx context.Context) error
- func (kr *KindRuntime) Start(ctx context.Context) error
- func (kr *KindRuntime) Status(ctx context.Context) RuntimeStatus
- func (kr *KindRuntime) Stop(ctx context.Context) error
- type LoftRuntime
- func (lr *LoftRuntime) Configure(log logrus.FieldLogger, conf *box.Config)
- func (lr *LoftRuntime) Create(ctx context.Context) error
- func (lr *LoftRuntime) Destroy(ctx context.Context) error
- func (lr *LoftRuntime) GetClusters(ctx context.Context) ([]*RuntimeCluster, error)
- func (lr *LoftRuntime) GetConfig() RuntimeConfig
- func (lr *LoftRuntime) GetKubeConfig(ctx context.Context) (*api.Config, error)
- func (lr *LoftRuntime) IsAccessible(ctx context.Context) (bool, error)
- func (lr *LoftRuntime) PreCreate(ctx context.Context) error
- func (lr *LoftRuntime) Start(ctx context.Context) error
- func (lr *LoftRuntime) Status(ctx context.Context) RuntimeStatus
- func (lr *LoftRuntime) Stop(ctx context.Context) error
- type Runtime
- type RuntimeCluster
- type RuntimeConfig
- type RuntimeStatus
- type RuntimeType
Constants ¶
const ( KindVersion = "v0.17.0-outreach.1" KindDownloadURL = "https://github.com/getoutreach/kind/releases/download/" + KindVersion + "/kind-" + runtime.GOOS + "-" + runtime.GOARCH KindClusterName = "dev-environment" )
Variables ¶
var ( ErrNotFound = errors.New("runtime not found") ErrNotRunning = errors.New("no runtime is running") )
var EnsureKind = (&KindRuntime{}).ensureKind
EnsureKind downloads kind
Functions ¶
This section is empty.
Types ¶
type KindRuntime ¶ added in v1.15.0
type KindRuntime struct {
// contains filtered or unexported fields
}
func NewKindRuntime ¶ added in v1.15.0
func NewKindRuntime() *KindRuntime
NewKindRuntime creates a new kind runtime
func (*KindRuntime) Configure ¶ added in v1.15.0
func (kr *KindRuntime) Configure(log logrus.FieldLogger, _ *box.Config)
func (*KindRuntime) Create ¶ added in v1.15.0
func (kr *KindRuntime) Create(ctx context.Context) error
Create creates a new Kind cluster
func (*KindRuntime) Destroy ¶ added in v1.15.0
func (kr *KindRuntime) Destroy(ctx context.Context) error
Destroy destroys a kind cluster
func (*KindRuntime) GetClusters ¶ added in v1.15.0
func (kr *KindRuntime) GetClusters(ctx context.Context) ([]*RuntimeCluster, error)
func (*KindRuntime) GetConfig ¶ added in v1.15.0
func (*KindRuntime) GetConfig() RuntimeConfig
func (*KindRuntime) GetKubeConfig ¶ added in v1.15.0
GetKubeConfig reads a kubeconfig from Kind and returns it This is based on the original shell hack, but a lot safer: "$kindPath" get kubeconfig --name "$(yq -r ".name" <"$LIBDIR/kind.yaml")"
| sed 's/kind-dev-environment/dev-environment/' >"$KUBECONFIG"
func (*KindRuntime) IsAccessible ¶ added in v1.38.0
func (*KindRuntime) IsAccessible(ctx context.Context) (bool, error)
IsAccessible validates whether the runtime IsAccessible
func (*KindRuntime) PreCreate ¶ added in v1.15.0
func (*KindRuntime) PreCreate(ctx context.Context) error
func (*KindRuntime) Start ¶ added in v1.22.0
func (kr *KindRuntime) Start(ctx context.Context) error
Start starts a kind cluster
func (*KindRuntime) Status ¶ added in v1.15.0
func (kr *KindRuntime) Status(ctx context.Context) RuntimeStatus
Status gets the status of a runtime
type LoftRuntime ¶ added in v1.15.0
type LoftRuntime struct {
// contains filtered or unexported fields
}
func NewLoftRuntime ¶ added in v1.15.0
func NewLoftRuntime() *LoftRuntime
func (*LoftRuntime) Configure ¶ added in v1.15.0
func (lr *LoftRuntime) Configure(log logrus.FieldLogger, conf *box.Config)
func (*LoftRuntime) Create ¶ added in v1.15.0
func (lr *LoftRuntime) Create(ctx context.Context) error
Create create a loft cluster
func (*LoftRuntime) Destroy ¶ added in v1.15.0
func (lr *LoftRuntime) Destroy(ctx context.Context) error
func (*LoftRuntime) GetClusters ¶ added in v1.15.0
func (lr *LoftRuntime) GetClusters(ctx context.Context) ([]*RuntimeCluster, error)
GetClusters gets a list of current devenv clusters that are available to the current user.
func (*LoftRuntime) GetConfig ¶ added in v1.15.0
func (lr *LoftRuntime) GetConfig() RuntimeConfig
func (*LoftRuntime) GetKubeConfig ¶ added in v1.15.0
func (*LoftRuntime) IsAccessible ¶ added in v1.38.0
func (lr *LoftRuntime) IsAccessible(ctx context.Context) (bool, error)
IsAccessible validates whether the runtime IsAccessible
func (*LoftRuntime) PreCreate ¶ added in v1.15.0
func (lr *LoftRuntime) PreCreate(ctx context.Context) error
func (*LoftRuntime) Start ¶ added in v1.22.0
func (lr *LoftRuntime) Start(ctx context.Context) error
func (*LoftRuntime) Status ¶ added in v1.15.0
func (lr *LoftRuntime) Status(ctx context.Context) RuntimeStatus
Status returns the status of our cluster
type Runtime ¶ added in v1.15.0
type Runtime interface { // GetConfig returns the configuration of a runtime GetConfig() RuntimeConfig // Status returns the status of a given runtime. Status(context.Context) RuntimeStatus // Create creates a new Kubernetes cluster using this runtime Create(context.Context) error // Destroy destroys a kubernetes cluster from this runtime Destroy(context.Context) error // Stop stops (sleeps) a kubernetes cluster from this runtime Stop(context.Context) error // Start starts (awakens) a kubernetes cluster from this runtime Start(context.Context) error // // IsAccessible validates whether the runtime IsAccessible IsAccessible(context.Context) (bool, error) // PreCreate is ran before creating a kubernetes cluster, useful // for implementing pre-requirements. PreCreate(context.Context) error // Configure is ran first to configure the runtime with it's // dependencies. Configure(logrus.FieldLogger, *box.Config) // GetKubeConfig returns the kube conf for the active cluster // created by this runtime. GetKubeConfig(context.Context) (*api.Config, error) // GetClusters returns all clusters currently accessible by this runtime GetClusters(context.Context) ([]*RuntimeCluster, error) }
Runtime is the Kubernetes Runtime interface that all runtimes should implement.
func GetEnabledRuntimes ¶ added in v1.15.0
GetEnabledRuntimes returns a list of enabled runtimes based on a given box configuration
func GetRuntime ¶ added in v1.15.0
GetRuntime returns a runtime by name, if not found nil is returned
func GetRuntimeFromContext ¶ added in v1.15.0
GetRuntimeFromContext returns the runtime from the current config.Context
func GetRuntimes ¶ added in v1.15.0
func GetRuntimes() []Runtime
GetRuntimes returns all registered runtimes. Generally GetEnabledRuntimes should be used over this.
type RuntimeCluster ¶ added in v1.15.0
type RuntimeCluster struct { // RuntimeName is the name of the runtime that created this cluster RuntimeName string // Name is the name of this cluster. Name string // KubeConfig is the kubeconfig that allows access to this cluster. KubeConfig *api.Config }
RuntimeCluster is a cluster that is currently provisioned / accessible by a given runtime.
type RuntimeConfig ¶ added in v1.15.0
type RuntimeConfig struct { // Name is the name of this runtime Name string // Type is the type of runtime this is Type RuntimeType // ClusterName is the name of the cluster this runtime creates ClusterName string }
RuntimeConfig is a config returned by a runtim
type RuntimeStatus ¶ added in v1.15.0
RuntimeStatus is the status of a given runtime
type RuntimeType ¶ added in v1.15.0
type RuntimeType string
RuntimeType dictates what type of runtime this kubernetes runtime implements.
const ( // RuntimeTypeLocal is a local kubernetes cluster that // runs directly on this computer, e.g. in a Docker for X // compatible VM or directly on the host via Docker. RuntimeTypeLocal RuntimeType = "local" // RunetimeTypeRemote is a remote kubernetes cluster // that has no connection other than APIServer with // this PC. RuntimeTypeRemote RuntimeType = "remote" )