cloudprovider

package
v0.1.6 Latest Latest
Warning

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

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

Documentation

Overview

Package cloudprovider manages the cloud-provider-kind sidecar container that enables LoadBalancer, Ingress, and Gateway API in local Kind clusters.

The controller runs the upstream cloud-provider-kind image as a detached container (via a gopherly.dev/currus Engine) rather than an in-process controller. The container connects to the host engine through a bind-mounted socket and joins the "kind" network so it can reach cluster nodes directly.

Lifecycle: Controller.Start is idempotent — calling it when the container is already running returns nil. Controller.Stop removes the container. Controller.Attach starts it (if necessary) then streams its logs to the caller until the context is canceled, after which it stops the container.

Coverage: Docker and Podman are fully supported. Containerd (nerdctl/finch) returns ErrUnsupported because the cloud-provider-kind image requires the Docker-compatible engine API; cluster create/delete/kubeconfig continue to work on all engines.

Index

Constants

View Source
const (
	// DefaultImage is the pinned cloud-provider-kind image used when no image
	// override is provided.
	DefaultImage = "registry.k8s.io/cloud-provider-kind/cloud-controller-manager:v0.10.0"
)

Variables

View Source
var ErrUnsupported = errors.New("cloud provider requires Docker or Podman")

ErrUnsupported is returned by Start/Stop/Running when the underlying engine does not support the Docker Engine API (e.g. plain containerd).

Functions

This section is empty.

Types

type Config

type Config struct {
	// Image is the container image to run. Defaults to DefaultImage.
	Image string

	// Network is the container network to join. Defaults to "kind".
	Network string

	// GatewayChannel selects the Gateway API release channel
	// ("standard", "experimental", or "disabled").
	GatewayChannel string

	// IngressDefault enables the default IngressClass. Defaults to true.
	IngressDefault bool

	// SocketPath is the host-side docker socket to bind-mount into the
	// container. If empty, it is derived from eng.Endpoint().Host.
	SocketPath string

	// ClusterName is the Kind cluster name. When set, Stop also removes
	// gateway sidecar containers (envoy proxies) spawned by
	// cloud-provider-kind for this cluster.
	ClusterName string
}

Config holds the runtime configuration for the cloud-provider-kind container.

type Controller

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

Controller manages the lifecycle of the cloud-provider-kind container.

func New

func New(eng currus.Engine, cfg Config) *Controller

New returns a Controller that uses eng to manage the cloud-provider-kind container with the given configuration.

func (*Controller) Attach

func (c *Controller) Attach(ctx context.Context, out io.Writer) error

Attach streams the cloud-provider-kind container logs to out until ctx is canceled. The container must already be running (call Start beforehand). If the engine does not support log streaming, Attach blocks until ctx is canceled without producing any output.

func (*Controller) Running

func (c *Controller) Running(ctx context.Context) bool

Running reports whether the cloud-provider-kind container is currently running. It returns false if no container is found or if detection fails.

func (*Controller) Start

func (c *Controller) Start(ctx context.Context) error

Start ensures the cloud-provider-kind container is running. It is idempotent: if the container is already running, Start returns nil.

func (*Controller) Stop

func (c *Controller) Stop(ctx context.Context) error

Stop removes the cloud-provider-kind container and any gateway sidecar containers it spawned. It is idempotent: if no containers are found, Stop returns nil.

Jump to

Keyboard shortcuts

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