apecloud / kubeblocks

KubeBlocks is an open-source control plane software that runs and manages databases, message queues and other stateful applications on K8s.
https://kubeblocks.io
GNU Affero General Public License v3.0
2.21k stars 184 forks source link

[BUG]“podAffinityTerm.topologyKey: Required value: can not be empty” returned when specify tenancy at cluster level only #4873

Closed ahjing99 closed 5 months ago

ahjing99 commented 1 year ago

When specify " tenancy: DedicatedNode" in cluster level and didn't specify the value in component pulsar-zookeeper level, the zookeeper component cannot created

kubectl apply -f -<< EOF
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
  name: pulsar
spec:
  clusterDefinitionRef: pulsar
  clusterVersionRef: pulsar-2.11.2
  terminationPolicy: Delete
  tenancy: DedicatedNode
  componentSpecs:
    - name: broker
      componentDefRef: pulsar-broker
      monitor: true
      replicas: 3
      affinity:
        tenancy: DedicatedNode
      tolerations:
      - key: pulsar-broker
        operator: Equal
        value: "true"
    - name: bookies
      componentDefRef: bookies
      monitor: true
      replicas: 3
      affinity:
        tenancy: DedicatedNode
      tolerations:
      - key: pulsar-bookies
        operator: Equal
        value: "true"
      volumeClaimTemplates:
        - name: ledgers
          spec:
            storageClassName: openebs-lvmpv-pulsar-ldg
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 5Gi
        - name: journal
          spec:
            storageClassName: openebs-lvmpv-pulsar-jnl
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 5Gi
    - name: zookeeper
      componentDefRef: zookeeper
      monitor: true
      replicas: 3
      tolerations:
      - key: pulsar-zookeeper
        operator: Equal
        value: "true"
      volumeClaimTemplates:
        - name: data
          spec:
            storageClassName: openebs-lvmpv-pulsar-ldg
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 1Gi
EOF
cluster.apps.kubeblocks.io/pulsar created

k describe sts pulsar-zookeeper
Name:               pulsar-zookeeper
Namespace:          default
CreationTimestamp:  Fri, 25 Aug 2023 04:56:13 +0000
Selector:           app.kubernetes.io/instance=pulsar,app.kubernetes.io/managed-by=kubeblocks,app.kubernetes.io/name=pulsar,apps.kubeblocks.io/component-name=zookeeper
Labels:             app.kubernetes.io/component=zookeeper
                    app.kubernetes.io/instance=pulsar
                    app.kubernetes.io/managed-by=kubeblocks
                    app.kubernetes.io/name=pulsar
                    apps.kubeblocks.io/component-name=zookeeper
Annotations:        config.kubeblocks.io/tpl-agamotto-configuration: pulsar-zookeeper-agamotto-configuration
                    config.kubeblocks.io/tpl-pulsar-scripts: pulsar-zookeeper-pulsar-scripts
                    config.kubeblocks.io/tpl-zookeeper-env: pulsar-zookeeper-zookeeper-env
                    kubeblocks.io/generation: 1
Replicas:           3 desired | 0 total
Update Strategy:    RollingUpdate
  Partition:        0
