cloudinit

package
v0.1.0-latest-stable Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DPFCfgPath    = "/etc/cloud/cloud.cfg.d/dpf.cfg"
	DPFCfgPerms   = "0644"
	UserDataPath  = "/var/lib/cloud/seed/nocloud-net/user-data"
	UserDataPerms = "0600"
)

Variables

This section is empty.

Functions

func ExtractUbuntuPassword

func ExtractUbuntuPassword(flavor *provisioningv1.DPUFlavor) string

ExtractUbuntuPassword returns the ubuntu_PASSWORD value from the DPUFlavor's BFCfgParameters, single-quoted if not already.

NOTE: BFCfgParameters is a BF3/bf.cfg concept. On BF3 this is the natural place for the password, but BF4 has no bf.cfg so sourcing it from here is a stopgap. Once a dedicated password field is added to the DPUFlavor spec for BF4, this function should read from there instead.

Types

type File

type File struct {
	Path        string
	Permissions string
	Content     string
}

File represents a cloud-init file with its target path, permissions, and rendered content.

func GenerateNetworkCfg

func GenerateNetworkCfg() File

GenerateNetworkCfg returns the dpf.cfg file that disables cloud-init's default network configuration

func GenerateUserData

func GenerateUserData(params Params) (File, error)

GenerateUserData renders the cloud-init user-data file from the given Params. The caller must ensure ApplyFlavor has already been called (e.g. via ResolveParams).

type Params

type Params struct {
	DPUHostName            string
	KubeadmSecretName      string
	KubeadmSecretNamespace string
	BootstrapKubeconfig    string
	// SpiffeMode enables SPIRE/spiffe-helper rendering and SPIFFE dpu-agent flags.
	SpiffeMode bool
	// SPIFFEKubeconfig is the tokenFile kubeconfig for SPIFFE-mode DPUs.
	SPIFFEKubeconfig string
	// SPIRETrustBundle, when non-empty, is the initial trust bundle emitted on a SPIFFE-mode DPU.
	// It is mutually exclusive with BootstrapKubeconfig (a DPU uses exactly one identity mode).
	SPIRETrustBundle       string
	SPIRETrustBundlePath   string
	SPIRETrustBundleFormat string
	SPIREServerHost        string
	SPIREServerPort        int
	SPIRETrustDomain       string
	KubeAPIAudience        string
	SpiffeTokenPath        string
	SpiffeAgentSocketPath  string
	SpiffePluginPath       string
	// SpiffeCertDir and SpiffeTokenFileName are SpiffeTokenPath split into the
	// spiffe-helper cert_dir and the JWT SVID file name (relative to cert_dir).
	SpiffeCertDir        string
	SpiffeTokenFileName  string
	SpiffeAgentSocketDir string
	ControlPlaneMTU      int
	DPUName              string
	DPUNamespace         string
	DPUUID               string
	DPUType              provisioningv1.DPUType
	DPUAgentRepoURL      string
	// DPUFlavorYAML is the marshaled DPUFlavor for custom bf.cfg templates.
	// Default user-data does not write it; dpu-agent loads DPUFlavor from the API.
	// DPUFlavorYAML is deprecated because DPUFlavor is loaded from the API instead.
	DPUFlavorYAML    string
	UbuntuPassword   string
	ConfigFiles      []WriteFile
	OVSRawScript     string
	OOBNetwork       bool
	RedfishInterface bool
	BFBRegistryURL   string
	AstraEnabled     bool
	NICDeviceCount   int

	// SpiffeTokenExchangeEndpoint enables optional exchange before writing the token.
	SpiffeTokenExchangeEndpoint string
	// CATrustBundle holds one or more concatenated PEM certificates for the DPF CA. When set, it is
	// written to the DPU OS trust store via cloud-init and installed with update-ca-certificates so
	// the DPU OS (apt over HTTPS, etc.) validates the bfb-registry server certificate.
	CATrustBundle string
}

Params holds the parameters for cloud-init file generation.

func ResolveParams

ResolveParams builds the Params needed to provision a DPU by reading the DPFOperatorConfig and the DPU/Secret objects, and applying flavor-derived fields. It also returns the DPFOperatorConfig for callers that need it (e.g. bf.cfg template resolution).

func (*Params) ApplyFlavor

func (p *Params) ApplyFlavor(flavor *provisioningv1.DPUFlavor) error

ApplyFlavor populates the flavor-derived fields from the given DPUFlavor.

type WriteFile

type WriteFile struct {
	Path        string
	IsAppend    bool
	Content     string
	Permissions string
}

Jump to

Keyboard shortcuts

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