controllers

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: Apache-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FgConfigMapName         = "osc-feature-gates"
	ConfidentialFeatureGate = "confidential"
	LayeredImageDeployment  = "layeredImageDeployment"
	DeploymentModeConfig    = "deploymentMode"
)
View Source
const (
	AWSProvider      = "aws"
	AzureProvider    = "azure"
	GCPProvider      = "gcp"
	LibvirtProvider  = "libvirt"
	IBMCloudProvider = "ibmcloud"
)
View Source
const (
	ImageCreatedSuccessfully = iota
	ImageDeletedSuccessfully
	RequeueNeeded
	ImageJobRunning
	ImageJobCompleted
	ImageJobFailed
	ImageCreationInProgress
	ImageDeletionInProgress
	UnsupportedPodVMImageProvider
	ImageCreationFailed        = -1
	ImageDeletionFailed        = -1
	CheckingJobStatusFailed    = -1
	ImageCreationStatusUnknown = -2
	ImageDeletionStatusUnknown = -2
)

Return values for ImageCreate and ImageDelete

View Source
const (
	PodVMImageJobCompleted        = "PodVMImageJobCompleted"
	PodVMImageJobFailed           = "PodVMImageJobFailed"
	PodVMImageJobRunning          = "PodVMImageJobRunning"
	PodVMImageJobStatusUnknown    = "PodVMImageJobStatusUnknown"
	PodVMImageUnsupportedProvider = "PodVMImageUnsupportedProvider"
)

Event Constants for the PodVM Image Job

View Source
const (
	// "Working"
	NodeWorking = mcfgconsts.MachineConfigDaemonStateWorking
	// "Done"
	NodeDone = mcfgconsts.MachineConfigDaemonStateDone
	// "Degraded"
	NodeDegraded = mcfgconsts.MachineConfigDaemonStateDegraded
)
View Source
const (
	FeatureGatesCM = "osc-feature-gates"
)
View Source
const (
	LayeredImageDeployCm = "layered-image-deploy-cm"
)
View Source
const (
	OperatorNamespace = "openshift-sandboxed-containers-operator"
)

Variables

View Source
var (
	ErrInitializingImageGenerator = errors.New("error initializing ImageGenerator instance")
	ErrUnsupportedCloudProvider   = errors.New("unsupported cloud provider, skipping image creation")
	ErrValidatingPeerPodsConfigs  = errors.New("error validating peer-pods-cm and peer-pods-secret")
	ErrCreatingImageConfigMap     = errors.New("error creating podvm image configMap from file")
	ErrUpdatingImageConfigMap     = errors.New("error updating podvm image configMap")
	ErrCreatingImageJob           = errors.New("error creating image job from yaml file")
	ErrCheckingJobStatus          = errors.New("error checking job status")
	ErrDeletingJob                = errors.New("error deleting job")
)

Custom error types

View Source
var DefaultFeatureGates = FeatureGateStatus{
	Confidential:           false,
	LayeredImageDeployment: false,
	DeploymentModeOption:   MachineConfigOption,
}

Functions

func GetImageForComponent added in v1.10.3

func GetImageForComponent(componentName string, client client.Client) (string, error)

GetImageForComponent retrieves the Docker image for a specified component. It uses the OpenShift client to fetch the cluster version and then loads the release info. It searches for the componentName in the release info and returns the corresponding Docker image.

func GetScc added in v1.3.2

func HostPathTypePtr added in v1.10.3

func HostPathTypePtr(hostPathType corev1.HostPathType) *corev1.HostPathType

func ImageCreate added in v1.5.0

func ImageCreate(c client.Client, kataConfig *kataconfigurationv1.KataConfig) (int, error)

ImageCreate creates a podvm image for a cloud provider if not present

func ImageDelete added in v1.5.0

func ImageDelete(c client.Client) (int, error)

ImageDelete deletes a podvm image for a cloud provider if present

func InitializeImageGenerator added in v1.6.0

func InitializeImageGenerator(client client.Client) error

func IsOpenShift

func IsOpenShift() (bool, error)

IsOpenShift detects if we are running in OpenShift using the discovery client

func MountProgagationRef added in v1.9.0

func MountProgagationRef(mode corev1.MountPropagationMode) *corev1.MountPropagationMode

Types

type ConfigMapEventHandler added in v1.6.0

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

func (*ConfigMapEventHandler) Create added in v1.6.0

func (*ConfigMapEventHandler) Delete added in v1.6.0

func (*ConfigMapEventHandler) Generic added in v1.6.0

func (*ConfigMapEventHandler) Update added in v1.6.0

type DeploymentMode added in v1.10.3

type DeploymentMode int

Create enum to represent the state of the deployment mode

const (
	MachineConfigMode DeploymentMode = iota
	DaemonSetMode
)

type DeploymentModeOption added in v1.10.3

type DeploymentModeOption string

Create enum to represent the configuration of the deployment mode

const (
	MachineConfigOption     DeploymentModeOption = "MachineConfig"
	DaemonSetOption         DeploymentModeOption = "DaemonSet"
	DaemonSetFallbackOption DeploymentModeOption = "DaemonSetFallback"
)

func ParseDeploymentModeOption added in v1.10.3

func ParseDeploymentModeOption(s string) (DeploymentModeOption, error)

func (DeploymentModeOption) String added in v1.10.3

func (d DeploymentModeOption) String() string

type FeatureGateState added in v1.6.0

type FeatureGateState int

Create enum to represent the state of the feature gates While today we just have two states, we retain the flexibility in case we want to introduce some additional states.

const (
	Enabled FeatureGateState = iota
	Disabled
)

type FeatureGateStatus added in v1.7.0

