diff --git a/cmd/manager/main.go b/cmd/manager/main.go index 7589f2cf2..dafdc62c0 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -176,7 +176,9 @@ func main() { os.Exit(1) } - acg, err := helmclient.NewActionClientGetter(cfgGetter) + acg, err := helmclient.NewActionClientGetter(cfgGetter, + helmclient.WithFailureRollbacks(false), + ) if err != nil { setupLog.Error(err, "unable to create helm client") os.Exit(1) diff --git a/go.mod b/go.mod index 32db129dd..74f80e7f3 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/google/go-cmp v0.6.0 github.com/operator-framework/api v0.26.0 github.com/operator-framework/catalogd v0.17.0 - github.com/operator-framework/helm-operator-plugins v0.2.2-0.20240520180534-f463c36fedf9 + github.com/operator-framework/helm-operator-plugins v0.3.0 github.com/operator-framework/operator-registry v1.44.0 github.com/operator-framework/rukpak v0.24.0 github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index cab0fec29..add7160b2 100644 --- a/go.sum +++ b/go.sum @@ -608,8 +608,8 @@ github.com/operator-framework/api v0.26.0 h1:YVntU2NkVl5zSLLwK5kFcH6P3oSvN9QDgTs github.com/operator-framework/api v0.26.0/go.mod h1:3IxOwzVUeGxYlzfwKCcfCyS+q3EEhWA/4kv7UehbeyM= github.com/operator-framework/catalogd v0.17.0 h1:Vsl32qKf2nKbAnKNfJ6eREOkirx5+oxpUuSwMxGS/dc= github.com/operator-framework/catalogd v0.17.0/go.mod h1:7zVv39zlmvJvRePtRzdMRqn8s/WRH4ALXMJCKNQMKmc= -github.com/operator-framework/helm-operator-plugins v0.2.2-0.20240520180534-f463c36fedf9 h1:f7/TMBpuIZEQ3JbD9UyP1L1ZCSLLWdR2aPN+A+dOHFY= -github.com/operator-framework/helm-operator-plugins v0.2.2-0.20240520180534-f463c36fedf9/go.mod h1:ly6Bd9rSzmt37Wy6WtZHmA+IY9zG958MryJFLcVpCXw= +github.com/operator-framework/helm-operator-plugins v0.3.0 h1:LNhcb5nPT/TAxZSsKH2LTYh79RgiN2twGFptQR96sRM= +github.com/operator-framework/helm-operator-plugins v0.3.0/go.mod h1:ly6Bd9rSzmt37Wy6WtZHmA+IY9zG958MryJFLcVpCXw= github.com/operator-framework/operator-lib v0.14.0 h1:er+BgZymZD1im2wytLJiPLZpGALAX6N0gXaHx3PKbO4= github.com/operator-framework/operator-lib v0.14.0/go.mod h1:wUu4Xb9xzXnIpglvaZ3yucTMSlqGXHIoUEH9+5gWiu0= github.com/operator-framework/operator-registry v1.44.0 h1:NW5/xHYR77J2EUYm+6iBER1WNGLNS8gM+G5GBQWqTTs= diff --git a/internal/controllers/clusterextension_controller.go b/internal/controllers/clusterextension_controller.go index af0e32d80..003a46add 100644 --- a/internal/controllers/clusterextension_controller.go +++ b/internal/controllers/clusterextension_controller.go @@ -78,6 +78,10 @@ import ( "github.com/operator-framework/operator-controller/internal/labels" ) +const ( + maxHelmReleaseHistory = 10 +) + // ClusterExtensionReconciler reconciles a ClusterExtension object type ClusterExtensionReconciler struct { client.Client @@ -363,6 +367,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp } case stateNeedsUpgrade: rel, err = ac.Upgrade(ext.GetName(), ext.Spec.InstallNamespace, chrt, values, func(upgrade *action.Upgrade) error { + upgrade.MaxHistory = maxHelmReleaseHistory upgrade.Labels = map[string]string{labels.BundleNameKey: bundle.Name, labels.PackageNameKey: bundle.Package, labels.BundleVersionKey: bundleVersion.String()} return nil }, helmclient.AppendUpgradePostRenderer(post)) @@ -678,6 +683,7 @@ func (r *ClusterExtensionReconciler) getReleaseState(cl helmclient.ActionInterfa if errors.Is(err, driver.ErrReleaseNotFound) { desiredRelease, err := cl.Install(ext.GetName(), ext.Spec.InstallNamespace, chrt, values, func(i *action.Install) error { i.DryRun = true + i.DryRunOption = "server" return nil }, helmclient.AppendInstallPostRenderer(post)) if err != nil { @@ -686,7 +692,9 @@ func (r *ClusterExtensionReconciler) getReleaseState(cl helmclient.ActionInterfa return nil, desiredRelease, stateNeedsInstall, nil } desiredRelease, err := cl.Upgrade(ext.GetName(), ext.Spec.InstallNamespace, chrt, values, func(upgrade *action.Upgrade) error { + upgrade.MaxHistory = maxHelmReleaseHistory upgrade.DryRun = true + upgrade.DryRunOption = "server" return nil }, helmclient.AppendUpgradePostRenderer(post)) if err != nil {