From f38f4fe2ae753e55791b1258f73b8d84b9745ff0 Mon Sep 17 00:00:00 2001 From: Varsha Prasad Narsing Date: Thu, 21 Dec 2023 11:59:17 -0500 Subject: [PATCH] Remove occurences of Bundle API in handlers, storage, webhook Signed-off-by: Varsha Prasad Narsing --- api/v1alpha1/bundle_types.go | 52 ----- api/v1alpha1/bundledeployment_types.go | 14 +- api/v1alpha1/zz_generated.deepcopy.go | 119 ----------- .../bundledeployment/bundledeployment.go | 2 +- internal/storage/storage_test.go | 18 +- internal/util/util.go | 61 ------ internal/util/util_test.go | 198 ------------------ internal/webhook/configmaps.go | 8 +- 8 files changed, 18 insertions(+), 454 deletions(-) delete mode 100644 internal/util/util_test.go diff --git a/api/v1alpha1/bundle_types.go b/api/v1alpha1/bundle_types.go index d09db9ab..489d2713 100644 --- a/api/v1alpha1/bundle_types.go +++ b/api/v1alpha1/bundle_types.go @@ -18,7 +18,6 @@ package v1alpha1 import ( corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) var ( @@ -49,15 +48,6 @@ const ( PhaseUnpacked = "Unpacked" ) -// BundleSpec defines the desired state of Bundle -type BundleSpec struct { - //+kubebuilder:validation:Pattern:=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - // ProvisionerClassName sets the name of the provisioner that should reconcile this BundleDeployment. - ProvisionerClassName string `json:"provisionerClassName"` - // Source defines the configuration for the underlying Bundle content. - Source BundleSource `json:"source"` -} - type BundleSource struct { // Type defines the kind of Bundle content being sourced. Type SourceType `json:"type"` @@ -145,46 +135,4 @@ type UploadSource struct{} type ProvisionerID string -// BundleStatus defines the observed state of Bundle -type BundleStatus struct { - Phase string `json:"phase,omitempty"` - ResolvedSource *BundleSource `json:"resolvedSource,omitempty"` - ObservedGeneration int64 `json:"observedGeneration,omitempty"` - Conditions []metav1.Condition `json:"conditions,omitempty"` - ContentURL string `json:"contentURL,omitempty"` -} - -//+kubebuilder:object:root=true -//+kubebuilder:resource:scope=Cluster -//+kubebuilder:subresource:status -//+kubebuilder:printcolumn:name=Type,type=string,JSONPath=`.spec.source.type` -//+kubebuilder:printcolumn:name=Phase,type=string,JSONPath=`.status.phase` -//+kubebuilder:printcolumn:name=Age,type=date,JSONPath=`.metadata.creationTimestamp` -//+kubebuilder:printcolumn:name=Provisioner,type=string,JSONPath=`.spec.provisionerClassName`,priority=1 -//+kubebuilder:printcolumn:name=Resolved Source,type=string,JSONPath=`.status.resolvedSource`,priority=1 - -// Bundle is the Schema for the bundles API -type Bundle struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec BundleSpec `json:"spec"` - Status BundleStatus `json:"status,omitempty"` -} -func (b *Bundle) ProvisionerClassName() string { - return b.Spec.ProvisionerClassName -} - -//+kubebuilder:object:root=true - -// BundleList contains a list of Bundle -type BundleList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Bundle `json:"items"` -} - -func init() { - SchemeBuilder.Register(&Bundle{}, &BundleList{}) -} diff --git a/api/v1alpha1/bundledeployment_types.go b/api/v1alpha1/bundledeployment_types.go index fe4f7dd8..ed954532 100644 --- a/api/v1alpha1/bundledeployment_types.go +++ b/api/v1alpha1/bundledeployment_types.go @@ -59,16 +59,6 @@ type BundleDeploymentSpec struct { Config runtime.RawExtension `json:"config,omitempty"` } -// BundleTemplate defines the desired state of a Bundle resource -type BundleTemplate struct { - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty"` - // Specification of the desired behavior of the Bundle. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - Spec BundleSpec `json:"spec"` -} // BundleDeploymentStatus defines the observed state of BundleDeployment type BundleDeploymentStatus struct { @@ -94,6 +84,10 @@ type BundleDeployment struct { Status BundleDeploymentStatus `json:"status,omitempty"` } +func (b *BundleDeployment) ProvisionerClassName() string { + return b.Spec.ProvisionerClassName +} + //+kubebuilder:object:root=true // BundleDeploymentList contains a list of BundleDeployment diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index de6b4f54..07daf286 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -42,33 +42,6 @@ func (in *Authorization) DeepCopy() *Authorization { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Bundle) DeepCopyInto(out *Bundle) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Bundle. -func (in *Bundle) DeepCopy() *Bundle { - if in == nil { - return nil - } - out := new(Bundle) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Bundle) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BundleDeployment) DeepCopyInto(out *BundleDeployment) { *out = *in @@ -172,38 +145,6 @@ func (in *BundleDeploymentStatus) DeepCopy() *BundleDeploymentStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BundleList) DeepCopyInto(out *BundleList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Bundle, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BundleList. -func (in *BundleList) DeepCopy() *BundleList { - if in == nil { - return nil - } - out := new(BundleList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *BundleList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BundleSource) DeepCopyInto(out *BundleSource) { *out = *in @@ -244,66 +185,6 @@ func (in *BundleSource) DeepCopy() *BundleSource { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BundleSpec) DeepCopyInto(out *BundleSpec) { - *out = *in - in.Source.DeepCopyInto(&out.Source) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BundleSpec. -func (in *BundleSpec) DeepCopy() *BundleSpec { - if in == nil { - return nil - } - out := new(BundleSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BundleStatus) DeepCopyInto(out *BundleStatus) { - *out = *in - if in.ResolvedSource != nil { - in, out := &in.ResolvedSource, &out.ResolvedSource - *out = new(BundleSource) - (*in).DeepCopyInto(*out) - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BundleStatus. -func (in *BundleStatus) DeepCopy() *BundleStatus { - if in == nil { - return nil - } - out := new(BundleStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BundleTemplate) DeepCopyInto(out *BundleTemplate) { - *out = *in - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BundleTemplate. -func (in *BundleTemplate) DeepCopy() *BundleTemplate { - if in == nil { - return nil - } - out := new(BundleTemplate) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ConfigMapSource) DeepCopyInto(out *ConfigMapSource) { *out = *in diff --git a/internal/controllers/bundledeployment/bundledeployment.go b/internal/controllers/bundledeployment/bundledeployment.go index 93ce800d..5fbc4f96 100644 --- a/internal/controllers/bundledeployment/bundledeployment.go +++ b/internal/controllers/bundledeployment/bundledeployment.go @@ -137,7 +137,7 @@ func SetupWithManager(mgr manager.Manager, systemNsCache cache.Cache, systemName For(&rukpakv1alpha1.BundleDeployment{}, builder.WithPredicates( util.BundleDeploymentProvisionerFilter(c.provisionerID)), ). - Watches(source.NewKindWithCache(&corev1.Pod{}, systemNsCache), util.MapOwneeToOwnerProvisionerHandler(context.Background(), mgr.GetClient(), l, c.provisionerID, &rukpakv1alpha1.Bundle{})). + Watches(source.NewKindWithCache(&corev1.Pod{}, systemNsCache), util.MapOwneeToOwnerProvisionerHandler(context.Background(), mgr.GetClient(), l, c.provisionerID, &rukpakv1alpha1.BundleDeployment{})). Watches(source.NewKindWithCache(&corev1.ConfigMap{}, systemNsCache), util.MapConfigMapToBundleDeploymentHandler(context.Background(), mgr.GetClient(), systemNamespace, c.provisionerID)). Build(c) if err != nil { diff --git a/internal/storage/storage_test.go b/internal/storage/storage_test.go index c040ef49..581fa106 100644 --- a/internal/storage/storage_test.go +++ b/internal/storage/storage_test.go @@ -20,8 +20,8 @@ import ( var _ = Describe("WithFallbackLoader", func() { var ( ctx context.Context - primaryBundle *rukpakv1alpha1.Bundle - fallbackBundle *rukpakv1alpha1.Bundle + primaryBundleDeployment *rukpakv1alpha1.BundleDeployment + fallbackBundleDeployment *rukpakv1alpha1.BundleDeployment primaryStore *LocalDirectory fallbackStore *LocalDirectory primaryFS fs.FS @@ -32,12 +32,12 @@ var _ = Describe("WithFallbackLoader", func() { BeforeEach(func() { ctx = context.Background() - primaryBundle = &rukpakv1alpha1.Bundle{ + primaryBundleDeployment = &rukpakv1alpha1.BundleDeployment{ ObjectMeta: metav1.ObjectMeta{ Name: util.GenerateBundleName("primary", rand.String(8)), }, } - fallbackBundle = &rukpakv1alpha1.Bundle{ + fallbackBundleDeployment = &rukpakv1alpha1.BundleDeployment{ ObjectMeta: metav1.ObjectMeta{ Name: util.GenerateBundleName("fallback", rand.String(8)), }, @@ -49,27 +49,27 @@ var _ = Describe("WithFallbackLoader", func() { primaryStore = &LocalDirectory{RootDirectory: primaryDir} primaryFS = generateFS() - Expect(primaryStore.Store(ctx, primaryBundle, primaryFS)).To(Succeed()) + Expect(primaryStore.Store(ctx, primaryBundleDeployment, primaryFS)).To(Succeed()) fallbackStore = &LocalDirectory{RootDirectory: fallbackDir} fallbackFS = generateFS() - Expect(fallbackStore.Store(ctx, fallbackBundle, fallbackFS)).To(Succeed()) + Expect(fallbackStore.Store(ctx, fallbackBundleDeployment, fallbackFS)).To(Succeed()) store = WithFallbackLoader(primaryStore, fallbackStore) }) It("should find primary bundle", func() { - loadedTestFS, err := store.Load(ctx, primaryBundle) + loadedTestFS, err := store.Load(ctx, primaryBundleDeployment) Expect(err).ToNot(HaveOccurred()) Expect(fsEqual(primaryFS, loadedTestFS)).To(BeTrue()) }) It("should find fallback bundle", func() { - loadedTestFS, err := store.Load(ctx, fallbackBundle) + loadedTestFS, err := store.Load(ctx, fallbackBundleDeployment) Expect(err).ToNot(HaveOccurred()) Expect(fsEqual(fallbackFS, loadedTestFS)).To(BeTrue()) }) It("should fail to find unknown bundle", func() { - unknownBundle := &rukpakv1alpha1.Bundle{ + unknownBundle := &rukpakv1alpha1.BundleDeployment{ ObjectMeta: metav1.ObjectMeta{ Name: util.GenerateBundleName("unknown", rand.String(8)), }, diff --git a/internal/util/util.go b/internal/util/util.go index 29b7ede7..825c90d6 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -94,13 +94,6 @@ func ReconcileDesiredBundleDeployment(ctx context.Context, c client.Client, bd * return b, existingBundleDeployments, err } -func BundleProvisionerFilter(provisionerClassName string) predicate.Predicate { - return predicate.NewPredicateFuncs(func(obj client.Object) bool { - b := obj.(*rukpakv1alpha1.Bundle) - return b.Spec.ProvisionerClassName == provisionerClassName - }) -} - func BundleDeploymentProvisionerFilter(provisionerClassName string) predicate.Predicate { return predicate.NewPredicateFuncs(func(obj client.Object) bool { b := obj.(*rukpakv1alpha1.BundleDeployment) @@ -171,54 +164,6 @@ func MapOwneeToOwnerProvisionerHandler(ctx context.Context, cl client.Client, lo }) } -// MapBundleToBundleDeployment is responsible for finding the BundleDeployment resource -// that's managing this Bundle in the cluster. In the case that this Bundle is a standalone -// resource, then no BundleDeployment will be returned as static creation of Bundle -// resources is not a supported workflow right now. -func MapBundleToBundleDeployment(ctx context.Context, c client.Client, b rukpakv1alpha1.Bundle) *rukpakv1alpha1.BundleDeployment { - // check whether this is a standalone bundle that was created outside - // of the normal BundleDeployment controller reconciliation process. - if bundleOwnerType := b.Labels[CoreOwnerKindKey]; bundleOwnerType != rukpakv1alpha1.BundleDeploymentKind { - return nil - } - bundleOwnerName := b.Labels[CoreOwnerNameKey] - if bundleOwnerName == "" { - return nil - } - - bundleDeployments := &rukpakv1alpha1.BundleDeploymentList{} - if err := c.List(ctx, bundleDeployments); err != nil { - return nil - } - for _, bd := range bundleDeployments.Items { - bd := bd - - if bd.GetName() == bundleOwnerName { - return bd.DeepCopy() - } - } - return nil -} - -// MapBundleToBundleDeploymentHandler is responsible for requeuing a BundleDeployment resource -// when a new Bundle event has been encountered. In the case that the Bundle resource is a -// standalone resource, then no BundleDeployment will be returned as static creation of Bundle -// resources is not a supported workflow right now. The provisionerClassName parameter is used -// to filter out BundleDeployments that the caller shouldn't be watching. -func MapBundleToBundleDeploymentHandler(ctx context.Context, cl client.Client, provisionerClassName string) handler.MapFunc { - return func(object client.Object) []reconcile.Request { - b := object.(*rukpakv1alpha1.Bundle) - - managingBD := MapBundleToBundleDeployment(ctx, cl, *b) - if managingBD == nil { - return nil - } - if managingBD.Spec.ProvisionerClassName != provisionerClassName { - return nil - } - return []reconcile.Request{{NamespacedName: client.ObjectKeyFromObject(managingBD)}} - } -} func MapConfigMapToBundleDeployment(ctx context.Context, cl client.Client, cmNamespace string, cm corev1.ConfigMap) []*rukpakv1alpha1.BundleDeployment { bundleDeploymentList := &rukpakv1alpha1.BundleDeploymentList{} if err := cl.List(ctx, bundleDeploymentList); err != nil { @@ -361,12 +306,6 @@ func newLabelSelector(name, kind string) labels.Selector { return labels.NewSelector().Add(*kindRequirement, *nameRequirement) } -// NewBundleLabelSelector is responsible for constructing a label.Selector -// for any underlying resources that are associated with the Bundle parameter. -func NewBundleLabelSelector(bundle *rukpakv1alpha1.Bundle) labels.Selector { - return newLabelSelector(bundle.GetName(), rukpakv1alpha1.BundleKind) -} - // NewBundleDeploymentLabelSelector is responsible for constructing a label.Selector // for any underlying resources that are associated with the BundleDeployment parameter. func NewBundleDeploymentLabelSelector(bd *rukpakv1alpha1.BundleDeployment) labels.Selector { diff --git a/internal/util/util_test.go b/internal/util/util_test.go deleted file mode 100644 index 937c81bf..00000000 --- a/internal/util/util_test.go +++ /dev/null @@ -1,198 +0,0 @@ -package util - -import ( - "testing" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - rukpakv1alpha1 "github.com/operator-framework/rukpak/api/v1alpha1" -) - -var sampleSpec = rukpakv1alpha1.BundleSpec{ - ProvisionerClassName: "sample", - Source: rukpakv1alpha1.BundleSource{ - Type: rukpakv1alpha1.SourceTypeImage, - Image: &rukpakv1alpha1.ImageSource{ - Ref: "non-existent", - }, - }, -} - -func TestCheckDesiredBundleTemplate(t *testing.T) { - type args struct { - existingBundle *rukpakv1alpha1.Bundle - desiredBundle rukpakv1alpha1.BundleTemplate - } - tests := []struct { - name string - args args - want bool - }{ - { - name: "True/BundleMatchesTemplate", - args: args{ - existingBundle: &rukpakv1alpha1.Bundle{ - ObjectMeta: metav1.ObjectMeta{ - Name: "stub-6f74b48d4", - Labels: map[string]string{ - "stub": "stub", - }, - }, - Spec: sampleSpec, - }, - desiredBundle: rukpakv1alpha1.BundleTemplate{ - ObjectMeta: metav1.ObjectMeta{ - Name: "stub", - Labels: map[string]string{ - "stub": "stub", - }, - }, - Spec: sampleSpec, - }, - }, - want: true, - }, - { - name: "False/SpecDiffers", - args: args{ - existingBundle: &rukpakv1alpha1.Bundle{ - ObjectMeta: metav1.ObjectMeta{ - Name: "stub-6dd88668d7", - Labels: map[string]string{ - "stub": "stub", - }, - }, - Spec: rukpakv1alpha1.BundleSpec{ - ProvisionerClassName: "non-existent-provisioner-class-name", - }, - }, - desiredBundle: rukpakv1alpha1.BundleTemplate{ - ObjectMeta: metav1.ObjectMeta{ - Name: "stub", - Labels: map[string]string{ - "stub": "stub", - }, - }, - Spec: sampleSpec, - }, - }, - want: false, - }, - { - name: "False/LabelsDiffer", - args: args{ - existingBundle: &rukpakv1alpha1.Bundle{ - ObjectMeta: metav1.ObjectMeta{ - Name: "stub-6f74b48d4", - Labels: map[string]string{ - "stub": "stub", - }, - }, - Spec: sampleSpec, - }, - desiredBundle: rukpakv1alpha1.BundleTemplate{ - ObjectMeta: metav1.ObjectMeta{ - Name: "stub", - Labels: map[string]string{ - "stub": "different-value", - }, - }, - Spec: sampleSpec, - }, - }, - want: false, - }, - { - name: "False/AnnotationsDiffer", - args: args{ - existingBundle: &rukpakv1alpha1.Bundle{ - ObjectMeta: metav1.ObjectMeta{ - Name: "stub-77c4548c75", - Labels: map[string]string{ - "stub": "stub", - }, - Annotations: map[string]string{ - "stub": "stub", - }, - }, - Spec: sampleSpec, - }, - desiredBundle: rukpakv1alpha1.BundleTemplate{ - ObjectMeta: metav1.ObjectMeta{ - Name: "stub", - Labels: map[string]string{ - "stub": "stub", - }, - Annotations: map[string]string{ - "stub": "", - }, - }, - Spec: sampleSpec, - }, - }, - want: false, - }, - { - name: "True/BundleMatchesTemplateHyphens", - args: args{ - existingBundle: &rukpakv1alpha1.Bundle{ - ObjectMeta: metav1.ObjectMeta{ - Name: "stub-123-6cc4cf6797", - Labels: map[string]string{ - "stub-123": "stub-123", - }, - }, - Spec: sampleSpec, - }, - desiredBundle: rukpakv1alpha1.BundleTemplate{ - ObjectMeta: metav1.ObjectMeta{ - Name: "stub-123", - Labels: map[string]string{ - "stub-123": "stub-123", - }, - }, - Spec: sampleSpec, - }, - }, - want: true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - // injectCoreLabels(tt.args.existingBundle) - // // Dynamically inject the bundle template hash at runtime into the tests. - // // This is due to the nature of the objects being passed in (pointers to BundleTemplates) being represented - // // differently on different platforms, so hardcoding the hash values produces inconsistent results. - // injectTemplateHashLabel(t, tt.args.existingBundle, tt.args.desiredBundle, tt.want) - // got, err := CheckDesiredBundleTemplate(tt.args.existingBundle, tt.args.desiredBundle) - // if err != nil { - // t.Fatal(err) - // } - // if got != tt.want { - // t.Errorf("CheckDesiredBundleTemplate() = %v, want %v", got, tt.want) - // } - }) - } -} - -func injectCoreLabels(bundle *rukpakv1alpha1.Bundle) { - labels := bundle.GetLabels() - if len(labels) == 0 { - labels = make(map[string]string) - } - labels[CoreOwnerKindKey] = "" - labels[CoreOwnerNameKey] = "" -} - -func injectTemplateHashLabel(t *testing.T, bundle *rukpakv1alpha1.Bundle, template rukpakv1alpha1.BundleTemplate, want bool) { - labels := bundle.GetLabels() - if want { - hash, err := DeepHashObject(template) - if err != nil { - t.Fatal(err) - } - labels[CoreBundleTemplateHashKey] = hash - } else { - labels[CoreBundleTemplateHashKey] = "00000000" - } -} diff --git a/internal/webhook/configmaps.go b/internal/webhook/configmaps.go index 24689a22..a9988553 100644 --- a/internal/webhook/configmaps.go +++ b/internal/webhook/configmaps.go @@ -31,12 +31,12 @@ func (w *ConfigMap) ValidateCreate(ctx context.Context, obj runtime.Object) erro return nil } - bundleList := &rukpakv1alpha1.BundleList{} - if err := w.Client.List(ctx, bundleList); err != nil { + bundledeploymentList := &rukpakv1alpha1.BundleDeploymentList{} + if err := w.Client.List(ctx, bundledeploymentList); err != nil { return err } bundleReferrers := []string{} - for _, bundle := range bundleList.Items { + for _, bundle := range bundledeploymentList.Items { if bundle.Spec.Source.Type == rukpakv1alpha1.SourceTypeConfigMaps { for _, bundleConfigMapRef := range bundle.Spec.Source.ConfigMaps { if bundleConfigMapRef.ConfigMap.Name == cm.Name { @@ -58,7 +58,7 @@ func (w *ConfigMap) ValidateUpdate(_ context.Context, _, _ runtime.Object) error func (w *ConfigMap) ValidateDelete(ctx context.Context, obj runtime.Object) error { cm := obj.(*corev1.ConfigMap) - bundleList := &rukpakv1alpha1.BundleList{} + bundleList := &rukpakv1alpha1.BundleDeploymentList{} if err := w.Client.List(ctx, bundleList); err != nil { return err }