kubernetes-sigs/cluster-api-provider-vsphere

failureDomainSelector with matchExpressions / matchLabels

jisnardo opened this issue · 4 comments

/kind bug

Using failureDomainSelector with vspherecluster.

What steps did you take and what happened:

case 1:

failureDomainSelector: {}

status:
...
  failureDomains:
    cpd1:
      controlPlane: true
    cpd2:
      controlPlane: true
    cpd3:
      controlPlane: true

As expected.

case 2:

failureDomainSelector:
  matchExpressions:
  - key: cpd
    operator: In
    values:
      - cpd1

No status failureDomains.

case 3:

failureDomainSelector:
  matchLabels:
    cpd: cpd1

No status failureDomains.

What did you expect to happen:

case 2:

failureDomainSelector:
  matchExpressions:
  - key: cpd
    operator: In
    values:
      - cpd1
status:
...
  failureDomains:
    cpd1:
      controlPlane: true

case 3:

failureDomainSelector:
  matchLabels:
    cpd: cpd1
status:
...
  failureDomains:
    cpd1:
      controlPlane: true

Anything else you would like to add:

Deployed failure domains.

apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: VSphereFailureDomain
...
  labels:
    cpd: cpd1
k get vspherefailuredomains.infrastructure.cluster.x-k8s.io 
NAME    AGE
cpd1    99m
cpd2    69d
cpd3    25d
k get vspherefailuredomains.infrastructure.cluster.x-k8s.io -l cpd=cpd1
NAME   AGE
cpd1   100m

crd.

  failureDomainSelector:
    description: FailureDomainSelector is the label selector to use for
      failure domain selection for the control plane nodes of the cluster.
      If not set (`nil`), selecting failure domains will be disabled.
      An empty value (`{}`) selects all existing failure domains. A valid
      selector will select all failure domains which match the selector.
    properties:
      matchExpressions:
        description: matchExpressions is a list of label selector requirements.
          The requirements are ANDed.
        items:
          description: A label selector requirement is a selector that
            contains values, a key, and an operator that relates the key
            and values.
          properties:
            key:
              description: key is the label key that the selector applies
                to.
              type: string
            operator:
              description: operator represents a key's relationship to
                a set of values. Valid operators are In, NotIn, Exists
                and DoesNotExist.
              type: string
            values:
              description: values is an array of string values. If the
                operator is In or NotIn, the values array must be non-empty.
                If the operator is Exists or DoesNotExist, the values
                array must be empty. This array is replaced during a strategic
                merge patch.
              items:
                type: string
              type: array
          required:
          - key
          - operator
          type: object
        type: array
      matchLabels:
        additionalProperties:
          type: string
        description: matchLabels is a map of {key,value} pairs. A single
          {key,value} in the matchLabels map is equivalent to an element
          of matchExpressions, whose key field is "key", the operator
          is "In", and the values array contains only "value". The requirements
          are ANDed.
        type: object
    type: object
    x-kubernetes-map-type: atomic

Environment:

  • Cluster-api-provider-vsphere version: clusterctl init --core=cluster-api:v1.6.2 --bootstrap=kubeadm:v1.6.2 --control-plane=kubeadm:v1.6.2 --infrastructure=vsphere:v1.9.1 --ipam=in-cluster:v0.1.0
  • Kubernetes version: v1.28.0
  • OS (e.g. from /etc/os-release): Ubuntu 22.04

Cluster API vSphere image - Ubuntu 22.04 and Kubernetes v1.28.0

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

/remove-lifecycle stale

We should take a look into this

CAPV selects the failuredomains form the VSphereDeploymentZone CR.

So you have to set the cpd label on the VSphereDeploymentZone instead of VSphereFailureDomain. This wording is not optimal and very tricky...