Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/utils/validator/clusterresourceplacement.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ func validateRolloutStrategy(rolloutStrategy placementv1beta1.RolloutStrategy) e
if err != nil {
allErr = append(allErr, fmt.Errorf("maxUnavailable `%+v` is invalid: %w", rolloutStrategy.RollingUpdate.MaxUnavailable, err))
}
if value < 1 {
allErr = append(allErr, fmt.Errorf("maxUnavailable must be greater than or equal to 1, got `%+v`", rolloutStrategy.RollingUpdate.MaxUnavailable))
if value < 0 {
allErr = append(allErr, fmt.Errorf("maxUnavailable must be greater than or equal to 0, got `%+v`", rolloutStrategy.RollingUpdate.MaxUnavailable))
}
}
if rolloutStrategy.RollingUpdate.MaxSurge != nil {
Expand Down
7 changes: 3 additions & 4 deletions pkg/utils/validator/clusterresourceplacement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,9 @@ func TestValidateClusterResourcePlacement_RolloutStrategy(t *testing.T) {
},
},
wantErr: true,
wantErrMsg: "maxUnavailable must be greater than or equal to 1, got `-10`",
wantErrMsg: "maxUnavailable must be greater than or equal to 0, got `-10`",
},
"invalid rollout strategy - zero MaxUnavailable": {
"valid rollout strategy - zero MaxUnavailable": {
strategy: placementv1beta1.RolloutStrategy{
Type: placementv1beta1.RollingUpdateRolloutStrategyType,
RollingUpdate: &placementv1beta1.RollingUpdateConfig{
Expand All @@ -419,8 +419,7 @@ func TestValidateClusterResourcePlacement_RolloutStrategy(t *testing.T) {
},
},
},
wantErr: true,
wantErrMsg: "maxUnavailable must be greater than or equal to 1, got `0`",
wantErr: false,
},
"invalid rollout strategy - % error MaxSurge": {
strategy: placementv1beta1.RolloutStrategy{
Expand Down
Loading