kubernetes

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KubernetesRuntime

type KubernetesRuntime struct {
	// contains filtered or unexported fields
}

func NewKubernetesRuntime

func NewKubernetesRuntime(cfg KubernetesRuntimeConfig) (*KubernetesRuntime, error)

func (*KubernetesRuntime) Create

func (k *KubernetesRuntime) Create(ctx context.Context, spec *types.ContainerSpec) (string, error)

func (*KubernetesRuntime) Delete

func (k *KubernetesRuntime) Delete(ctx context.Context, runtimeID string) error

func (*KubernetesRuntime) Describe added in v0.1.4

func (*KubernetesRuntime) Endpoint added in v0.2.4

func (k *KubernetesRuntime) Endpoint() (string, string)

Endpoint satisfies containerruntime.RuntimeEndpointReporter. 返回 apiserver 地址(来自 kubeconfig / 集群内 ServiceAccount),已脱敏。

func (*KubernetesRuntime) EnsureImage

func (k *KubernetesRuntime) EnsureImage(_ context.Context, imageName string, pullPolicy string) error

EnsureImage satisfies containerruntime.RuntimeImageManager. For Kubernetes runtimes, image pull is performed by kubelet during pod scheduling. This method validates input and enforces pull-policy constraints that can be checked early.

func (*KubernetesRuntime) Exec

func (k *KubernetesRuntime) Exec(_ context.Context, _ string, _ []string) (string, error)

func (*KubernetesRuntime) HealthCheck added in v0.2.2

func (k *KubernetesRuntime) HealthCheck(ctx context.Context) error

HealthCheck satisfies containerruntime.RuntimeHealthChecker. 通过 apiserver 的 ServerVersion 探测集群连通性与凭据有效性 (kubeconfig 不存在 / 证书过期 / apiserver 不可达都会在这里暴露)。

func (*KubernetesRuntime) Inspect

func (*KubernetesRuntime) Logs

func (k *KubernetesRuntime) Logs(ctx context.Context, runtimeID string, tail int) (string, error)

func (*KubernetesRuntime) Monitor

func (k *KubernetesRuntime) Monitor(ctx context.Context, runtimeID string) error

监控 deployment 和 job 的生命周期(启动与退出)。

func (*KubernetesRuntime) Name

func (k *KubernetesRuntime) Name() string

func (*KubernetesRuntime) OpenTerminal added in v0.2.0

OpenTerminal 等价于 `kubectl exec -it <pod> -c main -- <command>`。

它通过 client-go 的 remotecommand(SPDY)在 Pod 内新建一个进程并申请 TTY, 不依赖容器内任何终端服务。

func (*KubernetesRuntime) Pause

func (k *KubernetesRuntime) Pause(ctx context.Context, runtimeID string) error

func (*KubernetesRuntime) Resume

func (k *KubernetesRuntime) Resume(ctx context.Context, runtimeID string) error

func (*KubernetesRuntime) ServerVersion added in v0.2.4

func (k *KubernetesRuntime) ServerVersion(ctx context.Context) (string, error)

ServerVersion satisfies containerruntime.RuntimeVersionReporter.

func (*KubernetesRuntime) SetEventHandler

func (k *KubernetesRuntime) SetEventHandler(handler containerruntime.RuntimeEventHandler)

func (*KubernetesRuntime) Start

func (k *KubernetesRuntime) Start(ctx context.Context, runtimeID string) error

func (*KubernetesRuntime) Stop

func (k *KubernetesRuntime) Stop(ctx context.Context, runtimeID string) error

type KubernetesRuntimeConfig

type KubernetesRuntimeConfig struct {
	RuntimeName string
	Namespace   string
	Kubeconfig  string
	InCluster   bool
}

type KubernetesRuntimeMonitor

type KubernetesRuntimeMonitor interface {
	Monitor(ctx context.Context, runtimeID string) error
}

type KubernetesRuntimeOption

type KubernetesRuntimeOption func(*KubernetesRuntime)

func WithKubernetesRuntimeMonitor

func WithKubernetesRuntimeMonitor(monitor KubernetesRuntimeMonitor) KubernetesRuntimeOption

Jump to

Keyboard shortcuts

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