Skip to content

Commit e2e2e3c

Browse files
andreaswachssteffen-karlssonjtherinnfm-corticlaude
authored
chore(repo): sync with upstream scaleway CCM repo (#5)
* feat(instance): avoid missing Node Refs for Private Network Instances without pnNIC Signed-off-by: Steffen Karlsson <steffen.karlsson@gmail.com> * fix(instances,lb): propagate IPAM errors and harden backend pool updates (scaleway#213) Prevent nodes from being initialized without InternalIPs when IPAM queries fail transiently. By returning errors instead of only logging warnings, the node keeps its uninitialized taint and Kubernetes retries until IPAM is available. Additionally, use internal IPs when the service annotation scw-loadbalancer-pn-ids is set (not just the global PN_ID env var), and refuse to clear existing LB backends when no replacement IPs are found. Co-authored-by: Nicklas Frahm <nfm@corti.ai> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * feat: env to disable tags sync from ccm * fix(examples): update container image for CCM Signed-off-by: Nicklas Frahm <nfm@corti.ai> * Update Scaleway CCM image version Signed-off-by: Andreas Wachs <awa@corti.ai> * Update Scaleway CCM image version to v0.36.0-kommodity.3 Signed-off-by: Andreas Wachs <awa@corti.ai> * WIP Signed-off-by: Andreas Wachs <awa@corti.ai> * Update k8s-scaleway-ccm-latest.yml Signed-off-by: Andreas Wachs <awa@corti.ai> --------- Signed-off-by: Steffen Karlsson <steffen.karlsson@gmail.com> Signed-off-by: Nicklas Frahm <nfm@corti.ai> Signed-off-by: Andreas Wachs <awa@corti.ai> Co-authored-by: Steffen Karlsson <steffen.karlsson@gmail.com> Co-authored-by: Jérémy THERIN <jtherin@users.noreply.github.com> Co-authored-by: Nicklas Frahm <nfm@corti.ai> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Jeremy THERIN <jtherin@scaleway.com>
1 parent f49b8d7 commit e2e2e3c

3 files changed

Lines changed: 17 additions & 7 deletions

File tree

scaleway/cloud.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const (
4444
extraUserAgentEnv = "EXTRA_USER_AGENT"
4545
// disableInterfacesEnv is the environment variable used to disable some cloud interfaces
4646
disableInterfacesEnv = "DISABLE_INTERFACES"
47+
disableTagsSyncEnv = "DISABLE_TAGS_SYNC"
4748
instancesInterfaceName = "instances"
4849
loadBalancerInterfaceName = "loadbalancer"
4950
zonesInterfaceName = "zones"
@@ -129,9 +130,10 @@ func (c *cloud) Initialize(clientBuilder cloudprovider.ControllerClientBuilder,
129130

130131
klog.Infof("clientset initialized")
131132

132-
c.syncController = newSyncController(c.client, c.client.kubernetes, cacheUpdateFrequency)
133-
134-
go c.syncController.Run(stop)
133+
if os.Getenv(disableTagsSyncEnv) == "" {
134+
c.syncController = newSyncController(c.client, c.client.kubernetes, cacheUpdateFrequency)
135+
go c.syncController.Run(stop)
136+
}
135137
}
136138

137139
func (c *cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool) {

scaleway/instances.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ func (i *instances) instanceAddresses(server *scwinstance.Server) ([]v1.NodeAddr
181181
// Try to get private network IPs
182182
privateAddresses, err := i.getPrivateNetworkAddresses(server)
183183
if err != nil {
184-
klog.Warningf("error getting private network addresses for node %s: %v", server.Name, err)
184+
klog.Warningf("failed to get private network addresses for node %s: %v", server.Name, err)
185+
return nil, fmt.Errorf("failed to get private network addresses for node %s: %w", server.Name, err)
185186
}
186187

187188
if len(privateAddresses) > 0 {
@@ -235,8 +236,8 @@ func (i *instances) getPrivateNetworkAddresses(server *scwinstance.Server) ([]v1
235236
for _, pNIC := range server.PrivateNics {
236237
nicAddresses, err := i.getIPsForPrivateNIC(server, pNIC, region)
237238
if err != nil {
238-
klog.Warningf("error getting IPs for private NIC %s on node %s: %v", pNIC.ID, server.Name, err)
239-
continue
239+
klog.Warningf("failed to query IPAM for node %s: %v", server.Name, err)
240+
return addresses, fmt.Errorf("failed to query IPAM for node %s: %w", server.Name, err)
240241
}
241242
addresses = append(addresses, nicAddresses...)
242243
}

scaleway/loadbalancers.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ func (l *loadbalancers) updateLoadBalancer(ctx context.Context, loadbalancer *sc
608608
}
609609

610610
var targetIPs []string
611-
if getForceInternalIP(service) || l.pnID != "" {
611+
if getForceInternalIP(service) || l.pnID != "" || len(getPrivateNetworkIDs(service)) > 0 {
612612
targetIPs = extractNodesInternalIps(nodes)
613613
klog.V(3).Infof("using internal nodes ips: %s on loadbalancer %s", strings.Join(targetIPs, ","), loadbalancer.ID)
614614
} else {
@@ -700,6 +700,13 @@ func (l *loadbalancers) updateLoadBalancer(ctx context.Context, loadbalancer *sc
700700

701701
// Update backend servers
702702
if !stringArrayEqual(backend.Pool, targetIPs) {
703+
// Safety: refuse to clear existing backends when no replacement IPs are found
704+
if len(targetIPs) == 0 && len(backend.Pool) > 0 {
705+
klog.Warningf("refusing to clear backend pool for backend %s on loadbalancer %s — keeping %d existing servers",
706+
backend.ID, loadbalancer.ID, len(backend.Pool))
707+
continue
708+
}
709+
703710
klog.V(3).Infof("update server list for backend: %s port: %d loadbalancer: %s", backend.ID, port.NodePort, loadbalancer.ID)
704711
if _, err := l.api.SetBackendServers(&scwlb.ZonedAPISetBackendServersRequest{
705712
Zone: loadbalancer.Zone,

0 commit comments

Comments
 (0)