Skip to content

Commit 25f8027

Browse files
committed
Fixed a couple of bugs
1 parent 06ce8c5 commit 25f8027

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

pkg/alb/lb/loadbalancer.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type NewDesiredLoadBalancerOptions struct {
3838
IngressAnnotations *map[string]string
3939
CommonTags util.ELBv2Tags
4040
IngressRules []extensions.IngressRule
41+
Resources *albrgt.Resources
4142
GetServiceNodePort func(string, int32) (*int64, error)
4243
GetServiceAnnotations func(string, string) (*map[string]string, error)
4344
TargetsFunc func(*string, string, string, *int64) albelbv2.TargetDescriptions
@@ -126,6 +127,7 @@ func NewDesiredLoadBalancer(o *NewDesiredLoadBalancerOptions) (newLoadBalancer *
126127
GetServiceAnnotations: o.GetServiceAnnotations,
127128
AnnotationFactory: o.AnnotationFactory,
128129
TargetsFunc: o.TargetsFunc,
130+
Resources: o.Resources,
129131
})
130132

131133
if err != nil {

pkg/alb/tg/targetgroups.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ type NewDesiredTargetGroupsOptions struct {
122122
LoadBalancerID string
123123
ExistingTargetGroups TargetGroups
124124
AnnotationFactory annotations.AnnotationFactory
125+
Resources *albrgt.Resources
125126
IngressAnnotations *map[string]string
126127
ALBNamePrefix string
127128
Namespace string
@@ -151,6 +152,7 @@ func NewDesiredTargetGroups(o *NewDesiredTargetGroupsOptions) (TargetGroups, err
151152
Namespace: o.Namespace,
152153
ServiceName: path.Backend.ServiceName,
153154
GetServiceAnnotations: o.GetServiceAnnotations,
155+
Resources: o.Resources,
154156
})
155157
if err != nil {
156158
return output, err
@@ -196,6 +198,7 @@ type mergeAnnotationsOptions struct {
196198
Namespace string
197199
ServiceName string
198200
GetServiceAnnotations func(string, string) (*map[string]string, error)
201+
Resources *albrgt.Resources
199202
}
200203

201204
func mergeAnnotations(o *mergeAnnotationsOptions) (*annotations.Annotations, error) {
@@ -217,6 +220,7 @@ func mergeAnnotations(o *mergeAnnotationsOptions) (*annotations.Annotations, err
217220
Annotations: mergedAnnotations,
218221
Namespace: o.Namespace,
219222
ServiceName: o.ServiceName,
223+
Resources: o.Resources,
220224
})
221225

222226
if err != nil {

pkg/albingress/albingress.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ func NewALBIngressFromIngress(o *NewALBIngressFromIngressOptions) *ALBIngress {
134134
GetServiceAnnotations: o.GetServiceAnnotations,
135135
TargetsFunc: o.TargetsFunc,
136136
AnnotationFactory: o.AnnotationFactory,
137+
Resources: o.Resources,
137138
})
138139

139140
if err != nil {

pkg/annotations/annotations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ func (a *Annotations) setSubnets(annotations map[string]string, clusterName stri
493493
// if the subnet annotation isn't specified, lookup appropriate subnets to use
494494
if annotations[subnetsKey] == "" {
495495
subnets, err := albec2.ClusterSubnets(a.Scheme, clusterName, resources)
496-
if err != nil {
496+
if err == nil {
497497
a.Subnets = subnets
498498
}
499499
return err

pkg/aws/albec2/ec2.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,14 +772,14 @@ func ClusterSubnets(scheme *string, clusterName string, resources *albrgt.Resour
772772
}
773773
}
774774

775-
if len(useableSubnets) < 2 {
775+
if len(out) < 2 {
776776
return nil, fmt.Errorf("Retrieval of subnets failed to resolve 2 qualified subnets. Subnets must "+
777777
"contain the %s/%s tag with a value of shared or owned and the %s tag signifying it should be used for ALBs "+
778778
"Additionally, there must be at least 2 subnets with unique availability zones as required by "+
779779
"ALBs. Either tag subnets to meet this requirement or use the subnets annotation on the "+
780780
"ingress resource to explicitly call out what subnets to use for ALB creation. The subnets "+
781781
"that did resolve were %v.", tagNameCluster, clusterName, tagNameSubnetInternalELB,
782-
log.Prettify(useableSubnets))
782+
log.Prettify(out))
783783
}
784784

785785
sort.Sort(out)

0 commit comments

Comments
 (0)