kubernetes

package
v0.0.0-...-08b716b Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {

	// WaitForCacheSync waits for the initial sync to be completed. Returns false if the cache
	// fails to sync.
	WaitForCacheSync func(context.Context) bool
	// contains filtered or unexported fields
}

Backend is a hardware Backend backed by a Backend cluster that contains hardware resources.

func NewBackend

func NewBackend(ctx context.Context, cfg Config) (*Backend, error)

NewBackend creates a new Backend instance. It launches a goroutine to perform synchronization between the cluster and internal caches. Consumers can wait for the initial sync using WaitForCachesync(). See k8s.io/Backend-go/tools/Backendcmd for constructing *rest.Config objects.

func (*Backend) GetEC2Instance

func (b *Backend) GetEC2Instance(ctx context.Context, ip string) (ec2.Instance, error)

GetEC2InstanceByIP satisfies ec2.Client.

func (*Backend) GetHackInstance

func (b *Backend) GetHackInstance(ctx context.Context, ip string) (hack.Instance, error)

func (*Backend) IsHealthy

func (b *Backend) IsHealthy(context.Context) bool

IsHealthy returns true until the context used to create the Backend is cancelled.

type Config

type Config struct {
	// Kubeconfig is a path to a valid kubeconfig file. When in-cluster defaults to the in-cluster
	// config. Optional.
	Kubeconfig string

	// APIServerAddress is the address of the kubernetes cluster (https://hostname:port). Optional.
	APIServerAddress string

	// Namespace restricts the scope of the backend such that Hardware objects are retrieved from
	// this namespace only. Optional.
	Namespace string

	// ClientConfig is a Kubernetes client config. If specified, it will be used instead of
	// constructing a client using the other configuration in this object. Optional.
	ClientConfig *rest.Config
}

Config used by the NewBackend function family.

Jump to

Keyboard shortcuts

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