Skip to content

Commit 64c7cae

Browse files
committed
contentlibraryitem controller builder v1a2
1 parent c6c58d0 commit 64c7cae

File tree

4 files changed

+1251
-0
lines changed

4 files changed

+1251
-0
lines changed

controllers/contentlibrary/clustercontentlibraryitem/clustercontentlibraryitem_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
imgregv1a1 "github.com/vmware-tanzu/image-registry-operator-api/api/v1alpha1"
1111

1212
"github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/utils"
13+
pkgcfg "github.com/vmware-tanzu/vm-operator/pkg/config"
1314
pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context"
1415
)
1516

@@ -20,5 +21,8 @@ import (
2021

2122
// AddToManager adds this package's controller to the provided manager.
2223
func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr manager.Manager) error {
24+
if pkgcfg.FromContext(ctx).Features.InventoryContentLibrary {
25+
return utils.AddToManagerV1A2(ctx, mgr, &imgregv1a1.ClusterContentLibraryItem{})
26+
}
2327
return utils.AddToManager(ctx, mgr, &imgregv1a1.ClusterContentLibraryItem{})
2428
}

controllers/contentlibrary/contentlibraryitem/contentlibraryitem_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
imgregv1a1 "github.com/vmware-tanzu/image-registry-operator-api/api/v1alpha1"
1111

1212
"github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/utils"
13+
pkgcfg "github.com/vmware-tanzu/vm-operator/pkg/config"
1314
pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context"
1415
)
1516

@@ -20,5 +21,8 @@ import (
2021

2122
// AddToManager adds this package's controller to the provided manager.
2223
func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr manager.Manager) error {
24+
if pkgcfg.FromContext(ctx).Features.InventoryContentLibrary {
25+
return utils.AddToManagerV1A2(ctx, mgr, &imgregv1a1.ContentLibraryItem{})
26+
}
2327
return utils.AddToManager(ctx, mgr, &imgregv1a1.ContentLibraryItem{})
2428
}

0 commit comments

Comments
 (0)