controller

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	FirmwareTypeGFX         = "GFX"
	FirmwareTypeGFXDATA     = "GFX_DATA"
	FirmwareTypeGFXCODEDATA = "GFX_CODE_DATA"
	FirmwareTypeGFXPSCBIN   = "GFX_PSCBIN"
	FirmwareTypeAMC         = "AMC"
	FirmwareTypeFANTABLE    = "FAN_TABLE"
	FirmwareTypeVRCONFIG    = "VR_CONFIG"
	FirmwareTypeOPROMCODE   = "OPROM_CODE"
	FirmwareTypeOPROMDATA   = "OPROM_DATA"
)

Variables

This section is empty.

Functions

func SetupDrainIndices added in v0.4.0

func SetupDrainIndices(ctx context.Context, mgr ctrl.Manager) error

SetupDrainIndices registers the cache indexes the drain primitives need. Call it once per manager, from main, before any controller that drains is set up.

Types

type ClusterPolicyReconciler

type ClusterPolicyReconciler struct {
	client.Client
	APIReader client.Reader
	Scheme    *runtime.Scheme
	Opts      ControllerOpts
}

ClusterPolicyReconciler reconciles a ClusterPolicy object

func (*ClusterPolicyReconciler) Reconcile

func (r *ClusterPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Main Reconcile function for ClusterPolicy. Individual sub-controllers will be called from here to handle their respective resources, and any errors they return will be aggregated into the ClusterPolicy status.

func (*ClusterPolicyReconciler) SetupWithManager

func (r *ClusterPolicyReconciler) SetupWithManager(mgr ctrl.Manager, opts ControllerOpts) error

SetupWithManager sets up the controller with the Manager.

type ContentImageVerifier

type ContentImageVerifier interface {
	VerifyImage(ctx context.Context, req ImageVerifyRequest) error
}

ContentImageVerifier checks whether an image is reachable and, when checksums are declared, verifies each file's SHA256 against the image contents.

type ControllerOpts

type ControllerOpts struct {
	ReqName                        string
	Namespace                      string
	SecretName                     string
	RequeueDelay                   time.Duration
	DRAEnable                      bool
	OpenShift                      bool
	KMMEnable                      bool
	ModuleLoaderServiceAccountName string
	KMMModuleReadyLabel            string
}

type DRAReconciler

type DRAReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	Opts   ControllerOpts
}

func (*DRAReconciler) Reconcile

func (r *DRAReconciler) Reconcile(ctx context.Context, cp *v1alpha.ClusterPolicy) (ctrl.Result, error)

type DefaultContentImageVerifier

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

DefaultContentImageVerifier implements ContentImageVerifier using the OCI registry API.

func (*DefaultContentImageVerifier) VerifyImage added in v0.4.0

VerifyImage checks one image against the registry. With no Files it confirms only that the reference parses, authenticates and resolves. With Files it additionally streams the merged filesystem and checks each named file exists, verifying SHA256 where declared.

type DefaultLogsRetriever

type DefaultLogsRetriever struct {
	Clientset *kubernetes.Clientset
}

func (*DefaultLogsRetriever) RetrieveLogsForPodContainer

func (d *DefaultLogsRetriever) RetrieveLogsForPodContainer(ctx context.Context, pod *core.Pod, containerName string) ([]string, error)

type DevicePluginReconciler

type DevicePluginReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	Opts   ControllerOpts
}

func (*DevicePluginReconciler) Reconcile

type GPUFirmwareUpdateReconciler

type GPUFirmwareUpdateReconciler struct {
	client.Client
	Scheme *runtime.Scheme

	Opts ControllerOpts
	// contains filtered or unexported fields
}

GPUFirmwareUpdateReconciler reconciles a GPUFirmwareUpdate object

func (*GPUFirmwareUpdateReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

func (*GPUFirmwareUpdateReconciler) SetupWithManager

func (r *GPUFirmwareUpdateReconciler) SetupWithManager(mgr ctrl.Manager, copts ControllerOpts) error

SetupWithManager sets up the controller with the Manager.

type GPURecoveryPlanReconciler added in v0.4.0

type GPURecoveryPlanReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	Opts   ControllerOpts

	// APIReader reads straight from the API server, bypassing the manager cache. Only the plan
	// itself is read through it, see getPlan.
	APIReader client.Reader
	// contains filtered or unexported fields
}

func (*GPURecoveryPlanReconciler) Reconcile added in v0.4.0

func (r *GPURecoveryPlanReconciler) Reconcile(ctx context.Context, req ctrl.Request) (retRes ctrl.Result, retErr error)

Reconcile is the main reconciliation loop for GPURecoveryPlan.

