kubernetes

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package kubernetes provides a client for the Kubernetes runtime including creating, starting, stopping, and retrieving container information.

Index

Constants

View Source
const RuntimeName = "kubernetes"

RuntimeName is the name identifier for the Kubernetes runtime

View Source
const (
	// UnknownStatus represents an unknown container status
	UnknownStatus = "unknown"
)

Constants for container status

Variables

This section is empty.

Functions

func IsAvailable added in v0.2.12

func IsAvailable() bool

IsAvailable checks if kubernetes is available

Types

type Client

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

Client implements the Deployer interface for container operations

func NewClient

func NewClient(_ context.Context) (*Client, error)

NewClient creates a new container client

func NewClientWithConfig added in v0.2.11

func NewClientWithConfig(clientset kubernetes.Interface, config *rest.Config) *Client

NewClientWithConfig creates a new container client with a provided config This is primarily used for testing with fake clients

func NewClientWithConfigAndPlatformDetector added in v0.2.11

func NewClientWithConfigAndPlatformDetector(
	clientset kubernetes.Interface,
	config *rest.Config,
	platformDetector PlatformDetector,
) *Client

NewClientWithConfigAndPlatformDetector creates a new container client with a provided config and platform detector This is primarily used for testing with fake clients and mock platform detectors

func (*Client) AttachToWorkload added in v0.0.37

func (c *Client) AttachToWorkload(ctx context.Context, workloadName string) (io.WriteCloser, io.ReadCloser, error)

AttachToWorkload implements runtime.Runtime.

func (*Client) DeployWorkload added in v0.0.37

func (c *Client) DeployWorkload(ctx context.Context,
	image string,
	containerName string,
	command []string,
	envVars map[string]string,
	containerLabels map[string]string,
	_ *permissions.Profile,
	transportType string,
	options *runtime.DeployWorkloadOptions,
	_ bool,
) (int, error)

DeployWorkload implements runtime.Runtime.

func (*Client) GetWorkloadInfo added in v0.0.37

func (c *Client) GetWorkloadInfo(ctx context.Context, workloadName string) (runtime.ContainerInfo, error)

GetWorkloadInfo implements runtime.Runtime.

func (*Client) GetWorkloadLogs added in v0.0.37

func (c *Client) GetWorkloadLogs(ctx context.Context, workloadName string, follow bool) (string, error)

GetWorkloadLogs implements runtime.Runtime.

func (*Client) IsRunning added in v0.1.1

func (c *Client) IsRunning(ctx context.Context) error

IsRunning checks the health of the container runtime. This is used to verify that the runtime is operational and can manage workloads.

func (*Client) IsWorkloadRunning added in v0.0.37

func (c *Client) IsWorkloadRunning(ctx context.Context, workloadName string) (bool, error)

IsWorkloadRunning implements runtime.Runtime.

func (*Client) ListWorkloads added in v0.0.37

func (c *Client) ListWorkloads(ctx context.Context) ([]runtime.ContainerInfo, error)

ListWorkloads implements runtime.Runtime.

func (*Client) RemoveWorkload added in v0.0.37

func (c *Client) RemoveWorkload(ctx context.Context, workloadName string) error

RemoveWorkload implements runtime.Runtime.

func (*Client) StopWorkload added in v0.0.37

func (*Client) StopWorkload(_ context.Context, _ string) error

StopWorkload implements runtime.Runtime.

type DefaultPlatformDetector added in v0.2.8

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

DefaultPlatformDetector implements PlatformDetector using the existing OpenShift detection logic

func (*DefaultPlatformDetector) DetectPlatform added in v0.2.8

func (d *DefaultPlatformDetector) DetectPlatform(config *rest.Config) (Platform, error)

DetectPlatform implements the PlatformDetector interface

type Platform added in v0.2.8

type Platform int

Platform represents the Kubernetes platform type

const (
	// PlatformKubernetes represents standard Kubernetes
	PlatformKubernetes Platform = iota
	// PlatformOpenShift represents OpenShift
	PlatformOpenShift
)

func (Platform) String added in v0.2.8

func (p Platform) String() string

String returns the string representation of the Platform

type PlatformDetector added in v0.2.8

type PlatformDetector interface {
	DetectPlatform(config *rest.Config) (Platform, error)
}

PlatformDetector defines the interface for detecting the Kubernetes platform type

func NewDefaultPlatformDetector added in v0.2.8

func NewDefaultPlatformDetector() PlatformDetector

NewDefaultPlatformDetector creates a new DefaultPlatformDetector

Jump to

Keyboard shortcuts

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