Skip to content

Commit c4a553e

Browse files
committed
ROX-27130: Fix tests
1 parent d93dc73 commit c4a553e

File tree

3 files changed

+10
-38
lines changed

3 files changed

+10
-38
lines changed

fleetshard/pkg/central/reconciler/reconciler_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ var (
6464
},
6565
}
6666

67-
useRoutesReconcilerOptions = CentralReconcilerOptions{UseRoutes: true}
67+
useRoutesReconcilerOptions = CentralReconcilerOptions{
68+
UseRoutes: true,
69+
ArgoReconcilerOptions: ArgoReconcilerOptions{
70+
ArgoCdNamespace: "openshift-gitops",
71+
},
72+
}
6873

6974
defaultAuditLogConfig = config.AuditLogging{
7075
Enabled: true,
@@ -498,10 +503,10 @@ func TestReconcileDeleteWithManagedDBOverride(t *testing.T) {
498503
return connection, nil
499504
}
500505

501-
reconcilerOptions := CentralReconcilerOptions{
502-
UseRoutes: true,
503-
ManagedDBEnabled: true,
504-
}
506+
reconcilerOptions := defaultReconcilerOptions
507+
reconcilerOptions.UseRoutes = true
508+
reconcilerOptions.ManagedDBEnabled = true
509+
505510
_, _, r := getClientTrackerAndReconciler(
506511
t,
507512
managedDBProvisioningClient,

fleetshard/pkg/runtime/runtime.go

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ import (
1111
"github.com/stackrox/acs-fleet-manager/fleetshard/config"
1212
"github.com/stackrox/acs-fleet-manager/fleetshard/pkg/central/cloudprovider"
1313
"github.com/stackrox/acs-fleet-manager/fleetshard/pkg/central/cloudprovider/awsclient"
14-
"github.com/stackrox/acs-fleet-manager/fleetshard/pkg/central/operator"
1514
"github.com/stackrox/acs-fleet-manager/fleetshard/pkg/central/postgres"
1615
centralReconciler "github.com/stackrox/acs-fleet-manager/fleetshard/pkg/central/reconciler"
1716
"github.com/stackrox/acs-fleet-manager/fleetshard/pkg/cipher"
1817
"github.com/stackrox/acs-fleet-manager/fleetshard/pkg/cluster"
1918
"github.com/stackrox/acs-fleet-manager/fleetshard/pkg/fleetshardmetrics"
2019
"github.com/stackrox/acs-fleet-manager/fleetshard/pkg/k8s"
21-
"github.com/stackrox/acs-fleet-manager/fleetshard/pkg/util"
2220
"github.com/stackrox/acs-fleet-manager/internal/dinosaur/pkg/api/private"
2321
fmAPI "github.com/stackrox/acs-fleet-manager/pkg/client/fleetmanager"
2422
fleetmanager "github.com/stackrox/acs-fleet-manager/pkg/client/fleetmanager/impl"
@@ -38,8 +36,6 @@ type reconcilerRegistry map[string]*centralReconciler.CentralReconciler
3836

3937
var reconciledCentralCountCache int32
4038

41-
var lastOperatorHash [16]byte
42-
4339
var backoff = wait.Backoff{
4440
Duration: 1 * time.Second,
4541
Factor: 1.5,
@@ -57,7 +53,6 @@ type Runtime struct {
5753
k8sClient ctrlClient.Client
5854
dbProvisionClient cloudprovider.DBClient
5955
statusResponseCh chan private.DataPlaneCentralStatus
60-
operatorManager *operator.ACSOperatorManager
6156
secretCipher cipher.Cipher
6257
encryptionKeyGenerator cipher.KeyGenerator
6358
addonService cluster.AddonService
@@ -93,7 +88,6 @@ func NewRuntime(ctx context.Context, config *config.Config, k8sClient ctrlClient
9388
}
9489
}
9590

96-
operatorManager := operator.NewACSOperatorManager(k8sClient)
9791
secretCipher, err := cipher.NewCipher(config)
9892
if err != nil {
9993
return nil, fmt.Errorf("creating secretCipher: %w", err)
@@ -113,7 +107,6 @@ func NewRuntime(ctx context.Context, config *config.Config, k8sClient ctrlClient
113107
clusterID: config.ClusterID,
114108
dbProvisionClient: dbProvisionClient,
115109
reconcilers: make(reconcilerRegistry),
116-
operatorManager: operatorManager,
117110
secretCipher: secretCipher, // pragma: allowlist secret
118111
encryptionKeyGenerator: encryptionKeyGen,
119112
addonService: addonService,
@@ -286,28 +279,6 @@ func (r *Runtime) deleteStaleReconcilers(list *private.ManagedCentralList) {
286279
}
287280
}
288281

289-
func (r *Runtime) upgradeOperator(list private.ManagedCentralList) error {
290-
ctx := context.Background()
291-
operators := operator.FromAPIResponse(list.RhacsOperators)
292-
293-
operatorHash, err := util.MD5SumFromJSONStruct(operators)
294-
if err != nil {
295-
return fmt.Errorf("Creating MD5 operatorHash for operator. %w", err)
296-
}
297-
if lastOperatorHash == operatorHash {
298-
return nil
299-
}
300-
lastOperatorHash = operatorHash
301-
302-
err = r.operatorManager.InstallOrUpgrade(ctx, operators)
303-
if err != nil {
304-
lastOperatorHash = [16]byte{}
305-
return fmt.Errorf("ensuring initial operator installation failed: %w", err)
306-
}
307-
308-
return nil
309-
}
310-
311282
func (r *Runtime) routesAvailable() bool {
312283
available, err := k8s.IsRoutesResourceEnabled(r.k8sClient)
313284
if err != nil {

internal/dinosaur/pkg/gitops/config.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@ package gitops
44
import (
55
"fmt"
66
"github.com/stackrox/acs-fleet-manager/internal/dinosaur/pkg/api/private"
7-
8-
"github.com/stackrox/acs-fleet-manager/fleetshard/pkg/central/operator"
97
"k8s.io/apimachinery/pkg/util/validation/field"
108
)
119

1210
// Config represents the gitops configuration
1311
type Config struct {
1412
TenantResources TenantResourceConfig `json:"tenantResources"`
1513
Centrals CentralsConfig `json:"centrals"`
16-
RHACSOperators operator.OperatorConfigs `json:"rhacsOperators"`
1714
DataPlaneClusters []DataPlaneClusterConfig `json:"dataPlaneClusters"`
1815
VerticalPodAutoscaling private.VerticalPodAutoscaling `json:"verticalPodAutoscaling"`
1916
Applications []map[string]interface{} `json:"applications"`
@@ -103,7 +100,6 @@ func ValidateConfig(config Config) field.ErrorList {
103100
var errs field.ErrorList
104101
errs = append(errs, validateCentralsConfig(field.NewPath("centrals"), config.Centrals)...)
105102
errs = append(errs, validateTenantResourcesConfig(field.NewPath("tenantResources"), config.TenantResources)...)
106-
errs = append(errs, operator.Validate(field.NewPath("rhacsOperators"), config.RHACSOperators)...)
107103
errs = append(errs, validateDataPlaneClusterConfigs(field.NewPath("dataPlaneClusters"), config.DataPlaneClusters)...)
108104
errs = append(errs, validateVpaConfig(field.NewPath("verticalPodAutoscaling"), &config.VerticalPodAutoscaling)...)
109105
return errs

0 commit comments

Comments
 (0)