Skip to content

Commit

Permalink
rename MinPodsPerRS to MinPodsPerReplicaSet
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomo Sanders <ssanders@synamedia.com>
  • Loading branch information
Shlomo Sanders committed Dec 11, 2022
1 parent 8bef42a commit 9db92cd
Show file tree
Hide file tree
Showing 12 changed files with 515 additions and 515 deletions.
2 changes: 1 addition & 1 deletion manifests/crds/rollout-crd.yaml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ spec:
- type: integer
- type: string
x-kubernetes-int-or-string: true
minPodsPerRS:
minPodsPerReplicaSet:
format: int32
type: integer
pingPong:
Expand Down
2 changes: 1 addition & 1 deletion manifests/install.yaml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11403,7 +11403,7 @@ spec:
- type: integer
- type: string
x-kubernetes-int-or-string: true
minPodsPerRS:
minPodsPerReplicaSet:
format: int32
type: integer
pingPong:
Expand Down
2 changes: 1 addition & 1 deletion manifests/namespace-install.yaml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11403,7 +11403,7 @@ spec:
- type: integer
- type: string
x-kubernetes-int-or-string: true
minPodsPerRS:
minPodsPerReplicaSet:
format: int32
type: integer
pingPong:
Expand Down
4 changes: 2 additions & 2 deletions pkg/apiclient/rollout/rollout.swagger.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -901,10 +901,10 @@
"$ref": "#/definitions/github.com.argoproj.argo_rollouts.pkg.apis.rollouts.v1alpha1.PingPongSpec",
"title": "PingPongSpec holds the ping and pong services"
},
"minPodsPerRS": {
"minPodsPerReplicaSet": {
"type": "integer",
"format": "int32",
"title": "Assuming the desired number of pods in a stable or canary ReplicaSet is not zero, then make sure it is at least\nMinPodsPerRS for High Availability. Only applicable for TrafficRoutedCanary"
"title": "Assuming the desired number of pods in a stable or canary ReplicaSet is not zero, then make sure it is at least\nMinPodsPerReplicaSet for High Availability. Only applicable for TrafficRoutedCanary"
}
},
"title": "CanaryStrategy defines parameters for a Replica Based Canary"
Expand Down
976 changes: 488 additions & 488 deletions pkg/apis/rollouts/v1alpha1/generated.pb.go
100644 → 100755

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pkg/apis/rollouts/v1alpha1/generated.proto
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/apis/rollouts/v1alpha1/openapi_generated.go
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/apis/rollouts/v1alpha1/types.go
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ type CanaryStrategy struct {
// PingPongSpec holds the ping and pong services
PingPong *PingPongSpec `json:"pingPong,omitempty" protobuf:"varint,15,opt,name=pingPong"`
// Assuming the desired number of pods in a stable or canary ReplicaSet is not zero, then make sure it is at least
// MinPodsPerRS for High Availability. Only applicable for TrafficRoutedCanary
MinPodsPerRS *int32 `json:"minPodsPerRS,omitempty" protobuf:"varint,16,opt,name=minPodsPerRS"`
// MinPodsPerReplicaSet for High Availability. Only applicable for TrafficRoutedCanary
MinPodsPerReplicaSet *int32 `json:"minPodsPerReplicaSet,omitempty" protobuf:"varint,16,opt,name=minPodsPerReplicaSet"`
}

