capi

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package capi provides builders for Cluster API resources. This package uses unstructured resources to avoid tight coupling to specific CAPI provider versions while maintaining type safety through well-defined builders.

Index

Constants

View Source
const (
	ClusterAPIGroup   = "cluster.x-k8s.io"
	ClusterAPIVersion = "v1beta1"

	InfrastructureAPIGroup   = "infrastructure.cluster.x-k8s.io"
	InfrastructureAPIVersion = "v1alpha1"

	ControlPlaneAPIGroup   = "controlplane.cluster.x-k8s.io"
	ControlPlaneAPIVersion = "v1alpha1"

	BootstrapAPIGroup   = "bootstrap.cluster.x-k8s.io"
	BootstrapAPIVersion = "v1beta1"
)

API Group/Version constants for CAPI resources.

View Source
const (
	DefaultWorkerCPU      = 4
	DefaultWorkerMemoryMB = 8192 // 8Gi in MB
	DefaultWorkerDiskGB   = 40
)

Default values for machine specs when not specified in TenantCluster

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder constructs CAPI resources for a TenantCluster.

func NewBuilder

NewBuilder creates a new CAPI resource builder.

func (*Builder) Build

func (b *Builder) Build() (*ResourceSet, error)

Build constructs all CAPI resources for the tenant cluster.

func (*Builder) GetOwnerReference

func (b *Builder) GetOwnerReference() metav1.OwnerReference

GetOwnerReference returns an OwnerReference for the TenantCluster.

func (*Builder) WithButlerConfig

func (b *Builder) WithButlerConfig(bc *butlerv1alpha1.ButlerConfig) *Builder

WithButlerConfig sets the ButlerConfig for platform-level settings. This enables reading ControlPlaneExposure for tcp-proxy auto-enablement.

func (*Builder) WithIngressIP

func (b *Builder) WithIngressIP(ip string) *Builder

WithIngressIP sets the external Ingress IP for TLS passthrough. This is used for Ingress/Gateway modes to configure worker /etc/hosts.

func (*Builder) WithNutanixCredentials

func (b *Builder) WithNutanixCredentials(username, password string) *Builder

WithNutanixCredentials sets the Nutanix credentials for CAPX secret generation. Must be called before Build() when using Nutanix provider.

type NutanixCredentials

type NutanixCredentials struct {
	Username string
	Password string
}

NutanixCredentials holds Nutanix Prism Central credentials.

type ResourceSet

type ResourceSet struct {
	Cluster                 *unstructured.Unstructured
	InfrastructureCluster   *unstructured.Unstructured
	ControlPlane            *unstructured.Unstructured
	MachineDeployment       *unstructured.Unstructured
	MachineTemplate         *unstructured.Unstructured
	BootstrapConfigTemplate *unstructured.Unstructured
	CredentialSecret        *unstructured.Unstructured
}

ResourceSet contains all CAPI resources needed for a tenant cluster.

func (*ResourceSet) AllResources

func (rs *ResourceSet) AllResources() []*unstructured.Unstructured

AllResources returns all resources as a slice for iteration. Order matters: credential secret must exist before NutanixCluster references it.

func (*ResourceSet) SetOwnerReferences

func (rs *ResourceSet) SetOwnerReferences(ref metav1.OwnerReference)

SetOwnerReferences sets owner references on all resources in the set.

Jump to

Keyboard shortcuts

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