Skip to content

Commit

Permalink
Fix comments and alb_test ARNs
Browse files Browse the repository at this point in the history
Signed-off-by: n888 <[email protected]>
  • Loading branch information
n888 committed Apr 9, 2023
1 parent 32b0b6c commit 108b888
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 155 deletions.
9 changes: 0 additions & 9 deletions pkg/apis/rollouts/validation/validation_references.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,6 @@ func validateNginxIngress(canary *v1alpha1.CanaryStrategy, ingress *ingressutil.
}

func validateAlbIngress(canary *v1alpha1.CanaryStrategy, ingress *ingressutil.Ingress, fldPath *field.Path) field.ErrorList {
//fldPath = fldPath.Child("alb").Child("ingress")
//ingressName := canary.TrafficRouting.ALB.Ingress
//serviceName := canary.StableService
//if canary.TrafficRouting.ALB.RootService != "" {
// serviceName = canary.TrafficRouting.ALB.RootService
//}

//return reportErrors(ingress, serviceName, ingressName, fldPath, field.ErrorList{})

ingresses := canary.TrafficRouting.ALB.Ingresses
allErrs := field.ErrorList{}
// If there are multiple ALB ingresses, and one of them is being validated,
Expand Down
2 changes: 0 additions & 2 deletions pkg/apis/rollouts/validation/validation_references_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ func getAlbRollout(ingress string) *v1alpha1.Rollout {
TrafficRouting: &v1alpha1.RolloutTrafficRouting{
ALB: &v1alpha1.ALBTrafficRouting{
Ingress: ingress,
//Ingress: "alb-ingress",
},
},
},
Expand Down Expand Up @@ -636,7 +635,6 @@ func TestValidateRolloutReferencedResourcesAlbIngress(t *testing.T) {
allErrs = ValidateRolloutReferencedResources(getAlbRolloutMultiIngress([]string{StableIngress, AddStableIngress1, AddStableIngress2}), refResources)
} else {
allErrs = ValidateRolloutReferencedResources(getAlbRollout(StableIngress), refResources)
//allErrs = ValidateRolloutReferencedResources(getRolloutSingleIngress(StableIngress), refResources)
}

if len(test.expectedErrors) > 0 {
Expand Down
8 changes: 0 additions & 8 deletions rollout/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -841,17 +841,9 @@ func (c *rolloutContext) getReferencedNginxIngresses(canary *v1alpha1.CanaryStra
return &ingresses, nil
}

// return nil, field.Invalid(fldPath.Child("alb", "ingress"), canary.TrafficRouting.ALB.Ingress, err.Error())
func (c *rolloutContext) getReferencedALBIngresses(canary *v1alpha1.CanaryStrategy) (*[]ingressutil.Ingress, error) {
ingresses := []ingressutil.Ingress{}

// ingress, err := c.ingressWrapper.GetCached(c.rollout.Namespace, canary.TrafficRouting.ALB.Ingress)
// if err != nil {
// return handleCacheError("alb", []string{"ingress"}, canary.TrafficRouting.ALB.Ingress, err)
// }
// ingresses = append(ingresses, *ingress)
// return &ingresses, nil

// The rollout resource manages more than 1 ingress.
if canary.TrafficRouting.ALB.Ingresses != nil {
for _, ing := range canary.TrafficRouting.ALB.Ingresses {
Expand Down
38 changes: 0 additions & 38 deletions rollout/trafficrouting/alb/alb.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,6 @@ func (r *Reconciler) SetHeaderRoute(headerRoute *v1alpha1.SetHeaderRoute) error
return nil
}

//TODO
// Set header route for additional ingresses if present
//if ingresses := r.cfg.Rollout.Spec.Strategy.Canary.TrafficRouting.ALB.Ingresses; ingresses != nil {
// // Fail out if there is an issue setting header route on additional ingresses.
// // Fundamental assumption is that each additional Ingress is equal in importance
// // as primary Ingress resource.
// if err := r.SetHeaderRoutePerIngress(headerRoute, ingresses); err != nil {
// return err
// }
//}

//return r.SetHeaderRoutePerIngress(headerRoute, []string{r.cfg.Rollout.Spec.Strategy.Canary.TrafficRouting.ALB.Ingress})

if ingresses := r.cfg.Rollout.Spec.Strategy.Canary.TrafficRouting.ALB.Ingresses; ingresses != nil {
return r.SetHeaderRoutePerIngress(headerRoute, ingresses)
} else {
Expand Down Expand Up @@ -232,18 +219,6 @@ func (r *Reconciler) VerifyWeight(desiredWeight int32, additionalDestinations ..
} else {
return r.VerifyWeightPerIngress(desiredWeight, []string{r.cfg.Rollout.Spec.Strategy.Canary.TrafficRouting.ALB.Ingress}, additionalDestinations...)
}

//TODO
//if ingresses := r.cfg.Rollout.Spec.Strategy.Canary.TrafficRouting.ALB.Ingresses; ingresses != nil {
// // Fail out if there is an issue verifying weight on additional ingresses.
// // Fundamental assumption is that each additional Ingress is equal in importance
// // as primary Ingress resource.
// if weightVerified, err := r.VerifyWeightPerIngress(desiredWeight, ingresses, additionalDestinations...); err != nil {
// return weightVerified, err
// }
//}

//return r.VerifyWeightPerIngress(desiredWeight, []string{r.cfg.Rollout.Spec.Strategy.Canary.TrafficRouting.ALB.Ingress}, additionalDestinations...)
}

func (r *Reconciler) VerifyWeightPerIngress(desiredWeight int32, ingresses []string, additionalDestinations ...v1alpha1.WeightDestination) (*bool, error) {
Expand Down Expand Up @@ -348,7 +323,6 @@ func (r *Reconciler) VerifyWeightPerIngress(desiredWeight int32, ingresses []str
}
}
}
//return pointer.BoolPtr(numVerifiedWeights == 1+len(additionalDestinations)), nil
return pointer.BoolPtr(numVerifiedWeights == len(ingresses)+len(additionalDestinations)), nil
}

Expand Down Expand Up @@ -551,23 +525,11 @@ func (r *Reconciler) RemoveManagedRoutes() error {
return nil
}

//TODO
// Remove managed routes for additional ingresses if present
if ingresses := r.cfg.Rollout.Spec.Strategy.Canary.TrafficRouting.ALB.Ingresses; ingresses != nil {
return r.RemoveManagedRoutesPerIngress(ingresses)
} else {
return r.RemoveManagedRoutesPerIngress([]string{r.cfg.Rollout.Spec.Strategy.Canary.TrafficRouting.ALB.Ingress})
}
//if ingresses := r.cfg.Rollout.Spec.Strategy.Canary.TrafficRouting.ALB.Ingresses; ingresses != nil {
// // Fail out if there is an issue remove routes on additional ingresses.
// // Fundamental assumption is that each additional Ingress is equal in importance
// // as primary Ingress resource.
// if err := r.RemoveManagedRoutesPerIngress(ingresses); err != nil {
// return err
// }
//}

// return r.RemoveManagedRoutesPerIngress([]string{r.cfg.Rollout.Spec.Strategy.Canary.TrafficRouting.ALB.Ingress})
}

func (r *Reconciler) RemoveManagedRoutesPerIngress(ingresses []string) error {
Expand Down
Loading

0 comments on commit 108b888

Please sign in to comment.