Skip to content

Commit f87d15b

Browse files
committed
Remove MaxNew from bundle status
1 parent ebb9bad commit f87d15b

9 files changed

Lines changed: 10 additions & 91 deletions

File tree

charts/fleet-crd/templates/crds.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3293,15 +3293,6 @@ spec:
32933293
nullable: true
32943294
type: string
32953295
type: object
3296-
maxNew:
3297-
description: 'MaxNew is the maximum number of BundleDeployments
3298-
that can be created
3299-
3300-
in a single reconciliation. Defaults to 50. Can be configured
3301-
via
3302-
3303-
rolloutStrategy.maxNew in the Bundle spec.'
3304-
type: integer
33053296
maxUnavailable:
33063297
description: 'MaxUnavailable is the maximum number of unavailable
33073298
deployments. See

internal/cmd/cli/target_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func Test_stageAllTargets_overwritesExistingMaxNew(t *testing.T) {
9292
}
9393

9494
func Test_stageAllTargets_preservesExistingRolloutStrategy(t *testing.T) {
95-
ten := 10
95+
ten := 10
9696
existing := &fleet.RolloutStrategy{
9797
AutoPartitionThreshold: &ten,
9898
}

internal/cmd/controller/reconciler/bundle_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func (r *BundleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
287287
}
288288
logger = logger.WithValues("manifestID", manifestID)
289289

290-
if err := resetStatus(&bundle.Status, matchedTargets, bundle.Spec.RolloutStrategy); err != nil {
290+
if err := resetStatus(&bundle.Status, matchedTargets); err != nil {
291291
err = fmt.Errorf("failed to reset bundle status from targets: %w", err)
292292

293293
return ctrl.Result{}, r.updateErrorStatus(ctx, bundleOrig, bundle, err)

internal/cmd/controller/reconciler/bundle_status.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,7 @@ import (
88
fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
99
)
1010

11-
// defaultMaxNew mirrors the default in the target package, kept in sync for
12-
// the status field which reflects the configured value.
13-
const defaultMaxNew = 50
14-
15-
func resetStatus(status *fleet.BundleStatus, allTargets []*target.Target, rollout *fleet.RolloutStrategy) (err error) {
16-
status.MaxNew = defaultMaxNew
17-
if rollout != nil && rollout.MaxNew != nil {
18-
status.MaxNew = *rollout.MaxNew
19-
}
11+
func resetStatus(status *fleet.BundleStatus, allTargets []*target.Target) (err error) {
2012
status.Summary = fleet.BundleSummary{}
2113
status.PartitionStatus = nil
2214
status.Unavailable = 0

internal/cmd/controller/reconciler/bundle_status_test.go

Lines changed: 0 additions & 63 deletions
This file was deleted.

internal/cmd/controller/target/partition.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import (
88
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
99
)
1010

11-
const defaultMaxNew = 50
12-
1311
type partition struct {
1412
Status fleet.PartitionStatus
1513
Targets []*Target
@@ -20,7 +18,7 @@ type partition struct {
2018
// It updates Deployments in allTargets if they are out of sync (DeploymentID != StagedDeploymentID).
2119
func UpdatePartitions(status *fleet.BundleStatus, allTargets []*Target) (err error) {
2220
rollout := getRollout(allTargets)
23-
maxNew := defaultMaxNew
21+
maxNew := DefaultMaxNew
2422
if rollout.MaxNew != nil {
2523
maxNew = *rollout.MaxNew
2624
}

internal/cmd/controller/target/rollout_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ func Test_UpdatePartitions_MaxNew(t *testing.T) {
529529
name: "nil maxNew uses default of 50",
530530
maxNew: nil,
531531
targetCount: 100,
532-
wantNewlyCreated: defaultMaxNew,
532+
wantNewlyCreated: DefaultMaxNew,
533533
},
534534
}
535535
for _, tt := range tests {

internal/cmd/controller/target/target.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ var (
2525
defMaxUnavailablePartitions = intstr.FromInt(0)
2626
)
2727

28+
const (
29+
// DefaultMaxNew is the default value for RolloutStrategy.MaxNew.
30+
DefaultMaxNew = 50
31+
)
32+
2833
const (
2934
maxTemplateRecursionDepth = 50
3035
clusterLabelPrefix = "global.fleet.clusterLabels."

pkg/apis/fleet.cattle.io/v1alpha1/bundle_types.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,6 @@ type BundleStatus struct {
389389
// percentage of unavailable partitions.
390390
// +optional
391391
MaxUnavailablePartitions int `json:"maxUnavailablePartitions"`
392-
// MaxNew is the maximum number of BundleDeployments that can be created
393-
// in a single reconciliation. Defaults to 50. Can be configured via
394-
// rolloutStrategy.maxNew in the Bundle spec.
395-
MaxNew int `json:"maxNew,omitempty"`
396392
// PartitionStatus lists the status of each partition.
397393
PartitionStatus []PartitionStatus `json:"partitions,omitempty"`
398394
// Display contains the number of ready, desiredready clusters and a

0 commit comments

Comments
 (0)