@@ -107,8 +107,11 @@ func (t *targetGroupSynthesizer) SynthesizeTriggeredTargetGroup(ctx context.Cont
107107 continue
108108 }
109109
110+ // for serviceimport, the httproutename is ""
111+
110112 t .latticeDataStore .AddTargetGroup (resTargetGroup .Spec .Name ,
111- resTargetGroup .Spec .Config .VpcID , tgStatus .TargetGroupARN , tgStatus .TargetGroupID , resTargetGroup .Spec .Config .IsServiceImport )
113+ resTargetGroup .Spec .Config .VpcID , tgStatus .TargetGroupARN , tgStatus .TargetGroupID ,
114+ resTargetGroup .Spec .Config .IsServiceImport , "" )
112115
113116 glog .V (6 ).Infof ("targetGroup Synthesized successfully for %s: %v\n " , resTargetGroup .Spec .Name , tgStatus )
114117
@@ -121,7 +124,7 @@ func (t *targetGroupSynthesizer) SynthesizeTriggeredTargetGroup(ctx context.Cont
121124 continue
122125 } else {
123126 glog .V (6 ).Infof ("Synthersizing Target Group: successfully deleted target group %v\n " , resTargetGroup )
124- t .latticeDataStore .DelTargetGroup (resTargetGroup .Spec .Name , false )
127+ t .latticeDataStore .DelTargetGroup (resTargetGroup .Spec .Name , resTargetGroup . Spec . Config . K8SHTTPRouteName , false )
125128 }
126129
127130 } else {
@@ -136,7 +139,9 @@ func (t *targetGroupSynthesizer) SynthesizeTriggeredTargetGroup(ctx context.Cont
136139 }
137140
138141 t .latticeDataStore .AddTargetGroup (resTargetGroup .Spec .Name ,
139- resTargetGroup .Spec .Config .VpcID , tgStatus .TargetGroupARN , tgStatus .TargetGroupID , resTargetGroup .Spec .Config .IsServiceImport )
142+ resTargetGroup .Spec .Config .VpcID , tgStatus .TargetGroupARN ,
143+ tgStatus .TargetGroupID , resTargetGroup .Spec .Config .IsServiceImport ,
144+ resTargetGroup .Spec .Config .K8SHTTPRouteName )
140145
141146 glog .V (6 ).Infof ("targetGroup Synthesized successfully for %v: %v\n " , resTargetGroup .Spec , tgStatus )
142147 }
@@ -167,6 +172,7 @@ func (t *targetGroupSynthesizer) SynthesizeSDKTargetGroups(ctx context.Context)
167172 glog .V (6 ).Infof ("SynthesizeSDKTargetGroups: here is sdkTGs %v len %v \n " , sdkTGs , len (sdkTGs ))
168173
169174 for _ , sdkTG := range sdkTGs {
175+ tgRouteName := ""
170176
171177 if * sdkTG .getTargetGroupOutput .Config .VpcIdentifier != config .VpcID {
172178 glog .V (6 ).Infof ("Ignore target group ARN %v Name %v for other VPCs" ,
@@ -235,6 +241,7 @@ func (t *targetGroupSynthesizer) SynthesizeSDKTargetGroups(ctx context.Context)
235241 * sdkTG .getTargetGroupOutput .Arn , * sdkTG .getTargetGroupOutput .Name )
236242
237243 httpName , ok := tgTags .Tags [latticemodel .K8SHTTPRouteNameKey ]
244+ tgRouteName = * httpName
238245
239246 if ! ok || httpName == nil {
240247 glog .V (6 ).Infof ("Ignore TargetGroup(triggered by httpRoute) %v, %v have no httproute name tag" ,
@@ -279,17 +286,21 @@ func (t *targetGroupSynthesizer) SynthesizeSDKTargetGroups(ctx context.Context)
279286
280287 }
281288
282- if tg , err := t .latticeDataStore .GetTargetGroup (* sdkTG .getTargetGroupOutput .Name , true ); err == nil {
289+ // the routename for serviceimport is ""
290+ if tg , err := t .latticeDataStore .GetTargetGroup (* sdkTG .getTargetGroupOutput .Name , "" , true ); err == nil {
283291 glog .V (6 ).Infof ("Ignore target group created by service import %v\n " , tg )
284292 continue
285293 }
286294
287- glog .V (2 ).Infof ("Append stale SDK TG to stale list Name %v, ARN %v" ,
288- * sdkTG .getTargetGroupOutput .Name , * sdkTG .getTargetGroupOutput .Id )
295+ glog .V (2 ).Infof ("Append stale SDK TG to stale list Name %v, routename %v, ARN %v" ,
296+ * sdkTG .getTargetGroupOutput .Name , tgRouteName , * sdkTG .getTargetGroupOutput .Id )
289297
290298 staleSDKTGs = append (staleSDKTGs , latticemodel.TargetGroup {
291299 Spec : latticemodel.TargetGroupSpec {
292- Name : * sdkTG .getTargetGroupOutput .Name ,
300+ Name : * sdkTG .getTargetGroupOutput .Name ,
301+ Config : latticemodel.TargetGroupConfig {
302+ K8SHTTPRouteName : tgRouteName ,
303+ },
293304 LatticeID : * sdkTG .getTargetGroupOutput .Id ,
294305 },
295306 })
0 commit comments