Pods Status:        0 Running / 0 Waiting / 0 Succeeded / 0 Failed
Pod Template:
  Labels:  app.kubernetes.io/component=zookeeper
           app.kubernetes.io/instance=pulsar
           app.kubernetes.io/managed-by=kubeblocks
           app.kubernetes.io/name=pulsar
           app.kubernetes.io/version=pulsar-2.11.2
           apps.kubeblocks.io/component-name=zookeeper
           apps.kubeblocks.io/workload-type=Stateful
  Containers:
   zookeeper:
    Image:       registry.cn-hangzhou.aliyuncs.com/apecloud/pulsar:2.11.2
    Ports:       2181/TCP, 2888/TCP, 3888/TCP, 8000/TCP
    Host Ports:  0/TCP, 0/TCP, 0/TCP, 0/TCP
    Command:
      /kb-scripts/start-zookeeper.sh
    Requests:
      cpu:     50m
      memory:  256Mi
    Liveness:  exec [bash -c echo ruok | nc -q 1 localhost 2181 | grep imok] delay=5s timeout=30s period=30s #success=1 #failure=10
    Environment Variables from:
      pulsar-zookeeper-env                    ConfigMap  Optional: false
      pulsar-zookeeper-zookeeper-env-envfrom  ConfigMap  Optional: false
    Environment:
      KB_POD_NAME:                 (v1:metadata.name)
      KB_POD_UID:                  (v1:metadata.uid)
      KB_NAMESPACE:                (v1:metadata.namespace)
      KB_SA_NAME:                  (v1:spec.serviceAccountName)
      KB_NODENAME:                 (v1:spec.nodeName)
      KB_HOST_IP:                  (v1:status.hostIP)
      KB_POD_IP:                   (v1:status.podIP)
      KB_POD_IPS:                  (v1:status.podIPs)
      KB_HOSTIP:                   (v1:status.hostIP)
      KB_PODIP:                    (v1:status.podIP)
      KB_PODIPS:                   (v1:status.podIPs)
      KB_CLUSTER_NAME:            pulsar
      KB_COMP_NAME:               zookeeper
      KB_CLUSTER_COMP_NAME:       pulsar-zookeeper
      KB_CLUSTER_UID_POSTFIX_8:   6f81c444
      KB_POD_FQDN:                $(KB_POD_NAME).$(KB_CLUSTER_COMP_NAME)-headless.$(KB_NAMESPACE).svc
      EXTERNAL_PROVIDED_SERVERS:  false
      OPTS:                       -Dlog4j2.formatMsgNoLookups=true
    Mounts:
      /kb-scripts from scripts (rw)
      /opt/pulsar/none from zookeeper-config-env (rw)
      /pulsar/data from data (rw)
      /pulsar/data-log from data-log (rw)
   metrics:
    Image:      registry.cn-hangzhou.aliyuncs.com/apecloud/agamotto:0.1.2-beta.2
    Port:       1234/TCP
    Host Port:  0/TCP
    Command:
      /bin/agamotto
      --config=/opt/agamotto/agamotto-config.yaml
      --feature-gates=-pkg.translator.prometheus.NormalizeName
    Limits:
      cpu:     0
      memory:  0
    Environment Variables from:
      pulsar-zookeeper-env  ConfigMap  Optional: false
    Environment:
      KB_POD_NAME:                (v1:metadata.name)
      KB_POD_UID:                 (v1:metadata.uid)
      KB_NAMESPACE:               (v1:metadata.namespace)
      KB_SA_NAME:                 (v1:spec.serviceAccountName)
      KB_NODENAME:                (v1:spec.nodeName)
      KB_HOST_IP:                 (v1:status.hostIP)
      KB_POD_IP:                  (v1:status.podIP)
      KB_POD_IPS:                 (v1:status.podIPs)
      KB_HOSTIP:                  (v1:status.hostIP)
      KB_PODIP:                   (v1:status.podIP)
      KB_PODIPS:                  (v1:status.podIPs)
      KB_CLUSTER_NAME:           pulsar
      KB_COMP_NAME:              zookeeper
      KB_CLUSTER_COMP_NAME:      pulsar-zookeeper
      KB_CLUSTER_UID_POSTFIX_8:  6f81c444
      KB_POD_FQDN:               $(KB_POD_NAME).$(KB_CLUSTER_COMP_NAME)-headless.$(KB_NAMESPACE).svc
      JOB_NAME:                  zookeeper
      SERVICE_PORT:              8000
      POD_NAME:                  $(KB_POD_NAME)
      POD_NAMESPACE:             $(KB_NAMESPACE)
      LOG_LEVEL:                 info
    Mounts:
      /opt/agamotto from agamotto-configuration (rw)
  Volumes:
   agamotto-configuration:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      pulsar-zookeeper-agamotto-configuration
    Optional:  false
   scripts:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      pulsar-zookeeper-pulsar-scripts
    Optional:  false
   zookeeper-config-env:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      pulsar-zookeeper-zookeeper-env
    Optional:  false
   data:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
   data-log:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
Volume Claims:
  Name:          data
  StorageClass:  openebs-lvmpv-pulsar-ldg
  Labels:        apps.kubeblocks.io/vct-name=data
  Annotations:   <none>
  Capacity:      1Gi
  Access Modes:  [ReadWriteOnce]
Events:
  Type     Reason            Age                   From                    Message
  ----     ------            ----                  ----                    -------
  Normal   SuccessfulCreate  5m49s                 statefulset-controller  create Claim data-pulsar-zookeeper-0 Pod pulsar-zookeeper-0 in StatefulSet pulsar-zookeeper success
  Warning  FailedCreate      22s (x17 over 5m49s)  statefulset-controller  create Pod pulsar-zookeeper-0 in StatefulSet pulsar-zookeeper failed error: Pod "pulsar-zookeeper-0" is invalid: [spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.topologyKey: Required value: can not be empty, spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.topologyKey: Invalid value: "": name part must be non-empty, spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.topologyKey: Invalid value: "": name part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName',  or 'my.name',  or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]'), spec.topologySpreadConstraints[0].topologyKey: Required value: can not be empty]
github-actions[bot] commented 1 year ago

This issue has been marked as stale because it has been open for 30 days with no activity

nayutah commented 5 months ago

Support it in enterprise-edition