The loop is triggered by a change to a GPURecoveryPlan (an admin adding an approval, or the operator's own status write), by a recovery Job the plan owns reaching a new state, or by a ResourceSlice event routed through resourceSliceToPlans.

The phases run in a fixed order, each reading what the one before it wrote: detection mirrors the tainted GPUs into status.events, approvals send the approved ones into a node drain, the drain phase creates the recovery Job for every node that has come clear, and the Job sync reports what those Jobs did. status.state is derived once, at the end, from the event states all of them have settled on.

func (*GPURecoveryPlanReconciler) SetupWithManager added in v0.4.0

func (r *GPURecoveryPlanReconciler) SetupWithManager(mgr ctrl.Manager, opts ControllerOpts) error

SetupWithManager sets up the controller with the Manager.

type ImageFile added in v0.4.0

type ImageFile struct {
	// Name is the file's path in the image's merged filesystem, e.g. "/fwupdate/gfx.bin".
	// A leading "/" or "./" is optional.
	Name string

	// Checksum is the expected SHA256 as "sha256:<64 hex characters>". Empty means the file's
	// existence is checked but its contents are not.
	Checksum string
}

ImageFile is a file the verifier expects to find in the image. It is deliberately not an API type: the verifier only ever needs a name and an optional checksum, so callers convert from whatever their CRD happens to call those fields.

type ImageVerifyRequest added in v0.4.0

type ImageVerifyRequest struct {
	// Image is the reference to check.
	Image string

	// PullSecret names a dockerconfigjson Secret in the operator namespace, or "" to use the
	// ambient keychain.
	PullSecret string

	// InsecureSkipTLSVerify disables registry certificate validation.
	InsecureSkipTLSVerify bool

	// Files, when non-empty must exist in the image, and are SHA256-verified wherever a checksum is declared.
	// If no files are declared, only the image reference is checked for reachability and authentication.
	Files []ImageFile
}

ImageVerifyRequest describes one image to check. Callers assemble it from wherever they keep their image reference and pull settings, so a caller holding several images in unrelated fields can ask for a different depth of check for each.

type KMMReconciler added in v0.4.0

type KMMReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	Opts   ControllerOpts
}

KMMReconciler manages a KMM Module CR for out-of-tree kernel module loading. It only configures the moduleLoader section — DP/DRA lifecycle remains with the native controllers.

func (*KMMReconciler) Reconcile added in v0.4.0

func (r *KMMReconciler) Reconcile(ctx context.Context, cp *v1alpha.ClusterPolicy) (ctrl.Result, error)

type LogsRetriever

type LogsRetriever interface {
	RetrieveLogsForPodContainer(ctx context.Context, pod *core.Pod, containerName string) ([]string, error)
}

type MiscReconciler

type MiscReconciler struct {
	client.Client
	APIReader client.Reader
	Scheme    *runtime.Scheme
	Opts      ControllerOpts
	CrdNames  []string
}

func (*MiscReconciler) Reconcile

func (r *MiscReconciler) Reconcile(ctx context.Context, cp *v1alpha.ClusterPolicy) (ctrl.Result, error)

type SubControllerInterface

type SubControllerInterface interface {
	Reconcile(ctx context.Context, cp *v1alpha.ClusterPolicy) (ctrl.Result, error)
}

type XpuManagerReconciler

type XpuManagerReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	Opts   ControllerOpts
}

func (*XpuManagerReconciler) Reconcile

type XpumDeviceRefreshReconciler added in v0.4.0

type XpumDeviceRefreshReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	Opts   ControllerOpts
	// contains filtered or unexported fields
}

func (*XpumDeviceRefreshReconciler) Reconcile added in v0.4.0

Reconcile checks one node's xpum pods against the GPUs the node currently has, and replaces a pod that cannot reach one of them.

func (*XpumDeviceRefreshReconciler) SetupWithManager added in v0.4.0

func (r *XpumDeviceRefreshReconciler) SetupWithManager(mgr ctrl.Manager, opts ControllerOpts) error

SetupWithManager registers the controller with the Manager.

There is no For() object: requests are node names rather than objects, and both watches map into that keyspace. It is a top-level controller rather than a ClusterPolicy sub-reconciler on purpose — ResourceSlice churn is frequent, and fanning it into ClusterPolicy would re-run the device plugin, DRA and misc reconcilers and diff three DaemonSets every time a GPU's taints changed.

The ClusterPolicy is read on every pass but not watched, so a mode change takes effect on the next slice or pod event for a node rather than immediately. Nothing durable depends on the mode, so there is nothing for the change to act on retroactively.

Jump to

Keyboard shortcuts

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