Skip to content

Commit

Permalink
adding validation so ping-pong feature support only ALB traffic routing
Browse files Browse the repository at this point in the history
Signed-off-by: Andrii Perenesenko <[email protected]>
  • Loading branch information
perenesenko committed Feb 2, 2022
1 parent 0d1d08e commit 962e9a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/rollouts/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func ValidateRolloutStrategyCanary(rollout *v1alpha1.Rollout, fldPath *field.Pat
allErrs = append(allErrs, field.Invalid(fldPath.Child("stableService"), canary.StableService, DuplicatedServicesCanaryMessage))
}
if canary.PingPong != nil {
if canary.TrafficRouting == nil || canary.TrafficRouting.ALB == nil {
if canary.TrafficRouting != nil && canary.TrafficRouting.ALB == nil {
allErrs = append(allErrs, field.Invalid(fldPath.Child("trafficRouting").Child("alb"), canary.TrafficRouting.ALB, PingPongWithAlbOnlyMessage))
}
if canary.PingPong.PingService == "" {
Expand Down
5 changes: 1 addition & 4 deletions pkg/apis/rollouts/validation/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,12 @@ func TestValidateRolloutStrategyCanary(t *testing.T) {
CanaryService: "canary",
StableService: "stable",
TrafficRouting: &v1alpha1.RolloutTrafficRouting{
SMI: &v1alpha1.SMITrafficRouting{},
ALB: &v1alpha1.ALBTrafficRouting{RootService: "root-service"},
},
Steps: []v1alpha1.CanaryStep{{}},
}
ro := &v1alpha1.Rollout{}
ro.Spec.Strategy.Canary = canaryStrategy
ro.Spec.Strategy.Canary.TrafficRouting = &v1alpha1.RolloutTrafficRouting{
ALB: &v1alpha1.ALBTrafficRouting{RootService: "root-service"},
}

invalidArgs := []v1alpha1.AnalysisRunArgument{
{
Expand Down

0 comments on commit 962e9a1

Please sign in to comment.