v1

package
v1.36.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HTTP2 = true

	Backends         []BackendFunc = []BackendFunc{}
	DockerBackend    BackendName   = "docker"
	PodmanBackend    BackendName   = "podman"
	AWSLambdaBackend BackendName   = "awslambda"

	// APIServerTunnel TunnelName = "shared"
	// KubeletTunnel   TunnelName = "shared"
	SharedTunnel TunnelName = "shared"

	APIServerService         ServiceName = "apiserver"
	KubeletService           ServiceName = "kubelet"
	ControllerManagerService ServiceName = "controller-manager"
	SchedulerService         ServiceName = "scheduler"
	Node                     ServiceName = "node"

	DataDirLock          DataDir  = "lock"
	DataDirKubelet       DataDir  = "kubelet"
	DataDirCerts         DataDir  = "certs"
	DataDirLogs          DataDir  = "logs"
	DataDirEtcd          DataDir  = "etcd"
	DataDirKube          DataDir  = ".kube"
	DataDirStaticPods    DataDir  = DataDir(filepath.Join(string(DataDirKubelet), "static-pods"))
	DataDirVolumePlugins DataDir  = DataDir(filepath.Join(string(DataDirKubelet), "volume-plugins"))
	PidFile                       = func(options Options) FileName { return FileName(options.Name() + ".pid") }
	LogFile                       = func(options Options) FileName { return FileName(options.Name() + ".log") }
	CAFile               FileName = FileName(filepath.Join(string(DataDirCerts), "ca.crt"))
	CertFile             FileName = FileName(filepath.Join(string(DataDirCerts), "apiserver.crt"))
	KeyFile              FileName = FileName(filepath.Join(string(DataDirCerts), "apiserver.key"))
	KubeconfigFile       FileName = FileName(filepath.Join(string(DataDirKube), "config"))

	NetworkHost        NetworkType = "host"
	NetworkBridge      NetworkType = "bridge"
	NetworkSubnetSize              = 28
	NetworkProtocolTCP             = corev1.ProtocolTCP
	NetworkProtocolUDP             = corev1.ProtocolUDP

	SandboxExecSentinel = "__sandbox__"
)

Functions

This section is empty.

Types

type AllocatedNetwork

type AllocatedNetwork interface {
	ID() string
	Type() NetworkType
	Gateway() net.IP
	Network() net.IPNet

	Deallocate() error

	WithSandboxUID(sandboxUID *types.UID) AllocatedNetwork
	SandboxUID() *types.UID
}

type ApiServer

type ApiServer interface {
	Ready

	Context() context.Context
	Client() Client
	Done() <-chan struct{}
	CACerts() []*x509.Certificate

	Handler() http.Handler
	Server() *server.GenericAPIServer
	Destroy() error
}

type Backend

type Backend interface {
	Ready

	cadvisor.Interface

	Nanokube() Nanokube
	Name() BackendName

	Driver() Driver
	Network() Network
	Manager() Manager
	Services() []*restful.WebService

	WithBaseURL(baseURL *url.URL) Backend

	Reconcile(obj interface{}, deleted bool)
}

type BackendFunc

type BackendFunc func(nano Nanokube) Backend

type BackendName

type BackendName string

type Client

type Client interface {
	Ready
	client.Interface
	Clientset() *client.Clientset
	InformerFactory() informers.SharedInformerFactory
	WithHeartbeat(interval time.Duration) Client
	WithQps(qps float32) Client
	WithTimeout(timeout time.Duration) Client
	WithTunnel(tunnel tunnel.Tunnel, local bool) Client

	Kubeconfig(name string) *clientcmdapi.Config
	WriteKubeconfig(path string) error
}

type DataDir

type DataDir string

type Driver

type Driver interface {
	internalapi.ImageManagerService
	internalapi.RuntimeService
	NetworkService
	VolumeService

	Context() context.Context
	Name() string

	ExecOnHost(ctx context.Context, image string, cmd []string, mounts []Path) (string, error)
	ExecOnNetwork(ctx context.Context, network AllocatedNetwork, image string, cmd []string, portMap []PortMap) (string, error)

	CgroupRoot() string
	LogStream(containerID string, status *criv1.ContainerStatus) LogStream
	Service() *restful.WebService

	WithBaseURL(baseURL *url.URL) Driver
	BaseURL() *url.URL

	WithNetwork(network Network) Driver
	Network() Network
}

