@@ -15,7 +15,7 @@ import (
15
15
"sigs.k8s.io/aws-load-balancer-controller/pkg/annotations"
16
16
"sigs.k8s.io/aws-load-balancer-controller/pkg/deploy/tracking"
17
17
"sigs.k8s.io/aws-load-balancer-controller/pkg/k8s"
18
- elbv2model "sigs.k8s.io/aws-load-balancer-controller/pkg/model/elbv2"
18
+ elbv2modelk8s "sigs.k8s.io/aws-load-balancer-controller/pkg/model/elbv2/k8s "
19
19
"sigs.k8s.io/controller-runtime/pkg/client"
20
20
"time"
21
21
)
@@ -29,9 +29,9 @@ const (
29
29
30
30
// TargetGroupBindingManager is responsible for create/update/delete TargetGroupBinding resources.
31
31
type TargetGroupBindingManager interface {
32
- Create (ctx context.Context , resTGB * elbv2model .TargetGroupBindingResource ) (elbv2model .TargetGroupBindingResourceStatus , error )
32
+ Create (ctx context.Context , resTGB * elbv2modelk8s .TargetGroupBindingResource ) (elbv2modelk8s .TargetGroupBindingResourceStatus , error )
33
33
34
- Update (ctx context.Context , resTGB * elbv2model .TargetGroupBindingResource , k8sTGB * elbv2api.TargetGroupBinding ) (elbv2model .TargetGroupBindingResourceStatus , error )
34
+ Update (ctx context.Context , resTGB * elbv2modelk8s .TargetGroupBindingResource , k8sTGB * elbv2api.TargetGroupBinding ) (elbv2modelk8s .TargetGroupBindingResourceStatus , error )
35
35
36
36
Delete (ctx context.Context , k8sTGB * elbv2api.TargetGroupBinding ) error
37
37
}
@@ -64,10 +64,10 @@ type defaultTargetGroupBindingManager struct {
64
64
waitTGBDeletionTimeout time.Duration
65
65
}
66
66
67
- func (m * defaultTargetGroupBindingManager ) Create (ctx context.Context , resTGB * elbv2model .TargetGroupBindingResource ) (elbv2model .TargetGroupBindingResourceStatus , error ) {
67
+ func (m * defaultTargetGroupBindingManager ) Create (ctx context.Context , resTGB * elbv2modelk8s .TargetGroupBindingResource ) (elbv2modelk8s .TargetGroupBindingResourceStatus , error ) {
68
68
k8sTGBSpec , err := buildK8sTargetGroupBindingSpec (ctx , resTGB )
69
69
if err != nil {
70
- return elbv2model .TargetGroupBindingResourceStatus {}, err
70
+ return elbv2modelk8s .TargetGroupBindingResourceStatus {}, err
71
71
}
72
72
73
73
labels := m .trackingProvider .StackLabels (resTGB .Stack ())
@@ -90,7 +90,7 @@ func (m *defaultTargetGroupBindingManager) Create(ctx context.Context, resTGB *e
90
90
"stackID" , resTGB .Stack ().StackID (),
91
91
"resourceID" , resTGB .ID ())
92
92
if err := m .k8sClient .Create (ctx , k8sTGB ); err != nil {
93
- return elbv2model .TargetGroupBindingResourceStatus {}, err
93
+ return elbv2modelk8s .TargetGroupBindingResourceStatus {}, err
94
94
}
95
95
m .logger .Info ("created targetGroupBinding" ,
96
96
"stackID" , resTGB .Stack ().StackID (),
@@ -99,10 +99,10 @@ func (m *defaultTargetGroupBindingManager) Create(ctx context.Context, resTGB *e
99
99
return buildResTargetGroupBindingStatus (k8sTGB ), nil
100
100
}
101
101
102
- func (m * defaultTargetGroupBindingManager ) Update (ctx context.Context , resTGB * elbv2model .TargetGroupBindingResource , k8sTGB * elbv2api.TargetGroupBinding ) (elbv2model .TargetGroupBindingResourceStatus , error ) {
102
+ func (m * defaultTargetGroupBindingManager ) Update (ctx context.Context , resTGB * elbv2modelk8s .TargetGroupBindingResource , k8sTGB * elbv2api.TargetGroupBinding ) (elbv2modelk8s .TargetGroupBindingResourceStatus , error ) {
103
103
k8sTGBSpec , err := buildK8sTargetGroupBindingSpec (ctx , resTGB )
104
104
if err != nil {
105
- return elbv2model .TargetGroupBindingResourceStatus {}, err
105
+ return elbv2modelk8s .TargetGroupBindingResourceStatus {}, err
106
106
}
107
107
108
108
calculatedLabels := m .trackingProvider .StackLabels (resTGB .Stack ())
@@ -129,10 +129,10 @@ func (m *defaultTargetGroupBindingManager) Update(ctx context.Context, resTGB *e
129
129
"targetGroupBinding" , k8s .NamespacedName (k8sTGB ))
130
130
131
131
if err := m .k8sClient .Patch (ctx , k8sTGB , client .MergeFrom (oldK8sTGB )); err != nil {
132
- return elbv2model .TargetGroupBindingResourceStatus {}, err
132
+ return elbv2modelk8s .TargetGroupBindingResourceStatus {}, err
133
133
}
134
134
if err := m .waitUntilTargetGroupBindingObserved (ctx , k8sTGB ); err != nil {
135
- return elbv2model .TargetGroupBindingResourceStatus {}, err
135
+ return elbv2modelk8s .TargetGroupBindingResourceStatus {}, err
136
136
}
137
137
m .logger .Info ("modified targetGroupBinding" ,
138
138
"stackID" , resTGB .Stack ().StackID (),
@@ -189,16 +189,17 @@ func (m *defaultTargetGroupBindingManager) waitUntilTargetGroupBindingDeleted(ct
189
189
}, ctx .Done ())
190
190
}
191
191
192
- func buildK8sTargetGroupBindingSpec (ctx context.Context , resTGB * elbv2model .TargetGroupBindingResource ) (elbv2api.TargetGroupBindingSpec , error ) {
192
+ func buildK8sTargetGroupBindingSpec (ctx context.Context , resTGB * elbv2modelk8s .TargetGroupBindingResource ) (elbv2api.TargetGroupBindingSpec , error ) {
193
193
tgARN , err := resTGB .Spec .Template .Spec .TargetGroupARN .Resolve (ctx )
194
194
if err != nil {
195
195
return elbv2api.TargetGroupBindingSpec {}, err
196
196
}
197
197
198
198
k8sTGBSpec := elbv2api.TargetGroupBindingSpec {
199
- TargetGroupARN : tgARN ,
200
- TargetType : resTGB .Spec .Template .Spec .TargetType ,
201
- ServiceRef : resTGB .Spec .Template .Spec .ServiceRef ,
199
+ TargetGroupARN : tgARN ,
200
+ TargetType : resTGB .Spec .Template .Spec .TargetType ,
201
+ TargetGroupProtocol : resTGB .Spec .Template .Spec .TargetGroupProtocol ,
202
+ ServiceRef : resTGB .Spec .Template .Spec .ServiceRef ,
202
203
}
203
204
204
205
if resTGB .Spec .Template .Spec .Networking != nil {
@@ -215,7 +216,7 @@ func buildK8sTargetGroupBindingSpec(ctx context.Context, resTGB *elbv2model.Targ
215
216
return k8sTGBSpec , nil
216
217
}
217
218
218
- func buildK8sTargetGroupBindingNetworking (ctx context.Context , resTGBNetworking elbv2model .TargetGroupBindingNetworking ) (elbv2api.TargetGroupBindingNetworking , error ) {
219
+ func buildK8sTargetGroupBindingNetworking (ctx context.Context , resTGBNetworking elbv2modelk8s .TargetGroupBindingNetworking ) (elbv2api.TargetGroupBindingNetworking , error ) {
219
220
k8sIngress := make ([]elbv2api.NetworkingIngressRule , 0 , len (resTGBNetworking .Ingress ))
220
221
for _ , rule := range resTGBNetworking .Ingress {
221
222
k8sPeers := make ([]elbv2api.NetworkingPeer , 0 , len (rule .From ))
@@ -236,7 +237,7 @@ func buildK8sTargetGroupBindingNetworking(ctx context.Context, resTGBNetworking
236
237
}, nil
237
238
}
238
239
239
- func buildK8sNetworkingPeer (ctx context.Context , resNetworkingPeer elbv2model .NetworkingPeer ) (elbv2api.NetworkingPeer , error ) {
240
+ func buildK8sNetworkingPeer (ctx context.Context , resNetworkingPeer elbv2modelk8s .NetworkingPeer ) (elbv2api.NetworkingPeer , error ) {
240
241
if resNetworkingPeer .IPBlock != nil {
241
242
return elbv2api.NetworkingPeer {
242
243
IPBlock : resNetworkingPeer .IPBlock ,
@@ -256,8 +257,8 @@ func buildK8sNetworkingPeer(ctx context.Context, resNetworkingPeer elbv2model.Ne
256
257
return elbv2api.NetworkingPeer {}, errors .New ("either ipBlock or securityGroup should be specified" )
257
258
}
258
259
259
- func buildResTargetGroupBindingStatus (k8sTGB * elbv2api.TargetGroupBinding ) elbv2model .TargetGroupBindingResourceStatus {
260
- return elbv2model .TargetGroupBindingResourceStatus {
260
+ func buildResTargetGroupBindingStatus (k8sTGB * elbv2api.TargetGroupBinding ) elbv2modelk8s .TargetGroupBindingResourceStatus {
261
+ return elbv2modelk8s .TargetGroupBindingResourceStatus {
261
262
TargetGroupBindingRef : corev1.ObjectReference {
262
263
Namespace : k8sTGB .Namespace ,
263
264
Name : k8sTGB .Name ,
@@ -267,7 +268,7 @@ func buildResTargetGroupBindingStatus(k8sTGB *elbv2api.TargetGroupBinding) elbv2
267
268
}
268
269
269
270
// tgbAnnotationsSame performs map equality with the two sets of annotations. Will ignore the check point annotations inserted by the TGB reconciler.
270
- func tgbAnnotationsSame (resTGB * elbv2model .TargetGroupBindingResource , k8sTGB * elbv2api.TargetGroupBinding ) bool {
271
+ func tgbAnnotationsSame (resTGB * elbv2modelk8s .TargetGroupBindingResource , k8sTGB * elbv2api.TargetGroupBinding ) bool {
271
272
annotationsNoCheckpoint := make (map [string ]string )
272
273
273
274
if k8sTGB .Annotations != nil {
0 commit comments