Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Cleanups after bumping Rukpak #928

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions api/v1alpha1/clusterextension_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ const (
ReasonUnpackPending = "UnpackPending"
ReasonUnpackSuccess = "UnpackSuccess"
ReasonUnpackFailed = "UnpackFailed"
bentito marked this conversation as resolved.
Show resolved Hide resolved
ReasonUnpacking = "Unpacking"
bentito marked this conversation as resolved.
Show resolved Hide resolved

ReasonErrorGettingReleaseState = "ErrorGettingReleaseState"
ReasonCreateDynamicWatchFailed = "CreateDynamicWatchFailed"
Expand Down Expand Up @@ -142,7 +141,6 @@ func init() {
ReasonHasValidBundleUnknown,
ReasonUnpackPending,
ReasonUnpackSuccess,
bentito marked this conversation as resolved.
Show resolved Hide resolved
ReasonUnpacking,
ReasonUnpackFailed,
ReasonErrorGettingReleaseState,
ReasonCreateDynamicWatchFailed,
Expand Down
5 changes: 3 additions & 2 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ import (

helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client"
"github.com/operator-framework/rukpak/pkg/finalizer"
registryv1handler "github.com/operator-framework/rukpak/pkg/handler"
"github.com/operator-framework/rukpak/pkg/provisioner/registry"
"github.com/operator-framework/rukpak/pkg/source"
"github.com/operator-framework/rukpak/pkg/storage"

"github.com/operator-framework/operator-controller/api/v1alpha1"
"github.com/operator-framework/operator-controller/internal/catalogmetadata/cache"
catalogclient "github.com/operator-framework/operator-controller/internal/catalogmetadata/client"
"github.com/operator-framework/operator-controller/internal/controllers"
"github.com/operator-framework/operator-controller/internal/handler"
"github.com/operator-framework/operator-controller/internal/labels"
"github.com/operator-framework/operator-controller/internal/version"
"github.com/operator-framework/operator-controller/pkg/features"
Expand Down Expand Up @@ -198,8 +199,8 @@ func main() {
ActionClientGetter: acg,
Unpacker: unpacker,
Storage: localStorage,
Handler: handler.HandlerFunc(handler.HandleClusterExtension),
InstalledBundleGetter: &controllers.DefaultInstalledBundleGetter{ActionClientGetter: acg},
Handler: registryv1handler.HandlerFunc(registry.HandleBundleDeployment),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ClusterExtension")
os.Exit(1)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/operator-framework/catalogd v0.12.0
github.com/operator-framework/helm-operator-plugins v0.2.2-0.20240520180534-f463c36fedf9
github.com/operator-framework/operator-registry v1.43.1
github.com/operator-framework/rukpak v0.22.0
github.com/operator-framework/rukpak v0.23.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0
go.uber.org/zap v1.27.0
Expand All @@ -26,7 +26,6 @@ require (
k8s.io/component-base v0.30.1
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0
sigs.k8s.io/controller-runtime v0.18.3
sigs.k8s.io/yaml v1.4.0
)

require (
Expand Down Expand Up @@ -248,4 +247,5 @@ require (
sigs.k8s.io/kustomize/api v0.15.0 // indirect
sigs.k8s.io/kustomize/kyaml v0.15.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ github.com/operator-framework/operator-lib v0.14.0 h1:er+BgZymZD1im2wytLJiPLZpGA
github.com/operator-framework/operator-lib v0.14.0/go.mod h1:wUu4Xb9xzXnIpglvaZ3yucTMSlqGXHIoUEH9+5gWiu0=
github.com/operator-framework/operator-registry v1.43.1 h1:ACahVHGIL/hINBXd3RKWqSFR5SmSM6L5/n9xXqpR51s=
github.com/operator-framework/operator-registry v1.43.1/go.mod h1:qhssAIYWXDIW+nTg0C5i4iD9zpMtiXtfXqGUuUmGz5c=
github.com/operator-framework/rukpak v0.22.0 h1:1Msvw6w833nDapAX9N9whoIqJ2p+BKCmPs1Sh/G+W3U=
github.com/operator-framework/rukpak v0.22.0/go.mod h1:DrQRNduAm0DWRSXpFhz8FA5g2GrJJ88sWpG5GiWmvPU=
github.com/operator-framework/rukpak v0.23.1 h1:lam6+wysaVjZVpMdtl7DUbc+8ibCdlCfp+nB62K0aSU=
github.com/operator-framework/rukpak v0.23.1/go.mod h1:DrQRNduAm0DWRSXpFhz8FA5g2GrJJ88sWpG5GiWmvPU=
github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU=
github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w=
github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks=
Expand Down
12 changes: 4 additions & 8 deletions internal/controllers/clusterextension_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import (
"github.com/operator-framework/operator-registry/alpha/declcfg"
"github.com/operator-framework/operator-registry/alpha/property"
rukpakv1alpha2 "github.com/operator-framework/rukpak/api/v1alpha2"
registryv1handler "github.com/operator-framework/rukpak/pkg/handler"
helmpredicate "github.com/operator-framework/rukpak/pkg/helm-operator-plugins/predicate"
rukpaksource "github.com/operator-framework/rukpak/pkg/source"
"github.com/operator-framework/rukpak/pkg/storage"
Expand All @@ -73,7 +74,6 @@ import (
catalogfilter "github.com/operator-framework/operator-controller/internal/catalogmetadata/filter"
catalogsort "github.com/operator-framework/operator-controller/internal/catalogmetadata/sort"
"github.com/operator-framework/operator-controller/internal/conditionsets"
"github.com/operator-framework/operator-controller/internal/handler"
"github.com/operator-framework/operator-controller/internal/labels"
)

Expand All @@ -85,7 +85,7 @@ type ClusterExtensionReconciler struct {
Unpacker rukpaksource.Unpacker
ActionClientGetter helmclient.ActionClientGetter
Storage storage.Storage
Handler handler.Handler
Handler registryv1handler.Handler
dynamicWatchMutex sync.RWMutex
dynamicWatchGVKs map[schema.GroupVersionKind]struct{}
controller crcontroller.Controller
Expand Down Expand Up @@ -248,11 +248,6 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
setHasValidBundleUnknown(ext, "unpack pending")
setInstalledStatusConditionUnknown(ext, "installation has not been attempted as unpack is pending")

return ctrl.Result{}, nil
case rukpaksource.StateUnpacking:
setStatusUnpacking(ext, unpackResult.Message)
setHasValidBundleUnknown(ext, "unpack pending")
setInstalledStatusConditionUnknown(ext, "installation has not been attempted as unpack is pending")
return ctrl.Result{}, nil
case rukpaksource.StateUnpacked:
// TODO: Add finalizer to clean the stored bundles, after https://github.com/operator-framework/rukpak/pull/897
Expand All @@ -274,7 +269,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
return ctrl.Result{}, err
}

chrt, values, err := r.Handler.Handle(ctx, bundleFS, ext)
chrt, values, err := r.Handler.Handle(ctx, bundleFS, bd)
bentito marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
setInstalledStatusConditionFailed(ext, err.Error())
return ctrl.Result{}, err
Expand Down Expand Up @@ -533,6 +528,7 @@ func (r *ClusterExtensionReconciler) generateBundleDeploymentForUnpack(bundlePat
UID: ce.UID,
},
Spec: rukpakv1alpha2.BundleDeploymentSpec{
InstallNamespace: ce.Spec.InstallNamespace,
Source: rukpakv1alpha2.BundleSource{
Type: rukpakv1alpha2.SourceTypeImage,
Image: &rukpakv1alpha2.ImageSource{
Expand Down
12 changes: 0 additions & 12 deletions internal/controllers/common_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,6 @@ func setStatusUnpackPending(ext *ocv1alpha1.ClusterExtension, message string) {
})
}

// TODO: verify if we need to update the installBundle status or leave it as is.
func setStatusUnpacking(ext *ocv1alpha1.ClusterExtension, message string) {
ext.Status.InstalledBundle = nil
apimeta.SetStatusCondition(&ext.Status.Conditions, metav1.Condition{
Type: ocv1alpha1.TypeUnpacked,
Status: metav1.ConditionFalse,
Reason: ocv1alpha1.ReasonUnpacking,
Message: message,
ObservedGeneration: ext.GetGeneration(),
})
}

func setStatusUnpacked(ext *ocv1alpha1.ClusterExtension, message string) {
bentito marked this conversation as resolved.
Show resolved Hide resolved
apimeta.SetStatusCondition(&ext.Status.Conditions, metav1.Condition{
Type: ocv1alpha1.TypeUnpacked,
Expand Down
21 changes: 0 additions & 21 deletions internal/handler/interfaces.go

This file was deleted.

105 changes: 0 additions & 105 deletions internal/handler/registry.go

This file was deleted.

Loading