Skip to content

Commit 42bfb69

Browse files
committed
Added some missing configs to examples and catch a nil pointer
1 parent 9ade20a commit 42bfb69

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

examples/2048/2048-ingress.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ metadata:
66
annotations:
77
kubernetes.io/ingress.class: alb
88
alb.ingress.kubernetes.io/scheme: internal
9+
alb.ingress.kubernetes.io/target-type: pod
910
alb.ingress.kubernetes.io/subnets: subnet-1234
1011
alb.ingress.kubernetes.io/security-groups: sg-1234
1112
labels:
@@ -18,4 +19,4 @@ spec:
1819
- path: /
1920
backend:
2021
serviceName: "service-2048"
21-
servicePort: 80
22+
servicePort: 80

examples/alb-ingress-controller.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,5 @@ spec:
9494
restartPolicy: Always
9595
securityContext: {}
9696
terminationGracePeriodSeconds: 30
97+
serviceAccountName: alb-ingress
98+
serviceAccount: alb-ingress

pkg/alb/tg/targetgroup.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ func (t *TargetGroup) Reconcile(rOpts *ReconcileOptions) error {
177177
*t.tg.current.TargetGroupArn,
178178
*t.tg.current.TargetGroupName)
179179

180+
case t.tg.desired == nil && rOpts.IgnoreDeletes:
181+
return nil
182+
180183
// No CurrentState means target group doesn't exist in AWS and should be created.
181184
case t.tg.current == nil:
182185
t.logger.Infof("Start TargetGroup creation.")

pkg/annotations/validation.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/kubernetes-sigs/aws-alb-ingress-controller/pkg/aws/albiam"
1515
"github.com/kubernetes-sigs/aws-alb-ingress-controller/pkg/aws/albwaf"
1616
"github.com/kubernetes-sigs/aws-alb-ingress-controller/pkg/config"
17+
"github.com/kubernetes-sigs/aws-alb-ingress-controller/pkg/util/log"
1718
util "github.com/kubernetes-sigs/aws-alb-ingress-controller/pkg/util/types"
1819
)
1920

@@ -41,7 +42,7 @@ func NewConcreteValidator() ConcreteValidator {
4142
func (v ConcreteValidator) ResolveVPCValidateSubnets(a *Annotations) error {
4243
VPCID, err := albec2.EC2svc.GetVPCID()
4344
if err != nil {
44-
return fmt.Errorf("subnets %s were invalid, could not resolve to a VPC", a.Subnets)
45+
return fmt.Errorf("subnets %s were invalid, could not resolve to a VPC: %s", log.Prettify(a.Subnets), err.Error())
4546
}
4647
a.VPCID = VPCID
4748

pkg/controller/alb-controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,9 @@ func (ac *albController) GetTargets(mode *string, namespace string, svc string,
464464
for _, addr := range subset.Addresses {
465465
for _, port := range subset.Ports {
466466
result = append(result, &elbv2.TargetDescription{
467-
Id: aws.String(addr.IP),
468-
Port: aws.Int64(int64(port.Port)),
469-
AvailabilityZone: aws.String("all"),
467+
Id: aws.String(addr.IP),
468+
Port: aws.Int64(int64(port.Port)),
469+
// AvailabilityZone: aws.String("all"),
470470
})
471471
}
472472
}

0 commit comments

Comments
 (0)