Skip to content

Commit bffa8bc

Browse files
author
Ryan Lymburner
authored
Merge branch 'main' into dependabot/go_modules/github.com/prometheus/client_golang-1.22.0
2 parents c88147c + 8a18151 commit bffa8bc

File tree

7 files changed

+256
-71
lines changed

7 files changed

+256
-71
lines changed

pkg/deploy/lattice/targets_manager.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,21 @@ func (s *defaultTargetsManager) Update(ctx context.Context, modelTargets *model.
5959
modelTg.ID(), modelTargets.Spec.StackTargetGroupId)
6060
}
6161

62-
s.log.Debugf(ctx, "Creating targets for target group %s", modelTg.Status.Id)
62+
s.log.Debugf(ctx, "Updating targets for target group %s with %d desired targets", modelTg.Status.Id, len(modelTargets.Spec.TargetList))
6363

6464
latticeTargets, err := s.List(ctx, modelTg)
6565
if err != nil {
6666
return err
6767
}
68+
s.log.Debugf(ctx, "Found %d existing targets in VPC Lattice for target group %s", len(latticeTargets), modelTg.Status.Id)
69+
6870
staleTargets := s.findStaleTargets(modelTargets, latticeTargets)
71+
if len(staleTargets) > 0 {
72+
s.log.Infof(ctx, "Found %d stale targets to deregister from target group %s", len(staleTargets), modelTg.Status.Id)
73+
for _, target := range staleTargets {
74+
s.log.Debugf(ctx, "Stale target: %s:%d", target.TargetIP, target.Port)
75+
}
76+
}
6977

7078
err1 := s.deregisterTargets(ctx, modelTg, staleTargets)
7179
err2 := s.registerTargets(ctx, modelTg, modelTargets.Spec.TargetList)
@@ -92,6 +100,8 @@ func (s *defaultTargetsManager) findStaleTargets(
92100
TargetIP: aws.StringValue(target.Id),
93101
Port: aws.Int64Value(target.Port),
94102
}
103+
// Consider targets stale if they are not in the current model set and not already draining
104+
// This ensures that when pods are recreated with new IPs, old IPs are properly deregistered
95105
if aws.StringValue(target.Status) != vpclattice.TargetStatusDraining && !modelSet.Contains(ipPort) {
96106
staleTargets = append(staleTargets, ipPort)
97107
}

pkg/gateway/model_build_targets.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,26 @@ func (t *latticeTargetsModelBuildTask) getTargetListFromEndpoints(ctx context.Co
178178
return nil, err
179179
}
180180

181+
t.log.Debugf(ctx, "Found %d EndpointSlices for service %s/%s", len(epSlices.Items), t.service.Namespace, t.service.Name)
182+
181183
var targetList []model.Target
182184
for _, epSlice := range epSlices.Items {
185+
t.log.Debugf(ctx, "Processing EndpointSlice %s with %d endpoints", epSlice.Name, len(epSlice.Endpoints))
183186
for _, port := range epSlice.Ports {
184187
// Note that the Endpoint's port name is from ServicePort, but the actual registered port
185188
// is from Pods(targets).
186189
if _, ok := servicePortNames[aws.StringValue(port.Name)]; ok || skipMatch {
187190
for _, ep := range epSlice.Endpoints {
191+
// Log endpoint conditions for debugging
192+
t.log.Debugf(ctx, "Endpoint conditions - Ready: %v, Serving: %v, Terminating: %v",
193+
aws.BoolValue(ep.Conditions.Ready),
194+
aws.BoolValue(ep.Conditions.Serving),
195+
aws.BoolValue(ep.Conditions.Terminating))
196+
188197
for _, address := range ep.Addresses {
189198
// Do not model terminating endpoints so that they can deregister.
190199
if aws.BoolValue(ep.Conditions.Terminating) {
200+
t.log.Debugf(ctx, "Skipping terminating endpoint %s", address)
191201
continue
192202
}
193203
target := model.Target{
@@ -197,13 +207,17 @@ func (t *latticeTargetsModelBuildTask) getTargetListFromEndpoints(ctx context.Co
197207
}
198208
if ep.TargetRef != nil && ep.TargetRef.Kind == "Pod" {
199209
target.TargetRef = types.NamespacedName{Namespace: ep.TargetRef.Namespace, Name: ep.TargetRef.Name}
210+
t.log.Debugf(ctx, "Adding target %s:%d for pod %s/%s", address, aws.Int32Value(port.Port), ep.TargetRef.Namespace, ep.TargetRef.Name)
211+
} else {
212+
t.log.Debugf(ctx, "Adding target %s:%d (no pod reference)", address, aws.Int32Value(port.Port))
200213
}
201214
targetList = append(targetList, target)
202215
}
203216
}
204217
}
205218
}
206219
}
220+
t.log.Debugf(ctx, "Built %d targets from EndpointSlices for service %s/%s", len(targetList), t.service.Namespace, t.service.Name)
207221
return targetList, nil
208222
}
209223

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ python-dateutil==2.8.2
2323
PyYAML==6.0.1
2424
pyyaml_env_tag==0.1
2525
regex==2023.10.3
26-
requests==2.32.0
26+
requests==2.32.4
2727
six==1.16.0
2828
urllib3==2.2.2
2929
watchdog==3.0.0

