Feat(kubernetes): add MatchLabelKeys & MismatchLabelKeys for PodAffinityTerm

What does this MR do?

Adds support for MatchLabelKeys and MismatchLabelKeys fields on PodAffinityTerm in the Kubernetes executor configuration.

These fields were introduced in Kubernetes 1.29 (beta in v1.31, stable in v1.33) and allow users to refine pod affinity/anti-affinity scheduling constraints by specifying which label keys on the incoming pod should be used to build implicit label selectors.

Why was this MR needed?

Users configuring pod affinity rules in GitLab Runner had no way to set matchLabelKeys or mismatchLabelKeys, which are useful for e.g multi-tenant scheduling (spreading pods with different tenant labels). Without this, users could not take advantage of these Kubernetes scheduling features from the runner config.

What's the best way to test this MR?

  1. Configure a runner with match_label_keys and/or mismatch_label_keys in a pod affinity term in config.toml.
  2. Run a job and verify the resulting pod spec includes the fields (e.g. via kubectl get pod <pod> -o yaml).

What are the relevant issue numbers?

none

Merge request reports

Loading