Documentation ¶
Index ¶
- Constants
- Variables
- func DecodePublicKey(keyBytes []byte) (*rsa.PublicKey, error)
- func FindDataImportCronConditionByType(cron *cdiv1.DataImportCron, conditionType cdiv1.DataImportCronConditionType) *cdiv1.DataImportCronCondition
- func FindDataSourceConditionByType(ds *cdiv1.DataSource, conditionType cdiv1.DataSourceConditionType) *cdiv1.DataSourceCondition
- func GetCronJobName(cron *cdiv1.DataImportCron) string
- func GetFilesystemOverhead(ctx context.Context, client client.Client, pvc *corev1.PersistentVolumeClaim) (cdiv1.Percent, error)
- func GetImportProxyConfig(config *cdiv1.CDIConfig, field string) (string, error)
- func GetImportProxyConfigMapName(pvcName string) string
- func GetInitialJobName(cron *cdiv1.DataImportCron) string
- func GetScratchPvcStorageClass(client client.Client, pvc *corev1.PersistentVolumeClaim) string
- func GetUploadServerURL(namespace, pvc, uploadPath string) string
- func InitPollerPodSpec(c client.Client, cron *cdiv1.DataImportCron, podSpec *corev1.PodSpec, ...) error
- func IsInsecureTLS(ep string, cdiConfig *cdiv1.CDIConfig, log logr.Logger) (bool, error)
- func MakeCloneSourcePodSpec(sourceVolumeMode corev1.PersistentVolumeMode, ...) *corev1.Pod
- func MakeEmptyStorageProfileSpec(name string) *cdiv1.StorageProfile
- func MakePVCOwnerReference(pvc *corev1.PersistentVolumeClaim) metav1.OwnerReference
- func MakePodOwnerReference(pod *corev1.Pod) metav1.OwnerReference
- func NewCloneController(mgr manager.Manager, log logr.Logger, image, pullPolicy, verbose string, ...) (controller.Controller, error)
- func NewConfigController(mgr manager.Manager, log logr.Logger, ...) (controller.Controller, error)
- func NewDataImportCronController(mgr manager.Manager, log logr.Logger, importerImage, pullPolicy string, ...) (controller.Controller, error)
- func NewDataSourceController(mgr manager.Manager, log logr.Logger, installerLabels map[string]string) (controller.Controller, error)
- func NewImportController(mgr manager.Manager, log logr.Logger, ...) (controller.Controller, error)
- func NewStorageProfileController(mgr manager.Manager, log logr.Logger, installerLabels map[string]string) (controller.Controller, error)
- func NewUploadController(mgr manager.Manager, log logr.Logger, uploadImage, pullPolicy, verbose string, ...) (controller.Controller, error)
- func ParseCloneRequestAnnotation(pvc *corev1.PersistentVolumeClaim) (exists bool, namespace, name string)
- func UploadPossibleForPVC(pvc *corev1.PersistentVolumeClaim) error
- func ValidateCanCloneSourceAndTargetContentType(sourcePvc, targetPvc *corev1.PersistentVolumeClaim) (cdiv1.DataVolumeContentType, error)
- func ValidateCanCloneSourceAndTargetSpec(ctx context.Context, c client.Client, ...) error
- type CDIConfigReconciler
- type CloneReconciler
- type CryptoEnvVars
- type DataImportCronReconciler
- type DataSourceReconciler
- type ImportReconciler
- type StorageProfileReconciler
- type UploadPodArgs
- type UploadReconciler
Constants ¶
const ( // TokenKeyDir is the path to the apiserver public key dir //nolint:gosec // This is a path, not the key itself TokenKeyDir = "/var/run/cdi/token/keys" // TokenPublicKeyPath is the path to the apiserver public key TokenPublicKeyPath = TokenKeyDir + "/id_rsa.pub" // TokenPrivateKeyPath is the path to the apiserver private key TokenPrivateKeyPath = TokenKeyDir + "/id_rsa" // CloneSucceededPVC provides a const to indicate a clone to the PVC succeeded CloneSucceededPVC = "CloneSucceeded" )
const ( // ErrDataSourceAlreadyManaged provides a const to indicate DataSource already managed error ErrDataSourceAlreadyManaged = "ErrDataSourceAlreadyManaged" // MessageDataSourceAlreadyManaged provides a const to form DataSource already managed error message MessageDataSourceAlreadyManaged = "DataSource %s is already managed by DataImportCron %s" )
const ( // AnnSourceDesiredDigest is the digest of the pending updated image AnnSourceDesiredDigest = cc.AnnAPIGroup + "/storage.import.sourceDesiredDigest" // AnnImageStreamDockerRef is the ImageStream Docker reference AnnImageStreamDockerRef = cc.AnnAPIGroup + "/storage.import.imageStreamDockerRef" // AnnNextCronTime is the next time stamp which satisfies the cron expression AnnNextCronTime = cc.AnnAPIGroup + "/storage.import.nextCronTime" // AnnLastCronTime is the cron last execution time stamp AnnLastCronTime = cc.AnnAPIGroup + "/storage.import.lastCronTime" // AnnLastUseTime is the PVC last use time stamp AnnLastUseTime = cc.AnnAPIGroup + "/storage.import.lastUseTime" // AnnStorageClass is the cron DV's storage class AnnStorageClass = cc.AnnAPIGroup + "/storage.import.storageClass" )
const ( // ErrImportFailedPVC provides a const to indicate an import to the PVC failed ErrImportFailedPVC = "ErrImportFailed" // ImportSucceededPVC provides a const to indicate an import to the PVC failed ImportSucceededPVC = "ImportSucceeded" // ImportTargetInUse is reason for event created when an import pvc is in use ImportTargetInUse = "ImportTargetInUse" )
const ( // AnnUploadClientName is the TLS name uploadserver will accept requests from AnnUploadClientName = "cdi.kubevirt.io/uploadClientName" // AnnUploadPod name of the upload pod AnnUploadPod = "cdi.kubevirt.io/storage.uploadPodName" // UploadSucceededPVC provides a const to indicate an import to the PVC failed UploadSucceededPVC = "UploadSucceeded" // UploadTargetInUse is reason for event created when an upload pvc is in use UploadTargetInUse = "UploadTargetInUse" )
const ( // CertVolName is the name of the volume containing certs CertVolName = "cdi-cert-vol" // SecretVolName is the name of the volume containing gcs key //nolint:gosec // This is not a real secret SecretVolName = "cdi-secret-vol" // AnnOwnerRef is used when owner is in a different namespace AnnOwnerRef = cc.AnnAPIGroup + "/storage.ownerRef" // PodRunningReason is const that defines the pod was started as a reason PodRunningReason = "Pod is running" // ScratchSpaceRequiredReason is a const that defines the pod exited due to a lack of scratch space ScratchSpaceRequiredReason = "Scratch space required" // ImagePullFailedReason is a const that defines the pod exited due to failure when pulling image ImagePullFailedReason = "ImagePullFailed" // ImportCompleteMessage is a const that defines the pod completeded the import successfully ImportCompleteMessage = "Import Complete" // ProxyCertVolName is the name of the volumecontaining certs ProxyCertVolName = "cdi-proxy-cert-vol" // ClusterWideProxyAPIGroup is the APIGroup for OpenShift Cluster Wide Proxy ClusterWideProxyAPIGroup = "config.openshift.io" // ClusterWideProxyAPIKind is the APIKind for OpenShift Cluster Wide Proxy ClusterWideProxyAPIKind = "Proxy" // ClusterWideProxyAPIVersion is the APIVersion for OpenShift Cluster Wide Proxy ClusterWideProxyAPIVersion = "v1" // ClusterWideProxyName is the OpenShift Cluster Wide Proxy object name. There is only one obj in the cluster. ClusterWideProxyName = "cluster" // ClusterWideProxyConfigMapName is the OpenShift Cluster Wide Proxy ConfigMap name for CA certificates. ClusterWideProxyConfigMapName = "user-ca-bundle" // ClusterWideProxyConfigMapNameSpace is the OpenShift Cluster Wide Proxy ConfigMap namespace for CA certificates. ClusterWideProxyConfigMapNameSpace = "openshift-config" // ClusterWideProxyConfigMapKey is the OpenShift Cluster Wide Proxy ConfigMap key name for CA certificates. ClusterWideProxyConfigMapKey = "ca-bundle.crt" )
const (
AnnConfigAuthority = "cdi.kubevirt.io/configAuthority"
)
AnnConfigAuthority is the annotation specifying a resource as the CDIConfig authority
Variables ¶
var ErrNotManagedByCron = errors.New("DataSource is not managed by this DataImportCron")
Functions ¶
func DecodePublicKey ¶ added in v1.9.4
DecodePublicKey turns a bunch of bytes into a public key
func FindDataImportCronConditionByType ¶ added in v1.42.0
func FindDataImportCronConditionByType(cron *cdiv1.DataImportCron, conditionType cdiv1.DataImportCronConditionType) *cdiv1.DataImportCronCondition
FindDataImportCronConditionByType finds DataImportCronCondition by condition type
func FindDataSourceConditionByType ¶ added in v1.42.0
func FindDataSourceConditionByType(ds *cdiv1.DataSource, conditionType cdiv1.DataSourceConditionType) *cdiv1.DataSourceCondition
FindDataSourceConditionByType finds DataSourceCondition by condition type
func GetCronJobName ¶ added in v1.41.1
func GetCronJobName(cron *cdiv1.DataImportCron) string
GetCronJobName get CronJob name based on cron name and UID
func GetFilesystemOverhead ¶ added in v1.24.0
func GetFilesystemOverhead(ctx context.Context, client client.Client, pvc *corev1.PersistentVolumeClaim) (cdiv1.Percent, error)
GetFilesystemOverhead determines the filesystem overhead defined in CDIConfig for this PVC's volumeMode and storageClass.
func GetImportProxyConfig ¶ added in v1.31.0
GetImportProxyConfig attempts to import proxy URLs if configured in the CDIConfig.
func GetImportProxyConfigMapName ¶ added in v1.56.0
GetImportProxyConfigMapName returns the import proxy ConfigMap name
func GetInitialJobName ¶ added in v1.43.1
func GetInitialJobName(cron *cdiv1.DataImportCron) string
GetInitialJobName get initial job name based on cron name and UID
func GetScratchPvcStorageClass ¶ added in v1.7.0
func GetScratchPvcStorageClass(client client.Client, pvc *corev1.PersistentVolumeClaim) string
GetScratchPvcStorageClass tries to determine which storage class to use for use with a scratch persistent volume claim. The order of preference is the following: 1. Defined value in CDI Config field scratchSpaceStorageClass. 2. If 1 is not available, use the storage class name of the original pvc that will own the scratch pvc. 3. If none of those are available, return blank.
func GetUploadServerURL ¶ added in v1.10.1
GetUploadServerURL returns the url the proxy should post to for a particular pvc
func InitPollerPodSpec ¶ added in v1.57.0
func InitPollerPodSpec(c client.Client, cron *cdiv1.DataImportCron, podSpec *corev1.PodSpec, image string, pullPolicy corev1.PullPolicy, log logr.Logger) error
InitPollerPodSpec inits poller PodSpec
func IsInsecureTLS ¶ added in v1.41.1
IsInsecureTLS checks if TLS security is disabled for the given endpoint
func MakeCloneSourcePodSpec ¶
func MakeCloneSourcePodSpec(sourceVolumeMode corev1.PersistentVolumeMode, image, pullPolicy, ownerRefAnno string, imagePullSecrets []corev1.LocalObjectReference, serverCACert []byte, targetPvc, sourcePvc *corev1.PersistentVolumeClaim, resourceRequirements *corev1.ResourceRequirements, workloadNodePlacement *sdkapi.NodePlacement) *corev1.Pod
MakeCloneSourcePodSpec creates and returns the clone source pod spec based on the target pvc.
func MakeEmptyStorageProfileSpec ¶ added in v1.33.0
func MakeEmptyStorageProfileSpec(name string) *cdiv1.StorageProfile
MakeEmptyStorageProfileSpec creates StorageProfile manifest
func MakePVCOwnerReference ¶ added in v1.5.1
func MakePVCOwnerReference(pvc *corev1.PersistentVolumeClaim) metav1.OwnerReference
MakePVCOwnerReference makes owner reference from a PVC
func MakePodOwnerReference ¶ added in v1.5.1
func MakePodOwnerReference(pod *corev1.Pod) metav1.OwnerReference
MakePodOwnerReference makes owner reference from a Pod
func NewCloneController ¶
func NewCloneController(mgr manager.Manager, log logr.Logger, image, pullPolicy, verbose string, clientCertGenerator generator.CertGenerator, serverCAFetcher fetcher.CertBundleFetcher, apiServerKey *rsa.PublicKey, installerLabels map[string]string) (controller.Controller, error)
NewCloneController creates a new instance of the config controller.
func NewConfigController ¶ added in v1.6.0
func NewConfigController(mgr manager.Manager, log logr.Logger, uploadProxyServiceName, configName string, installerLabels map[string]string) (controller.Controller, error)
NewConfigController creates a new instance of the config controller.
func NewDataImportCronController ¶ added in v1.41.1
func NewDataImportCronController(mgr manager.Manager, log logr.Logger, importerImage, pullPolicy string, installerLabels map[string]string) (controller.Controller, error)
NewDataImportCronController creates a new instance of the DataImportCron controller
func NewDataSourceController ¶ added in v1.43.0
func NewDataSourceController(mgr manager.Manager, log logr.Logger, installerLabels map[string]string) (controller.Controller, error)
NewDataSourceController creates a new instance of the DataSource controller
func NewImportController ¶
func NewImportController(mgr manager.Manager, log logr.Logger, importerImage, pullPolicy, verbose string, installerLabels map[string]string) (controller.Controller, error)
NewImportController creates a new instance of the import controller.
func NewStorageProfileController ¶ added in v1.33.0
func NewStorageProfileController(mgr manager.Manager, log logr.Logger, installerLabels map[string]string) (controller.Controller, error)
NewStorageProfileController creates a new instance of the StorageProfile controller.
func NewUploadController ¶
func NewUploadController(mgr manager.Manager, log logr.Logger, uploadImage, pullPolicy, verbose string, serverCertGenerator generator.CertGenerator, clientCAFetcher fetcher.CertBundleFetcher, installerLabels map[string]string) (controller.Controller, error)
NewUploadController creates a new instance of the upload controller.
func ParseCloneRequestAnnotation ¶ added in v1.11.0
func ParseCloneRequestAnnotation(pvc *corev1.PersistentVolumeClaim) (exists bool, namespace, name string)
ParseCloneRequestAnnotation parses the clone request annotation
func UploadPossibleForPVC ¶
func UploadPossibleForPVC(pvc *corev1.PersistentVolumeClaim) error
UploadPossibleForPVC is called by the api server to see whether to return an upload token
func ValidateCanCloneSourceAndTargetContentType ¶ added in v1.30.0
func ValidateCanCloneSourceAndTargetContentType(sourcePvc, targetPvc *corev1.PersistentVolumeClaim) (cdiv1.DataVolumeContentType, error)
ValidateCanCloneSourceAndTargetContentType validates the pvcs passed has the same content type.
func ValidateCanCloneSourceAndTargetSpec ¶ added in v1.9.0
func ValidateCanCloneSourceAndTargetSpec(ctx context.Context, c client.Client, sourcePvc, targetPvc *corev1.PersistentVolumeClaim, contentType cdiv1.DataVolumeContentType) error
ValidateCanCloneSourceAndTargetSpec validates the specs passed in are compatible for cloning.
Types ¶
type CDIConfigReconciler ¶ added in v1.12.0
type CDIConfigReconciler struct {
// contains filtered or unexported fields
}
CDIConfigReconciler members
func (*CDIConfigReconciler) Init ¶ added in v1.12.0
func (r *CDIConfigReconciler) Init() error
Init initializes a CDIConfig object.
type CloneReconciler ¶ added in v1.14.0
type CloneReconciler struct {
// contains filtered or unexported fields
}
CloneReconciler members
func (*CloneReconciler) CreateCloneSourcePod ¶ added in v1.14.0
func (r *CloneReconciler) CreateCloneSourcePod(image, pullPolicy string, pvc *corev1.PersistentVolumeClaim, log logr.Logger) (*corev1.Pod, error)
CreateCloneSourcePod creates our cloning src pod which will be used for out of band cloning to read the contents of the src PVC
type CryptoEnvVars ¶ added in v1.52.0
CryptoEnvVars holds the TLS crypto-related configurables for the upload server
type DataImportCronReconciler ¶ added in v1.41.1
type DataImportCronReconciler struct {
// contains filtered or unexported fields
}
DataImportCronReconciler members
type DataSourceReconciler ¶ added in v1.43.0
type DataSourceReconciler struct {
// contains filtered or unexported fields
}
DataSourceReconciler members
type ImportReconciler ¶ added in v1.12.0
type ImportReconciler struct {
// contains filtered or unexported fields
}
ImportReconciler members
type StorageProfileReconciler ¶ added in v1.33.0
type StorageProfileReconciler struct {
// contains filtered or unexported fields
}
StorageProfileReconciler members
type UploadPodArgs ¶ added in v1.11.0
type UploadPodArgs struct { Name string PVC *corev1.PersistentVolumeClaim ScratchPVCName string ClientName string FilesystemOverhead string ServerCert, ServerKey, ClientCA []byte Preallocation string CryptoEnvVars CryptoEnvVars Deadline *time.Time }
UploadPodArgs are the parameters required to create an upload pod
type UploadReconciler ¶ added in v1.14.0
type UploadReconciler struct {
// contains filtered or unexported fields
}
UploadReconciler members