test/go.mod

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/aws/aws-application-networking-k8s/test
22

3-
go 1.23.6
3+
go 1.24.0
44

55
replace github.com/aws/aws-application-networking-k8s => ../
66

@@ -9,14 +9,14 @@ require (
99
github.com/aws/aws-application-networking-k8s v0.3.0
1010
github.com/aws/aws-sdk-go v1.55.6
1111
github.com/imdario/mergo v0.3.16
12-
github.com/onsi/ginkgo/v2 v2.22.0
13-
github.com/onsi/gomega v1.36.1
12+
github.com/onsi/ginkgo/v2 v2.23.4
13+
github.com/onsi/gomega v1.37.0
1414
github.com/samber/lo v1.50.0
1515
go.uber.org/zap v1.27.0
1616
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa
17-
k8s.io/api v0.32.2
18-
k8s.io/apimachinery v0.32.2
19-
k8s.io/client-go v0.32.2
17+
k8s.io/api v0.33.1
18+
k8s.io/apimachinery v0.33.1
19+
k8s.io/client-go v0.33.1
2020
sigs.k8s.io/controller-runtime v0.20.2
2121
sigs.k8s.io/external-dns v0.15.1
2222
sigs.k8s.io/gateway-api v1.2.1
@@ -37,14 +37,13 @@ require (
3737
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
3838
github.com/gogo/protobuf v1.3.2 // indirect
3939
github.com/golang/mock v1.6.0 // indirect
40-
github.com/golang/protobuf v1.5.4 // indirect
4140
github.com/google/btree v1.1.3 // indirect
4241
github.com/google/gnostic-models v0.6.9 // indirect
43-
github.com/google/go-cmp v0.6.0 // indirect
42+
github.com/google/go-cmp v0.7.0 // indirect
4443
github.com/google/gofuzz v1.2.0 // indirect
45-
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect
44+
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
4645
github.com/google/uuid v1.6.0 // indirect
47-
github.com/gorilla/websocket v1.5.1 // indirect
46+
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
4847
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
4948
github.com/jmespath/go-jmespath v0.4.0 // indirect
5049
github.com/josharian/intern v1.0.0 // indirect
@@ -64,25 +63,27 @@ require (
6463
github.com/sirupsen/logrus v1.9.3 // indirect
6564
github.com/spf13/pflag v1.0.6 // indirect
6665
github.com/x448/float16 v0.8.4 // indirect
66+
go.uber.org/automaxprocs v1.6.0 // indirect
6767
go.uber.org/multierr v1.11.0 // indirect
6868
golang.org/x/net v0.38.0 // indirect
69-
golang.org/x/oauth2 v0.26.0 // indirect
69+
golang.org/x/oauth2 v0.27.0 // indirect
7070
golang.org/x/sync v0.12.0 // indirect
71-
golang.org/x/sys v0.31.0 // indirect
71+
golang.org/x/sys v0.32.0 // indirect
7272
golang.org/x/term v0.30.0 // indirect
7373
golang.org/x/text v0.23.0 // indirect
7474
golang.org/x/time v0.10.0 // indirect
75-
golang.org/x/tools v0.30.0 // indirect
75+
golang.org/x/tools v0.31.0 // indirect
7676
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
7777
google.golang.org/protobuf v1.36.5 // indirect
7878
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
7979
gopkg.in/inf.v0 v0.9.1 // indirect
8080
gopkg.in/yaml.v3 v3.0.1 // indirect
8181
k8s.io/apiextensions-apiserver v0.32.2 // indirect
8282
k8s.io/klog/v2 v2.130.1 // indirect
83-
k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 // indirect
83+
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
8484
k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect
8585
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
86-
sigs.k8s.io/structured-merge-diff/v4 v4.5.0 // indirect
86+
sigs.k8s.io/randfill v1.0.0 // indirect
87+
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
8788
sigs.k8s.io/yaml v1.4.0 // indirect
8889
)

0 commit comments

Comments
 (0)