Skip to content

Commit c1d5a04

Browse files
M00nF1shTimothy-Dougherty
authored andcommitted
[v2] fix multiple bugs (kubernetes-sigs#1484)
* fix bugs * fix inbound-cidr merge
1 parent 293ad42 commit c1d5a04

12 files changed

+1707
-90
lines changed

pkg/aws/errors/utils.go

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

pkg/equality/elbv2/compare_option_for_actions.go

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package elbv2
22

33
import (
4-
"github.com/aws/aws-sdk-go/aws"
4+
awssdk "github.com/aws/aws-sdk-go/aws"
55
elbv2sdk "github.com/aws/aws-sdk-go/service/elbv2"
66
"github.com/google/go-cmp/cmp"
77
"github.com/google/go-cmp/cmp/cmpopts"
@@ -30,12 +30,38 @@ func CompareOptionForForwardActionConfig() cmp.Option {
3030
}
3131
}
3232

33+
func CompareOptionForRedirectActionConfig() cmp.Option {
34+
return cmpopts.AcyclicTransformer("normalizeRedirectActionConfig", func(config *elbv2sdk.RedirectActionConfig) *elbv2sdk.RedirectActionConfig {
35+
if config == nil {
36+
return nil
37+
}
38+
normalizedCFG := *config
39+
if normalizedCFG.Host == nil {
40+
normalizedCFG.Host = awssdk.String("#{host}")
41+
}
42+
if normalizedCFG.Path == nil {
43+
normalizedCFG.Path = awssdk.String("/#{path}")
44+
}
45+
if normalizedCFG.Port == nil {
46+
normalizedCFG.Port = awssdk.String("#{port}")
47+
}
48+
if normalizedCFG.Protocol == nil {
49+
normalizedCFG.Protocol = awssdk.String("#{protocol}")
50+
}
51+
if normalizedCFG.Query == nil {
52+
normalizedCFG.Query = awssdk.String("#{query}")
53+
}
54+
return &normalizedCFG
55+
})
56+
}
57+
3358
// CompareOptionForAction returns the compare option for action.
3459
func CompareOptionForAction() cmp.Option {
3560
return cmp.Options{
3661
cmpopts.IgnoreFields(elbv2sdk.Action{}, "Order"),
3762
cmpopts.IgnoreFields(elbv2sdk.Action{}, "TargetGroupArn"),
3863
CompareOptionForForwardActionConfig(),
64+
CompareOptionForRedirectActionConfig(),
3965
}
4066
}
4167

@@ -47,7 +73,7 @@ func CompareOptionForActions() cmp.Option {
4773
if lhs.Order == nil || rhs.Order == nil {
4874
return false
4975
}
50-
return aws.Int64Value(lhs.Order) < aws.Int64Value(rhs.Order)
76+
return awssdk.Int64Value(lhs.Order) < awssdk.Int64Value(rhs.Order)
5177
}),
5278
CompareOptionForAction(),
5379
}

0 commit comments

Comments
 (0)