type FeatureGateStatus struct {
	Confidential           bool
	LayeredImageDeployment bool
	DeploymentModeOption   DeploymentModeOption
}

func (*FeatureGateStatus) IsEnabled added in v1.10.3

func (fgstatus *FeatureGateStatus) IsEnabled(key string) bool

type ImageGenerator added in v1.5.0

type ImageGenerator struct {
	CMimageIDKey string
	// contains filtered or unexported fields
}

func GetImageGenerator added in v1.6.0

func GetImageGenerator() *ImageGenerator

GetImageGenerator returns the global ImageGenerator instance

type KataConfigHandler added in v1.6.0

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

func (*KataConfigHandler) Create added in v1.6.0

kataConfig created, create credentialRequest if peerPods enabled

func (*KataConfigHandler) Delete added in v1.6.0

kataConfig deleted, delete credentialRequest if peerPods enabled

func (*KataConfigHandler) Generic added in v1.6.0

func (*KataConfigHandler) Update added in v1.6.0

kataConfig updated, create/delete credentialRequest if peerPods enabled/disabled

type KataConfigOpenShiftReconciler

type KataConfigOpenShiftReconciler struct {
	client.Client
	Log    logr.Logger
	Scheme *runtime.Scheme

	ImgMc *mcfgv1.MachineConfig

	DeploymentMode DeploymentMode
	// contains filtered or unexported fields
}

KataConfigOpenShiftReconciler reconciles a KataConfig object

func (*KataConfigOpenShiftReconciler) IsKataConfigStatusChanged added in v1.11.0

func (r *KataConfigOpenShiftReconciler) IsKataConfigStatusChanged(oldStatus, newStatus *kataconfigurationv1.KataConfigStatus) bool

func (*KataConfigOpenShiftReconciler) NewFeatureGateStatus added in v1.7.0

func (r *KataConfigOpenShiftReconciler) NewFeatureGateStatus() (*FeatureGateStatus, error)

This method returns a new FeatureGateStatus object that contains the status of the feature gates defined in the ConfigMap in the namespace Return default values if the ConfigMap is not found. Return values from the ConfigMap if the ConfigMap is not found. Use default values for missing entries in the ConfigMap. Return an error for any other reason, such as an API error.

func (*KataConfigOpenShiftReconciler) Reconcile

func (*KataConfigOpenShiftReconciler) SetupWithManager

func (r *KataConfigOpenShiftReconciler) SetupWithManager(mgr ctrl.Manager) error

type KataDaemonSetAction added in v1.10.3

type KataDaemonSetAction string

KataDaemonSetAction defines the possible actions that can be performed by Kata installation DaemonSet.

const (
	InstallKata   KataDaemonSetAction = "install"
	UninstallKata KataDaemonSetAction = "uninstall"
)

type KataInstallationDaemonSetState added in v1.10.3

type KataInstallationDaemonSetState string

KataInstallationDaemonSetState defines the possible states of the Kata installation DaemonSet.

const (
	KataWaitingToInstall   KataInstallationDaemonSetState = "waiting_to_install"
	KataInstalled          KataInstallationDaemonSetState = "installed"
	KataInstalling         KataInstallationDaemonSetState = "installing"
	KataWaitingForReboot   KataInstallationDaemonSetState = "waiting_for_reboot" // rpm-ostree changes applied after reboot
	KataWaitingToUninstall KataInstallationDaemonSetState = "waiting_to_uninstall"
	KataUninstalling       KataInstallationDaemonSetState = "uninstalling"
	KataUninstalled        KataInstallationDaemonSetState = "uninstalled"
)

TODO: Do we need to add Failed states?

type McpEventHandler added in v1.4.0

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

func (*McpEventHandler) Create added in v1.4.0

func (*McpEventHandler) Delete added in v1.4.0

func (*McpEventHandler) Generic added in v1.4.0

func (*McpEventHandler) Update added in v1.4.0

type NodeEventHandler added in v1.4.0

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

func (*NodeEventHandler) Create added in v1.4.0

func (*NodeEventHandler) Delete added in v1.4.0

func (*NodeEventHandler) Generic added in v1.4.0

func (*NodeEventHandler) Update added in v1.4.0

type PeerPodsConfigDaemonSetState added in v1.10.3

type PeerPodsConfigDaemonSetState string
const (
	PeerPodsConfigRemoving PeerPodsConfigDaemonSetState = "removing"
	PeerPodsConfigRemoved  PeerPodsConfigDaemonSetState = "removed"
)

type RuntimeClassReconciler added in v1.11.0

type RuntimeClassReconciler struct {
	client.Client
	Log    logr.Logger
	Scheme *runtime.Scheme
}

RuntimeClassReconciler reconciles RuntimeClass objects to handle finalizers

func (*RuntimeClassReconciler) Reconcile added in v1.11.0

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

Reconcile handles RuntimeClass lifecycle, specifically finalizer cleanup

func (*RuntimeClassReconciler) SetupWithManager added in v1.11.0

func (r *RuntimeClassReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager

type SecretReconciler added in v1.6.0

type SecretReconciler struct {
	client.Client
	Log    logr.Logger
	Scheme *runtime.Scheme
}

SecretReconciler reconciles a Secret object

func (*SecretReconciler) Reconcile added in v1.6.0

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

Reconciles cco-secret secret based on the secretsFilterPredicate and maps the cco-secret created by the cloud-credentials-operator to peer-pods compatible secret KataConfigs are handled by the KataConfigHandler to create/delete credentialRequests from cloud-credentials-operator see: https://github.com/openshift/cloud-credential-operator/tree/master?tab=readme-ov-file#openshift-cloud-credential-operator

func (*SecretReconciler) SetupWithManager added in v1.6.0

func (r *SecretReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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