gardener / gardener-extension-provider-azure

Gardener extension controller for the Azure cloud provider (https://azure.microsoft.com).

Home Page:https://gardener.cloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handle inconsistent zone naming

timuthy opened this issue · comments

How to categorize this issue?

/area high-availability
/area control-plane
/kind enhancement
/platform azure

What would you like to be added:
A new webhook should be added to the Azure provider extension that reacts on Pod creations and mutates node affinities that contain zone information.
The logic is supposed to prefix the zone by the shoot's region, like shown in the following example where the shoot is located in westeurope.

Input:

spec:
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: topology.kubernetes.io/zone
            operator: In
            values:
            - "2"

Output:

spec:
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: topology.kubernetes.io/zone
            operator: In
            values:
            - "westeurope-2"

Why is this needed:
Gardener expects a consistent zone naming across shoot and seed clusters.
When ManagedSeed workers are configured shoot.spec.provider.workers[].zones, the very same information is replicated to seed.spec.provider.zones. This is furthermore used to add node affinities to control-plane pods in the seed (see this document for more information).

Azure however, has an inconsistent naming in this matter and breaks the expectation. While zones are officially numeric only (1, 2, 3, ...), the CCM adds a compound of region + zone to the related node label, i.e. topology.kubernetes.io/zone: {region}-{zone}

Refs (thanks @kon-angelo):