type Error

type Error interface {
	error
	exec.ExitError
	WithCommand(cmd []string) Error
	WithCode(code int) Error
	WithError(err error) Error
	WithErrors(errs ...error) Error
}

type FileName

type FileName string

type LogStream

type LogStream interface {
	Start()
	Stop()
	Destroy()
	Stdout() io.ReadCloser
	Stderr() io.ReadCloser
}

LogStream represents a container's log pump. Runtimes construct one via NewLogStream, providing a LogSource that knows how to open stdout/stderr readers. The impl owns pipes, CRI-format formatting, and log-file I/O.

type Nanokube

type Nanokube interface {
	context.Context
	record.EventRecorder
	record.EventRecorderLogger

	Options() Options

	WithCancel() (context.Context, context.CancelFunc)

	Cancel(reason Error)
	CancelErr(reason error)
	Errors() []error

	Backend(name BackendName) Backend
	DefaultBackend() Backend

	Host() Host
	Client() Client
	Tunnel() tunnel.Tunnel
	StaticPods() []*corev1.Pod

	Services(baseURL *url.URL) []*restful.WebService

	Environ() []string
	CertFilePath() string
	KeyFilePath() string
	RootCaFilePath() string
	WithLoopback(loopback *rest.Config) Nanokube
	KubeconfigPath() string
	NodeReady() <-chan struct{}
	NodeRef() *corev1.ObjectReference

	Storage() Storage
	SetSharedInformerFactory(factory informers.SharedInformerFactory) informers.SharedInformerFactory
	SharedInformerFactory() informers.SharedInformerFactory
}

type Network

type Network interface {
	Networks() []AllocatedNetwork
	FromID(ctx context.Context, id string) (AllocatedNetwork, error)
	FromIP(ctx context.Context, ip net.IP) (AllocatedNetwork, error)
	FromUID(ctx context.Context, sandboxUID types.UID) (AllocatedNetwork, error)
	FromStatus(ctx context.Context, status *criv1.PodSandboxStatus) (AllocatedNetwork, error)
	FromConfig(ctx context.Context, config *criv1.PodSandboxConfig) (AllocatedNetwork, error)
	Default(ctx context.Context) AllocatedNetwork
}

type NetworkService

type NetworkService interface {
	Context() context.Context
	GetNetwork(ctx context.Context, id string) (*NetworkType, *net.IP, *net.IPNet, error)
	CreateNetwork(ctx context.Context, networkType NetworkType, net *net.IPNet, gateway *net.IP) (string, error)
	RemoveNetwork(ctx context.Context, id string) error
}

type NetworkType

type NetworkType string

type Options

type Options interface {
	Name() string
	Verbosity() int
	DataDir() DataDir

	DataDirAt(name DataDir) string
	FilePathAt(file FileName) string
	InDataDir(path string) bool

	Args() []string
}

TODO(deprecate)

type Path

type Path string

type PortMap

type PortMap interface {
	Local() int32
	Remote() int32
	Protocol() Protocol
}

type Protocol

type Protocol corev1.Protocol

type Ready

type Ready interface {
	Ready() <-chan struct{}
}

type ServiceName

type ServiceName string

type Storage

type Storage interface {
	generic.RESTOptionsGetter

	SetConfig(config *server.Config) *server.Config
	WithResource(inner kubestorage.Interface, resource schema.GroupResource) StorageClient

	Servers() []string
	Shutdown()
}

type StorageClient

type StorageClient interface {
	kubestorage.Interface
}

type TunnelName

type TunnelName string

type VolumeService

type VolumeService interface {
	ClaimVolume(backend Backend, client Client, pvc *corev1.PersistentVolumeClaim) *corev1ac.PersistentVolumeClaimApplyConfiguration
	CreateVolume(pv *corev1.LocalVolumeSource) error
	DeleteVolume(pv *corev1.LocalVolumeSource) error
	ReleaseVolume(backend Backend, client Client, pvc *corev1.PersistentVolumeClaim) error
}

Jump to

Keyboard shortcuts

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