provider

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StackitProviderName      = "stackit"
	StackitMachineLabel      = "kubernetes.io/machine"
	StackitMachineClassLabel = "kubernetes.io/machineclass"
)

Variables

This section is empty.

Functions

func NewProvider

NewProvider returns an empty provider object

Types

type Provider

type Provider struct {
	SPI spi.SessionProviderInterface
	// contains filtered or unexported fields
}

Provider is the struct that implements the driver interface It is used to implement the basic driver functionalities

Architecture: Single-tenant design - Each provider instance is deployed per Gardener shoot (cluster) - The STACKIT IaaS client is initialized lazily on first request using credentials from the Secret - All subsequent requests reuse the same client (SDK handles token refresh automatically) - Credential rotation requires pod restart (standard Kubernetes pattern)

func (*Provider) CreateMachine

CreateMachine handles a machine creation request by creating a STACKIT server

This method creates a new server in STACKIT infrastructure based on the ProviderSpec configuration in the MachineClass. It assigns MCM-specific labels to the server for tracking and orphan VM detection.

Returns:

  • ProviderID: Unique identifier in format "stackit://<projectId>/<serverId>"
  • NodeName: Name that the VM will register with in Kubernetes (matches Machine name)
  • Addresses: Internal IP addresses of the server's NICs (NodeInternalIP)

Error codes (see machine_error_codes.md for retry semantics):

  • InvalidArgument (no retry): Invalid ProviderSpec fields or missing required values
  • Internal (no retry): Malformed ProviderSpec JSON or failed to initialize STACKIT client
  • Unavailable (retry): Transient API failure (create/get server, get NICs, patch NIC)
  • ResourceExhausted (no retry): No capacity available (e.g. "no valid host was found")
  • DeadlineExceeded (retry): Server did not reach ACTIVE state within the polling timeout

func (*Provider) DeleteMachine

DeleteMachine handles a machine deletion request by deleting the STACKIT server

This method deletes the server identified by the ProviderID from STACKIT infrastructure. It is idempotent - if the server is already deleted (404), it returns success.

Error codes:

  • InvalidArgument: Missing or invalid ProviderID
  • Internal: Failed to delete server or communicate with STACKIT API

func (*Provider) GenerateMachineClassForMigration

GenerateMachineClassForMigration generates a MachineClass for migration purposes

This method is used to migrate from provider-specific MachineClass CRDs (e.g., AWSMachineClass) to the generic MachineClass format.

STACKIT provider does not have a legacy provider-specific MachineClass format, so this method is not needed and returns Unimplemented.

Returns:

  • Unimplemented: No migration required for STACKIT provider

func (*Provider) GetMachineStatus

GetMachineStatus retrieves the current status of a STACKIT server

This method queries STACKIT API to get the current state of the server identified by the Machine's ProviderID. If the ProviderID is empty (machine not created yet) or the server doesn't exist, it returns NotFound error.

Returns:

  • ProviderID: The machine's ProviderID
  • NodeName: Name that the VM registered with in Kubernetes

Error codes:

  • NotFound: Machine has no ProviderID yet, or server not found in STACKIT
  • InvalidArgument: Invalid ProviderID format
  • Internal: Failed to get server status or communicate with STACKIT API

func (*Provider) GetVolumeIDs

GetVolumeIDs extracts volume IDs from PersistentVolume specs

This method is used by MCM to get volume IDs for persistent volumes. Currently unimplemented for STACKIT provider - volumes are managed directly through the ProviderSpec (bootVolume and volumes fields).

Returns:

  • Unimplemented: This functionality is not required for STACKIT provider

func (*Provider) InitializeMachine

InitializeMachine handles VM initialization for STACKIT VM's. Currently, un-implemented.

func (*Provider) ListMachines

ListMachines lists all STACKIT servers that belong to the specified MachineClass

This method retrieves all servers in the STACKIT project and filters them based on the "kubernetes.io/machineclass" label. This enables the MCM safety controller to detect and clean up orphan VMs that are not backed by Machine CRs.

Returns:

  • MachineList: Map of ProviderID to MachineName for all servers matching the MachineClass

Error codes:

  • Internal: Failed to list servers or communicate with STACKIT API

func (*Provider) WaitUntilServerDeleted added in v0.3.0

func (p *Provider) WaitUntilServerDeleted(ctx context.Context, projectID, region, serverID string) error

func (*Provider) WaitUntilServerRunning added in v0.3.0

func (p *Provider) WaitUntilServerRunning(ctx context.Context, projectID, region, serverID string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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