Compare commits

..

3 Commits

Author SHA1 Message Date
Marcel Fest
b514ae2733 fix: regression on tests as we moved to context
Signed-off-by: Marcel Fest <marcel.fest@telekom.de>
2026-09-15 17:20:53 +02:00
Marcel Fest
26eab74f3e fix(services): coordinate service, election and manager lifecycle
Serialize per-Service state behind UID locks, order events per Service, and
make readiness and watcher ownership generation-aware. Coordinate shared lease
membership so cleanup cannot cancel a recreated Service, drain cluster workers
before restart, and start the shutdown watcher before slow startup calls.

Signed-off-by: Marcel Fest <marcel.fest@telekom.de>
2026-09-15 17:20:52 +02:00
Marcel Fest
44a67bc901 fix: regression on preserveOnLeadershipLoss
Signed-off-by: Marcel Fest <marcel.fest@telekom.de>
2026-09-15 15:44:08 +02:00
2 changed files with 9 additions and 4 deletions

View File

@@ -274,6 +274,8 @@ func (instance *Instance) initialize(ctx context.Context, svc *v1.Service, confi
DHCPBackoffAttempts: config.DHCPBackoffAttempts,
DisableServiceUpdates: config.DisableServiceUpdates,
EnableServicesElection: config.EnableServicesElection,
// cleanupVIPs reads this from the per-VIP config, so Service VIPs need it too.
PreserveVIPOnLeadershipLoss: config.PreserveVIPOnLeadershipLoss,
KubernetesLeaderElection: kubevip.KubernetesLeaderElection{
EnableLeaderElection: config.EnableLeaderElection,
},

View File

@@ -26,7 +26,8 @@ type testDHCPClient struct {
}
func newTestDHCPClient() *testDHCPClient {
return &testDHCPClient{ips: make(chan string, 1), errors: make(chan error)}
// Unbuffered so a send only completes once the watcher has taken the address.
return &testDHCPClient{ips: make(chan string), errors: make(chan error)}
}
func (c *testDHCPClient) ErrorChannel() chan error { return c.errors }
@@ -209,13 +210,15 @@ func TestConfigureServiceWatchesBothDHCPFamilies(t *testing.T) {
}
wg := &sync.WaitGroup{}
if err := processor.configureService(context.Background(), serviceInstance, service, wg); err != nil {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
if err := processor.configureService(ctx, serviceInstance, service, wg); err != nil {
t.Fatalf("configureService() error = %v", err)
}
dhcpv4.ips <- "192.0.2.10"
dhcpv6.ips <- "2001:db8::10"
close(dhcpv4.ips)
close(dhcpv6.ips)
cancel()
wg.Wait()
if got := serviceInstance.DHCPInterfaceIPv4; got != "192.0.2.10" {