// PingPongSpec holds the ping and pong service name.
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/rollouts/v1alpha1/zz_generated.deepcopy.go
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ui/src/models/rollout/generated/api.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ export interface GithubComArgoprojArgoRolloutsPkgApisRolloutsV1alpha1CanaryStrat
* @type {number}
* @memberof GithubComArgoprojArgoRolloutsPkgApisRolloutsV1alpha1CanaryStrategy
*/
minPodsPerRS?: number;
minPodsPerReplicaSet?: number;
}
/**
* DryRun defines the settings for running the analysis in Dry-Run mode.
Expand Down
16 changes: 8 additions & 8 deletions utils/replicaset/canary.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,22 +312,22 @@ func maxValue(countA int32, countB int32) int32 {
return countA
}

// CheckMinPodsPerRS ensures that if the desired number of pods in a stable or canary ReplicaSet is not zero,
// then it is at least MinPodsPerRS for High Availability. Only applicable if using TrafficRouting
func CheckMinPodsPerRS(rollout *v1alpha1.Rollout, count int32) int32 {
// CheckMinPodsPerReplicaSet ensures that if the desired number of pods in a stable or canary ReplicaSet is not zero,
// then it is at least MinPodsPerReplicaSet for High Availability. Only applicable if using TrafficRouting
func CheckMinPodsPerReplicaSet(rollout *v1alpha1.Rollout, count int32) int32 {
if count == 0 {
return count
}
if rollout.Spec.Strategy.Canary == nil || rollout.Spec.Strategy.Canary.MinPodsPerRS == nil || rollout.Spec.Strategy.Canary.TrafficRouting == nil {
if rollout.Spec.Strategy.Canary == nil || rollout.Spec.Strategy.Canary.MinPodsPerReplicaSet == nil || rollout.Spec.Strategy.Canary.TrafficRouting == nil {
return count
}
return max(count, *rollout.Spec.Strategy.Canary.MinPodsPerRS)
return max(count, *rollout.Spec.Strategy.Canary.MinPodsPerReplicaSet)
}

// CalculateReplicaCountsForTrafficRoutedCanary calculates the canary and stable replica counts
// when using canary with traffic routing. If current traffic weights are supplied, we factor the
// those weights into the and return the higher of current traffic scale vs. desired traffic scale
// If MinPodsPerRS is defined and the number of replicas in either RS is not 0, then return at least MinPodsPerRS
// If MinPodsPerReplicaSet is defined and the number of replicas in either RS is not 0, then return at least MinPodsPerReplicaSet
func CalculateReplicaCountsForTrafficRoutedCanary(rollout *v1alpha1.Rollout, weights *v1alpha1.TrafficWeights) (int32, int32) {
var canaryCount, stableCount int32
rolloutSpecReplica := defaults.GetReplicasOrDefault(rollout.Spec.Replicas)
Expand All @@ -336,7 +336,7 @@ func CalculateReplicaCountsForTrafficRoutedCanary(rollout *v1alpha1.Rollout, wei
// a canary count was explicitly set
canaryCount = *setCanaryScaleReplicas
} else {
canaryCount = CheckMinPodsPerRS(rollout, trafficWeightToReplicas(rolloutSpecReplica, desiredWeight))
canaryCount = CheckMinPodsPerReplicaSet(rollout, trafficWeightToReplicas(rolloutSpecReplica, desiredWeight))
}

if !rollout.Spec.Strategy.Canary.DynamicStableScale {
Expand Down Expand Up @@ -367,7 +367,7 @@ func CalculateReplicaCountsForTrafficRoutedCanary(rollout *v1alpha1.Rollout, wei
canaryCount = max(trafficWeightReplicaCount, canaryCount)
}
}
return CheckMinPodsPerRS(rollout, canaryCount), CheckMinPodsPerRS(rollout, stableCount)
return CheckMinPodsPerReplicaSet(rollout, canaryCount), CheckMinPodsPerReplicaSet(rollout, stableCount)
}

// trafficWeightToReplicas returns the appropriate replicas given the full spec.replicas and a weight
Expand Down
10 changes: 5 additions & 5 deletions utils/replicaset/canary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func TestCalculateReplicaCountsForCanary(t *testing.T) {

abortScaleDownDelaySeconds *int32
statusAbort bool
minPodsPerRS *int32
minPodsPerReplicaSet *int32
}{
{
name: "Do not add extra RSs in scaleDownCount when .Spec.Replica < AvailableReplicas",
Expand Down Expand Up @@ -676,7 +676,7 @@ func TestCalculateReplicaCountsForCanary(t *testing.T) {
expectedCanaryReplicaCount: 0,
},
{
name: "Honor MinPodsPerRS when using trafficRouting and starting canary",
name: "Honor MinPodsPerReplicaSet when using trafficRouting and starting canary",
rolloutSpecReplicas: 10,
setWeight: 5,

Expand All @@ -687,7 +687,7 @@ func TestCalculateReplicaCountsForCanary(t *testing.T) {
canaryAvailableReplica: 0,

trafficRouting: &v1alpha1.RolloutTrafficRouting{},
minPodsPerRS: intPnt(2),
minPodsPerReplicaSet: intPnt(2),

expectedStableReplicaCount: 10,
expectedCanaryReplicaCount: 2,
Expand All @@ -702,8 +702,8 @@ func TestCalculateReplicaCountsForCanary(t *testing.T) {
stableRS := newRS("stable", test.stableSpecReplica, test.stableAvailableReplica)
canaryRS := newRS("canary", test.canarySpecReplica, test.canaryAvailableReplica)
rollout.Spec.Strategy.Canary.AbortScaleDownDelaySeconds = test.abortScaleDownDelaySeconds
if test.minPodsPerRS != nil {
rollout.Spec.Strategy.Canary.MinPodsPerRS = test.minPodsPerRS
if test.minPodsPerReplicaSet != nil {
rollout.Spec.Strategy.Canary.MinPodsPerReplicaSet = test.minPodsPerReplicaSet
}
var newRSReplicaCount, stableRSReplicaCount int32
if test.trafficRouting != nil {
Expand Down

0 comments on commit 9db92cd

Please sign in to comment.