bugfix: initialize secondary range registry with the right value

When MultiCIDRServiceAllocator feature is enabled, we added an
additional feature gate DisableAllocatorDualWrite that allows to enable
a mirror behavior on the old allocator to deal with problems during
cluster upgrades.

During the implementation the secondary range of the legacy allocator
was initialized with the valuye of the primary range, hence, when a
Service tried to allocate a new IP on the secondary range, it succeded
in the new ip allocator but failed when it tried to allocate the same IP
on the legacy allocator, since it has a different range.

Expand the integration test that run over all the combinations of
Service ClusterIP possibilities to run with all the possible
combinations of the feature gates.

The integration test need to change the way of starting the apiserver
otherwise it will timeout.
This commit is contained in:
Antonio Ojea 2024-09-24 15:19:50 +00:00
parent 5973accf48
commit 7a9bca3888
2 changed files with 1096 additions and 975 deletions

View File

@ -440,7 +440,7 @@ func (c *Config) newServiceIPAllocators() (registries rangeRegistries, primaryCl
if err != nil { if err != nil {
return nil, err return nil, err
} }
rangeRegistry.Range = serviceClusterIPRange.String() rangeRegistry.Range = c.Services.SecondaryClusterIPRange.String()
if len(rangeRegistry.ResourceVersion) == 0 { if len(rangeRegistry.ResourceVersion) == 0 {
klog.Infof("kube-apiserver started with IP allocator and dual write enabled but bitmap allocator does not exist, recreating it ...") klog.Infof("kube-apiserver started with IP allocator and dual write enabled but bitmap allocator does not exist, recreating it ...")
err := etcd.CreateOrUpdate(rangeRegistry) err := etcd.CreateOrUpdate(rangeRegistry)

File diff suppressed because it is too large Load Diff