Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]unknown field "spec.affinity" error occurred when creating redis cluster with the latest yaml #8347

Closed
tianyue86 opened this issue Oct 29, 2024 · 2 comments
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@tianyue86
Copy link

Describe the bug

tianyue@192 kbcli % kbcli version
Kubernetes: v1.30.4-eks-a737599
KubeBlocks: 1.0.0-alpha.11
kbcli: 1.0.0-alpha.0

To Reproduce
Steps to reproduce the behavior:

  1. Get the latest redis cluster yaml
tianyue@192 kbcli % helm template redisclu02 kubeblocks-addons/redis-cluster --version 1.0.0-alpha.0
---
# Source: redis-cluster/templates/rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: kb-redisclu02
  namespace: default
  labels:
    helm.sh/chart: redis-cluster-1.0.0-alpha.0
    app.kubernetes.io/version: "7.2.4"
    app.kubernetes.io/instance: redisclu02
---
# Source: redis-cluster/templates/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: kb-redisclu02
  labels:
    helm.sh/chart: redis-cluster-1.0.0-alpha.0
    app.kubernetes.io/version: "7.2.4"
    app.kubernetes.io/instance: redisclu02
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: kubeblocks-cluster-pod-role
subjects:
  - kind: ServiceAccount
    name: kb-redisclu02
    namespace: default
---
# Source: redis-cluster/templates/cluster.yaml
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
  name: redisclu02
  namespace: default
  labels: 
    helm.sh/chart: redis-cluster-1.0.0-alpha.0
    app.kubernetes.io/version: "7.2.4"
    app.kubernetes.io/instance: redisclu02
spec:
  terminationPolicy: Delete  
  affinity:
    podAntiAffinity: Preferred
    topologyKeys:
      - kubernetes.io/hostname
    tenancy: SharedNode
  clusterDef: redis
  topology: replication
  componentSpecs:  
  - name: redis  
    replicas: 2  
    disableExporter: true
    serviceAccountName: kb-redisclu02  
    resources:
      limits:
        cpu: "0.5"
        memory: "0.5Gi"
      requests:
        cpu: "0.5"
        memory: "0.5Gi"  
    volumeClaimTemplates:
      - name: data # ref clusterDefinition components.containers.volumeMounts.name
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 20Gi  
  - name: redis-sentinel
    replicas: 3
    serviceAccountName: kb-redisclu02
    resources:
      limits:
        cpu: "0.2"
        memory:  "0.2Gi"
      requests:
        cpu: "0.2"
        memory:  "0.2Gi"
    volumeClaimTemplates:
      - name: data
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 20Gi
  1. Apply yaml to create cluster
    see error as below:
tianyue@192 kbcli % k apply -f rediscn.yaml
Error from server (BadRequest): error when creating "rediscn.yaml": Cluster in version "v1" cannot be handled as a Cluster: strict decoding error: unknown field "spec.affinity"
**Expected behavior**
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@tianyue86 tianyue86 added the kind/bug Something isn't working label Oct 29, 2024
@Y-Rookie
Copy link
Collaborator

fixed by: apecloud/kubeblocks-addons#1141

@tianyue86
Copy link
Author

Fixed. Thanks!

@github-actions github-actions bot added this to the Release 0.9.2 milestone Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants