utils

package
v1.9.0-p01 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ItemFieldNamePrefix           = "clitem"
	ImageFieldNamePrefix          = "vmi"
	ClusterContentLibraryKind     = "ClusterContentLibrary"
	ClusterContentLibraryItemKind = "ClusterContentLibraryItem"
	ContentLibraryKind            = "ContentLibrary"
	ContentLibraryItemKind        = "ContentLibraryItem"

	CLItemFinalizer            = "vmoperator.vmware.com/contentlibraryitem"
	DeprecatedCLItemFinalizer  = "contentlibraryitem.vmoperator.vmware.com"
	CCLItemFinalizer           = "clustercontentlibraryitem.vmoperator.vmware.com"
	DeprecatedCCLItemFinalizer = "vmoperator.vmware.com/clustercontentlibraryitem"

	// TKGServiceTypeLabelKeyPrefix is a label prefix used to identify
	// labels that contain information about the type of service provided
	// by a ClusterContentLibrary.
	// This label prefix is replaced by MultipleCLServiceTypeLabelKeyPrefix
	// when Features.TKGMultipleCL is enabled.
	TKGServiceTypeLabelKeyPrefix = "type.services.vmware.com/"
	// MultipleCLServiceTypeLabelKeyPrefix is a label prefix used to identify
	// labels that contain information about the type of service provided
	// by a ClusterContentLibrary.
	// This label prefix is used only when Features.TKGMultipleCL is enabled,
	// otherwise TKGServiceTypeLabelKeyPrefix is used.
	MultipleCLServiceTypeLabelKeyPrefix = "services.supervisor.vmware.com/"
)
View Source
const ContentLibraryServiceTypeLabelKey = "type.services.vmware.com/tkg"

ContentLibraryServiceTypeLabelKey is used to differentiate a TKG resource from a VM service resource.

Variables

View Source
var SkipNameValidation *bool

SkipNameValidation is used for testing to allow multiple controllers with the same name since Controller-Runtime has a global singleton registry to prevent controllers with the same name, even if attached to different managers.

Functions

func AddContentLibraryRefToAnnotation added in v1.9.0

func AddContentLibraryRefToAnnotation(to client.Object, ref *imgregv1a1.NameAndKindRef) error

AddContentLibraryRefToAnnotation adds the conversion annotation with the content library ref value populated.

func AddToManager added in v1.10.0

func AddToManager(
	ctx *pkgctx.ControllerManagerContext,
	mgr manager.Manager,
	obj client.Object) error

func AddToManagerV1A2 added in v1.10.0

func AddToManagerV1A2(
	ctx *pkgctx.ControllerManagerContext,
	mgr manager.Manager,
	obj client.Object) error

func AddV1A2ContentLibraryRefToAnnotation added in v1.10.0

func AddV1A2ContentLibraryRefToAnnotation(to client.Object, ref *common.LocalObjectRef) error

AddV1A2ContentLibraryRefToAnnotation adds the conversion annotation with the content library ref value populated.

func DummyClusterContentLibraryItem

func DummyClusterContentLibraryItem(name string) *imgregv1a1.ClusterContentLibraryItem

func DummyContentLibraryItem

func DummyContentLibraryItem(name, namespace string) *imgregv1a1.ContentLibraryItem

func DummyV1A2ClusterContentLibraryItem added in v1.10.0

func DummyV1A2ClusterContentLibraryItem(name string) *imgregv1.ClusterContentLibraryItem

func DummyV1A2ContentLibraryItem added in v1.10.0

func DummyV1A2ContentLibraryItem(name, namespace string) *imgregv1.ContentLibraryItem

func FilterServicesTypeLabels added in v1.9.0

func FilterServicesTypeLabels(labels map[string]string) map[string]string

func GetAppropriateFinalizers added in v1.10.0

func GetAppropriateFinalizers(obj client.Object) (string, string)

GetAppropriateFinalizers returns the finalizers for this type of object.

