You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: PartitionSet endlessly recreates Partitions when a dimension is also in shardSelector.matchLabels #4549
When a PartitionSet uses a label both as a dimension and in spec.shardSelector.matchLabels, the PartitionSet controller never stops deleting and recreating the generated Partition.
partition() in pkg/reconciler/topology/partitionset/partitionset_reconcile.go builds its label list by appending the selector matchLabels keys to the dimensions without removing duplicates. For a label that appears in both, the computed key comes out as +region=eu+region=eu. The key computed for an existing Partition comes from its spec.selector.matchLabels map, so it can only be +region=eu. The two keys never match. Each reconcile therefore deletes the existing Partition and creates a new one with a new generated name. Each delete/create event re-enqueues the PartitionSet, so the loop never ends.
The unit test case Partitions created with selector and dimension overlapping covers only the first reconcile, when no Partition exists yet, so it doesn't catch this.
Steps To Reproduce
Start kcp and, in root, create a shard labelled region: eu.
Run kubectl get partitions a few times. The partition name keeps changing (regions-eu-xxxxx). With -v=2, the kcp log fills with creating partition / deleting partition lines. In a local run, about 7,600 such lines were logged within 45 seconds.
Expected Behaviour
A single Partition (matchLabels: {region: eu}) is created and then left alone, just as when the label is only a dimension.
Additional Context
Deduplicating the label list in partition() makes both keys match again.
Activity