From 42318e62fe72db2f06c2f1ecdf39a269308afcba Mon Sep 17 00:00:00 2001 From: Maciej Zimnoch Date: Tue, 23 Jul 2024 21:28:34 +0200 Subject: [PATCH] Remove pre-rollout check validating ScyllaDB version Minimal versions which this check validated are already EOL, and we don't claim we support them in our documentation. --- pkg/controller/scyllacluster/sync.go | 6 --- pkg/controller/scyllacluster/sync_services.go | 17 -------- .../scyllacluster/sync_statefulsets.go | 21 ---------- pkg/controller/scyllacluster/validation.go | 42 ------------------- 4 files changed, 86 deletions(-) delete mode 100644 pkg/controller/scyllacluster/validation.go diff --git a/pkg/controller/scyllacluster/sync.go b/pkg/controller/scyllacluster/sync.go index 8ad8ce895b0..553846c5dd6 100644 --- a/pkg/controller/scyllacluster/sync.go +++ b/pkg/controller/scyllacluster/sync.go @@ -197,12 +197,6 @@ func (scc *Controller) sync(ctx context.Context, key string) error { return scc.updateStatus(ctx, sc, status) } - err = runPreRolloutChecks(sc, scc.eventRecorder) - if err != nil { - statusUpdateErr := scc.updateStatus(ctx, sc, status) - return utilerrors.NewAggregate([]error{statusUpdateErr, fmt.Errorf("ScyllaCluster %q did not pass pre-rollout check: %w", naming.ObjRef(sc), err)}) - } - var errs []error err = controllerhelpers.RunSync( diff --git a/pkg/controller/scyllacluster/sync_services.go b/pkg/controller/scyllacluster/sync_services.go index 1a37229cd61..81cd02c1edd 100644 --- a/pkg/controller/scyllacluster/sync_services.go +++ b/pkg/controller/scyllacluster/sync_services.go @@ -188,23 +188,6 @@ func (scc *Controller) syncServices( statefulSets map[string]*appsv1.StatefulSet, jobs map[string]*batchv1.Job, ) ([]metav1.Condition, error) { - if sc.Spec.ExposeOptions != nil && sc.Spec.ExposeOptions.NodeService != nil && sc.Spec.ExposeOptions.NodeService.Type != scyllav1.NodeServiceTypeClusterIP { - supportsExposing, err := scyllafeatures.Supports(sc, scyllafeatures.ExposingScyllaClusterViaServiceOtherThanClusterIP) - if err != nil { - return nil, fmt.Errorf("can't determine if ScyllaDB version %q supports exposing via Service other than ClusterIP: %w", sc.Spec.Version, err) - } - - if !supportsExposing { - scc.eventRecorder.Eventf( - sc, - corev1.EventTypeWarning, - "InvalidScyllaDBVersion", - fmt.Sprintf("Requested ScyllaDB version %q does not support exposing via Service other than ClusterIP, use the latest one", sc.Spec.Version), - ) - return nil, fmt.Errorf("requested ScyllaDB version %q does not support exposing via Service other than ClusterIP, use the latest one", sc.Spec.Version) - } - } - requiredServices, err := scc.makeServices(sc, services, jobs) if err != nil { return nil, fmt.Errorf("can't make services: %w", err) diff --git a/pkg/controller/scyllacluster/sync_statefulsets.go b/pkg/controller/scyllacluster/sync_statefulsets.go index ea6426fdf49..e215392a49e 100644 --- a/pkg/controller/scyllacluster/sync_statefulsets.go +++ b/pkg/controller/scyllacluster/sync_statefulsets.go @@ -16,7 +16,6 @@ import ( "github.com/scylladb/scylla-operator/pkg/pointer" "github.com/scylladb/scylla-operator/pkg/resourceapply" "github.com/scylladb/scylla-operator/pkg/scyllaclient" - "github.com/scylladb/scylla-operator/pkg/scyllafeatures" "github.com/scylladb/scylla-operator/pkg/util/hash" "github.com/scylladb/scylla-operator/pkg/util/parallel" "github.com/scylladb/scylla-operator/pkg/util/slices" @@ -482,26 +481,6 @@ func (scc *Controller) syncStatefulSets( var err error var progressingConditions []metav1.Condition - if sc.Spec.ExposeOptions != nil && sc.Spec.ExposeOptions.BroadcastOptions != nil { - if sc.Spec.ExposeOptions.BroadcastOptions.Clients.Type != scyllav1.BroadcastAddressTypeServiceClusterIP || - sc.Spec.ExposeOptions.BroadcastOptions.Nodes.Type != scyllav1.BroadcastAddressTypeServiceClusterIP { - supportsExposing, err := scyllafeatures.Supports(sc, scyllafeatures.ExposingScyllaClusterViaServiceOtherThanClusterIP) - if err != nil { - return nil, fmt.Errorf("can't determine if ScyllaDB version %q supports exposing via Service other than ClusterIP: %w", sc.Spec.Version, err) - } - - if !supportsExposing { - scc.eventRecorder.Eventf( - sc, - corev1.EventTypeWarning, - "InvalidScyllaDBVersion", - fmt.Sprintf("Requested ScyllaDB version %q does not support broadcasting other address than ClusterIP, use the latest one", sc.Spec.Version), - ) - return nil, fmt.Errorf("requested ScyllaDB version %q does not support broadcasting other address than ClusterIP, use the latest one", sc.Spec.Version) - } - } - } - managedScyllaDBConfigCMName := naming.GetScyllaDBManagedConfigCMName(sc.Name) managedScyllaDBConfigCM, found := configMaps[managedScyllaDBConfigCMName] if !found { diff --git a/pkg/controller/scyllacluster/validation.go b/pkg/controller/scyllacluster/validation.go deleted file mode 100644 index 4f2069a37a6..00000000000 --- a/pkg/controller/scyllacluster/validation.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2023 ScyllaDB. - -package scyllacluster - -import ( - "fmt" - - scyllav1 "github.com/scylladb/scylla-operator/pkg/api/scylla/v1" - "github.com/scylladb/scylla-operator/pkg/scyllafeatures" - corev1 "k8s.io/api/core/v1" - "k8s.io/client-go/tools/record" -) - -func runPreRolloutChecks(sc *scyllav1.ScyllaCluster, eventRecorder record.EventRecorder) error { - supportsExposing, err := scyllafeatures.Supports(sc, scyllafeatures.ExposingScyllaClusterViaServiceOtherThanClusterIP) - if err != nil { - return fmt.Errorf("can't determine if ScyllaDB version %q supports exposing via Service other than ClusterIP: %w", sc.Spec.Version, err) - } - - exposingSupportRequired := false - - if sc.Spec.ExposeOptions != nil && sc.Spec.ExposeOptions.NodeService != nil && sc.Spec.ExposeOptions.NodeService.Type != scyllav1.NodeServiceTypeClusterIP { - exposingSupportRequired = true - } - - if sc.Spec.ExposeOptions != nil && sc.Spec.ExposeOptions.BroadcastOptions != nil { - bo := sc.Spec.ExposeOptions.BroadcastOptions - exposingSupportRequired = bo.Clients.Type != scyllav1.BroadcastAddressTypeServiceClusterIP || bo.Nodes.Type != scyllav1.BroadcastAddressTypeServiceClusterIP - } - - if exposingSupportRequired && !supportsExposing { - eventRecorder.Eventf( - sc, - corev1.EventTypeWarning, - "InvalidScyllaDBVersion", - fmt.Sprintf("Can't proceed with the rollout. Specified ScyllaDB version %q does not support exposing via Service other than ClusterIP. Please use different ScyllaDB version.", sc.Spec.Version), - ) - return fmt.Errorf("can't proceed with the rollout. Specified ScyllaDB version %q does not support exposing via Service other than ClusterIP. Please use different ScyllaDB version", sc.Spec.Version) - } - - return nil -}