func GetImageFieldNameFromItem

func GetImageFieldNameFromItem(itemName string) (string, error)

GetImageFieldNameFromItem returns the Image field name in format of "vmi-<uuid>" by using the same identifier from the given Item name in "clitem-<uuid>".

func IsItemReady added in v1.8.2

func IsItemReady(itemConditions imgregv1a1.Conditions) bool

IsItemReady returns if the given item conditions contain a Ready condition with status True.

func IsV1A2ItemReady added in v1.10.0

func IsV1A2ItemReady(itemConditions []metav1.Condition) bool

IsV1A2ItemReady returns if the given item conditions contain a Ready condition with status True.

Types

type Reconciler added in v1.10.0

type Reconciler struct {
	client.Client
	Context    context.Context
	Logger     logr.Logger
	Recorder   record.Recorder
	VMProvider providers.VirtualMachineProviderInterface
	Metrics    *metrics.ContentLibraryItemMetrics
	Kind       string
}

Reconciler reconciles an IaaS Image Registry Service's ContentLibraryItem object by creating/updating the corresponding VM-Service's VirtualMachineImage resource.

func NewReconciler added in v1.10.0

func NewReconciler(
	ctx context.Context,
	client client.Client,
	logger logr.Logger,
	recorder record.Recorder,
	vmProvider providers.VirtualMachineProviderInterface,
	kind string) *Reconciler

func (*Reconciler) Reconcile added in v1.10.0

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

func (*Reconciler) ReconcileDelete added in v1.10.0

func (r *Reconciler) ReconcileDelete(
	ctx context.Context,
	logger logr.Logger,
	obj client.Object,
	vmiName string) error

ReconcileDelete reconciles a deletion for a ContentLibraryItem resource.

func (*Reconciler) ReconcileNormal added in v1.10.0

func (r *Reconciler) ReconcileNormal(
	ctx context.Context,
	logger logr.Logger,
	cliObj client.Object,
	cliSpec *imgregv1a1.ContentLibraryItemSpec,
	cliStatus *imgregv1a1.ContentLibraryItemStatus,
	vmiName string) error

ReconcileNormal reconciles a ContentLibraryItem resource by creating or updating the corresponding VirtualMachineImage resource.

type ReconcilerV1A2 added in v1.10.0

type ReconcilerV1A2 struct {
	client.Client
	Context    context.Context
	Logger     logr.Logger
	Recorder   record.Recorder
	VMProvider providers.VirtualMachineProviderInterface
	Metrics    *metrics.ContentLibraryItemMetrics
	Kind       string
}

ReconcilerV1A2 reconciles an IaaS Image Registry Service's ContentLibraryItem object by creating/updating the corresponding VM-Service's VirtualMachineImage resource.

func NewReconcilerV1A2 added in v1.10.0

func NewReconcilerV1A2(
	ctx context.Context,
	client client.Client,
	logger logr.Logger,
	recorder record.Recorder,
	vmProvider providers.VirtualMachineProviderInterface,
	kind string) *ReconcilerV1A2

func (*ReconcilerV1A2) Reconcile added in v1.10.0

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

func (*ReconcilerV1A2) ReconcileDelete added in v1.10.0

func (r *ReconcilerV1A2) ReconcileDelete(
	ctx context.Context,
	logger logr.Logger,
	obj client.Object,
	vmiName string) error

ReconcileDelete reconciles a deletion for a ContentLibraryItem resource.

func (*ReconcilerV1A2) ReconcileNormal added in v1.10.0

func (r *ReconcilerV1A2) ReconcileNormal(
	ctx context.Context,
	logger logr.Logger,
	cliObj client.Object,
	cliSpec *imgregv1.ContentLibraryItemSpec,
	cliStatus *imgregv1.ContentLibraryItemStatus,
	vmiName string) error

ReconcileNormal reconciles a ContentLibraryItem resource by creating or updating the corresponding VirtualMachineImage resource.

Jump to

Keyboard shortcuts

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