stackabletech / issues

This repository is only for issues that concern multiple repositories or don't fit into any specific repository
2 stars 0 forks source link

config.affinity.nodeSelector not working #554

Closed sbernauer closed 8 months ago

sbernauer commented 8 months ago

Someone in the community discord posted this snippet:

apiVersion: trino.stackable.tech/v1alpha1
kind: TrinoCluster
metadata:
  name: stackable-trino-medusa-dev
  namespace: trino-medusa-dev
spec:
  image:
    productVersion: "428"
  clusterConfig:
    catalogLabelSelector:
      matchLabels:
        trino: stackable-trino-medusa-dev
    listenerClass: external-unstable
  coordinators:
    roleGroups:
      default:
        replicas: 1
    config:
      affinity:
        nodeSelector:
          kubernetes.io/arch: amd64
  workers:
    roleGroups:
      default:
        replicas: 2
    config:
      affinity:
        nodeSelector:
          kubernetes.io/arch: amd64

Which when I try to apply it fails with this:

TrinoCluster in version "v1alpha1" cannot be handled as a TrinoCluster: strict decoding error: unknown field "spec.coordinators.config.affinity.nodeSelector.kubernetes", unknown field "spec.workers.config.affinity.nodeSelector.kubernetes.io/arch"

I have looked at the code and the crd deployed in cluster (23.11) and the field nodeSelector is there and of type "object". This is probably some deserialization dark magic that I do not understand. Can someone explain to me, why the above snippet is not accepted by the api-server and how I could get it accepted? As a workaround, this does what it is intended to do:

---
apiVersion: trino.stackable.tech/v1alpha1
kind: TrinoCluster
metadata:
  name: stackable-trino-medusa-dev
spec:
  image:
    productVersion: "428"
  clusterConfig:
    catalogLabelSelector:
      matchLabels:
        trino: stackable-trino-medusa-dev
    listenerClass: external-unstable
  coordinators:
    roleGroups:
      default:
        replicas: 1
    config:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: kubernetes.io/arch
                    operator: In
                    values:
                      - amd64
  workers:
    roleGroups:
      default:
        replicas: 2
    config:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: kubernetes.io/arch
                    operator: In
                    values:
                      - amd64
lfrancke commented 7 months ago

This is in 24.3 correct?

sbernauer commented 7 months ago

Nope, sadly not. Will be in the following release