Documentation
¶
Index ¶
- Constants
- Variables
- func GetImageForComponent(componentName string, client client.Client) (string, error)
- func GetScc() *secv1.SecurityContextConstraints
- func HostPathTypePtr(hostPathType corev1.HostPathType) *corev1.HostPathType
- func ImageCreate(c client.Client, kataConfig *kataconfigurationv1.KataConfig) (int, error)
- func ImageDelete(c client.Client) (int, error)
- func InitializeImageGenerator(client client.Client) error
- func IsOpenShift() (bool, error)
- func MountProgagationRef(mode corev1.MountPropagationMode) *corev1.MountPropagationMode
- type ConfigMapEventHandler
- func (ch *ConfigMapEventHandler) Create(ctx context.Context, event event.CreateEvent, ...)
- func (ch *ConfigMapEventHandler) Delete(ctx context.Context, event event.DeleteEvent, ...)
- func (ch *ConfigMapEventHandler) Generic(ctx context.Context, event event.GenericEvent, ...)
- func (ch *ConfigMapEventHandler) Update(ctx context.Context, event event.UpdateEvent, ...)
- type DeploymentMode
- type DeploymentModeOption
- type FeatureGateState
- type FeatureGateStatus
- type ImageGenerator
- type KataConfigHandler
- func (kh *KataConfigHandler) Create(ctx context.Context, event event.CreateEvent, ...)
- func (kh *KataConfigHandler) Delete(ctx context.Context, event event.DeleteEvent, ...)
- func (kh *KataConfigHandler) Generic(context.Context, event.GenericEvent, ...)
- func (kh *KataConfigHandler) Update(ctx context.Context, event event.UpdateEvent, ...)
- type KataConfigOpenShiftReconciler
- func (r *KataConfigOpenShiftReconciler) IsKataConfigStatusChanged(oldStatus, newStatus *kataconfigurationv1.KataConfigStatus) bool
- func (r *KataConfigOpenShiftReconciler) NewFeatureGateStatus() (*FeatureGateStatus, error)
- func (r *KataConfigOpenShiftReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *KataConfigOpenShiftReconciler) SetupWithManager(mgr ctrl.Manager) error
- type KataDaemonSetAction
- type KataInstallationDaemonSetState
- type McpEventHandler
- func (eh *McpEventHandler) Create(ctx context.Context, event event.CreateEvent, ...)
- func (eh *McpEventHandler) Delete(ctx context.Context, event event.DeleteEvent, ...)
- func (eh *McpEventHandler) Generic(ctx context.Context, event event.GenericEvent, ...)
- func (eh *McpEventHandler) Update(ctx context.Context, event event.UpdateEvent, ...)
- type NodeEventHandler
- func (eh *NodeEventHandler) Create(ctx context.Context, event event.CreateEvent, ...)
- func (eh *NodeEventHandler) Delete(ctx context.Context, event event.DeleteEvent, ...)
- func (eh *NodeEventHandler) Generic(ctx context.Context, event event.GenericEvent, ...)
- func (eh *NodeEventHandler) Update(ctx context.Context, event event.UpdateEvent, ...)
- type PeerPodsConfigDaemonSetState
- type RuntimeClassReconciler
- type SecretReconciler
Constants ¶
const ( FgConfigMapName = "osc-feature-gates" ConfidentialFeatureGate = "confidential" LayeredImageDeployment = "layeredImageDeployment" DeploymentModeConfig = "deploymentMode" )
const ( AWSProvider = "aws" AzureProvider = "azure" GCPProvider = "gcp" LibvirtProvider = "libvirt" IBMCloudProvider = "ibmcloud" )
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
const ( PodVMImageJobCompleted = "PodVMImageJobCompleted" PodVMImageJobFailed = "PodVMImageJobFailed" PodVMImageJobRunning = "PodVMImageJobRunning" PodVMImageJobStatusUnknown = "PodVMImageJobStatusUnknown" PodVMImageUnsupportedProvider = "PodVMImageUnsupportedProvider" )
Event Constants for the PodVM Image Job
const ( // "Working" NodeWorking = mcfgconsts.MachineConfigDaemonStateWorking // "Done" NodeDone = mcfgconsts.MachineConfigDaemonStateDone // "Degraded" NodeDegraded = mcfgconsts.MachineConfigDaemonStateDegraded )
const (
FeatureGatesCM = "osc-feature-gates"
)
const (
LayeredImageDeployCm = "layered-image-deploy-cm"
)
const (
OperatorNamespace = "openshift-sandboxed-containers-operator"
)
Variables ¶
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
var DefaultFeatureGates = FeatureGateStatus{ Confidential: false, LayeredImageDeployment: false, DeploymentModeOption: MachineConfigOption, }
Functions ¶
func GetImageForComponent ¶ added in v1.10.3
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 GetScc() *secv1.SecurityContextConstraints
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
ImageDelete deletes a podvm image for a cloud provider if present
func InitializeImageGenerator ¶ added in v1.6.0
func IsOpenShift ¶
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 (ch *ConfigMapEventHandler) Create(ctx context.Context, event event.CreateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request])
func (*ConfigMapEventHandler) Delete ¶ added in v1.6.0
func (ch *ConfigMapEventHandler) Delete(ctx context.Context, event event.DeleteEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request])
func (*ConfigMapEventHandler) Generic ¶ added in v1.6.0
func (ch *ConfigMapEventHandler) Generic(ctx context.Context, event event.GenericEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request])
func (*ConfigMapEventHandler) Update ¶ added in v1.6.0
func (ch *ConfigMapEventHandler) Update(ctx context.Context, event event.UpdateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request])
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
func (kh *KataConfigHandler) Create(ctx context.Context, event event.CreateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request])
kataConfig created, create credentialRequest if peerPods enabled
func (*KataConfigHandler) Delete ¶ added in v1.6.0
func (kh *KataConfigHandler) Delete(ctx context.Context, event event.DeleteEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request])
kataConfig deleted, delete credentialRequest if peerPods enabled
func (*KataConfigHandler) Generic ¶ added in v1.6.0
func (kh *KataConfigHandler) Generic(context.Context, event.GenericEvent, workqueue.TypedRateLimitingInterface[reconcile.Request])
func (*KataConfigHandler) Update ¶ added in v1.6.0
func (kh *KataConfigHandler) Update(ctx context.Context, event event.UpdateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request])
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) 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 (eh *McpEventHandler) Create(ctx context.Context, event event.CreateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request])
func (*McpEventHandler) Delete ¶ added in v1.4.0
func (eh *McpEventHandler) Delete(ctx context.Context, event event.DeleteEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request])
func (*McpEventHandler) Generic ¶ added in v1.4.0
func (eh *McpEventHandler) Generic(ctx context.Context, event event.GenericEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request])
func (*McpEventHandler) Update ¶ added in v1.4.0
func (eh *McpEventHandler) Update(ctx context.Context, event event.UpdateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request])
type NodeEventHandler ¶ added in v1.4.0
type NodeEventHandler struct {
// contains filtered or unexported fields
}
func (*NodeEventHandler) Create ¶ added in v1.4.0
func (eh *NodeEventHandler) Create(ctx context.Context, event event.CreateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request])
func (*NodeEventHandler) Delete ¶ added in v1.4.0
func (eh *NodeEventHandler) Delete(ctx context.Context, event event.DeleteEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request])
func (*NodeEventHandler) Generic ¶ added in v1.4.0
func (eh *NodeEventHandler) Generic(ctx context.Context, event event.GenericEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request])
func (*NodeEventHandler) Update ¶ added in v1.4.0
func (eh *NodeEventHandler) Update(ctx context.Context, event event.UpdateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request])
type PeerPodsConfigDaemonSetState ¶ added in v1.10.3
type PeerPodsConfigDaemonSetState string
const ( PeerPodsConfigRemoving PeerPodsConfigDaemonSetState = "removing" PeerPodsConfigRemoved PeerPodsConfigDaemonSetState = "removed" )
type RuntimeClassReconciler ¶ added in v1.11.0
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
SecretReconciler reconciles a Secret object
func (*SecretReconciler) Reconcile ¶ added in v1.6.0
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.