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] redis twemproxy cmpd is unavailable: immutable fields can't be updated #8257

Closed
JashBook opened this issue Oct 10, 2024 · 1 comment
Closed
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@JashBook
Copy link
Collaborator

JashBook commented Oct 10, 2024

Describe the bug

kbcli version
Kubernetes: v1.30.1-aliyun.1
KubeBlocks: 0.9.1-beta.29
kbcli: 0.9.1

To Reproduce
Steps to reproduce the behavior:

  1. create cluster
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
  name: redis-vwbufq
  namespace: default
spec:
  terminationPolicy: WipeOut
  componentSpecs:
    - name: redis
      componentDef: redis-7
      replicas: 1
      resources:
        requests:
          cpu: 100m
          memory: 0.5Gi
        limits:
          cpu: 100m
          memory: 0.5Gi
      switchPolicy:
        type: Noop
      volumeClaimTemplates:
        - name: data
          spec:
            storageClassName:
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 20Gi
    - name: redis-sentinel
      componentDef: redis-sentinel-7
      replicas: 3
      resources:
        requests:
          cpu: 100m
          memory: 0.5Gi
        limits:
          cpu: 100m
          memory: 0.5Gi
      volumeClaimTemplates:
        - name: data
          spec:
            storageClassName:
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 20Gi
    - name: redis-twemproxy
      componentDef: redis-twemproxy-0.5
      replicas: 1
      resources:
        requests:
          cpu: 100m
          memory: 0.5Gi
        limits:
          cpu: 100m
          memory: 0.5Gi
      volumeClaimTemplates:
        - name: data
          spec:
            storageClassName:
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 20Gi
  1. Click on '....'
  2. Scroll down to '....'
  3. See error
➜  ~ kubectl get cluster
NAME           CLUSTER-DEFINITION   VERSION   TERMINATION-POLICY   STATUS   AGE
redis-vwbufq                                  WipeOut                       9m50s
➜  ~ 
➜  ~ kubectl get pod 
NAME                            READY   STATUS    RESTARTS   AGE
redis-vwbufq-redis-0            3/3     Running   0          9m29s
redis-vwbufq-redis-sentinel-0   2/2     Running   0          9m54s
redis-vwbufq-redis-sentinel-1   2/2     Running   0          9m54s
redis-vwbufq-redis-sentinel-2   2/2     Running   0          9m54s

➜  ~ kubectl get cmp
NAME                           DEFINITION            SERVICE-VERSION   STATUS    AGE
redis-vwbufq-redis             redis-7               7.2.4             Running   11m
redis-vwbufq-redis-sentinel    redis-sentinel-7      7.2.4             Running   11m
redis-vwbufq-redis-twemproxy   redis-twemproxy-0.5   0.5.0                       11m

➜  ~ kubectl get cmpd -l app.kubernetes.io/name=redis 
NAME                  SERVICE           SERVICE-VERSION   STATUS        AGE
redis-7               redis             7.2.4             Available     72d
redis-cluster-7       redis-cluster     7.2.4             Unavailable   72d
redis-sentinel-7      redis-sentinel    7.2.4             Available     72d
redis-twemproxy-0.5   redis-twemproxy   0.5.0             Unavailable   72d

describe cmp

kubectl describe cmp redis-vwbufq-redis-twemproxy
Name:         redis-vwbufq-redis-twemproxy
Namespace:    default
Labels:       app.kubernetes.io/instance=redis-vwbufq
              app.kubernetes.io/managed-by=kubeblocks
              apps.kubeblocks.io/cluster-uid=789cffba-d3e9-4b63-844a-c29e97251e32
              apps.kubeblocks.io/component-name=redis-twemproxy
              componentdefinition.kubeblocks.io/name=redis-twemproxy-0.5
Annotations:  kubeblocks.io/generation: 2
API Version:  apps.kubeblocks.io/v1alpha1
Kind:         Component
Metadata:
  Creation Timestamp:  2024-10-10T07:58:13Z
  Finalizers:
    cluster.kubeblocks.io/finalizer
    component.kubeblocks.io/finalizer
  Generation:  1
  Owner References:
    API Version:           apps.kubeblocks.io/v1alpha1
    Block Owner Deletion:  true
    Controller:            true
    Kind:                  Cluster
    Name:                  redis-vwbufq
    UID:                   789cffba-d3e9-4b63-844a-c29e97251e32
  Resource Version:        54555191
  UID:                     5576118b-38bf-4e8f-b383-153d01d109e1
Spec:
  Comp Def:  redis-twemproxy-0.5
  Replicas:  1
  Resources:
    Limits:
      Cpu:     100m
      Memory:  512Mi
    Requests:
      Cpu:     100m
      Memory:  512Mi
  Scheduling Policy:
    Affinity:
      Node Affinity:
        Preferred During Scheduling Ignored During Execution:
          Preference:
            Match Expressions:
              Key:       kb-data
              Operator:  In
              Values:
                true
          Weight:  100
    Tolerations:
      Effect:       NoSchedule
      Key:          kb-data
      Operator:     Equal
      Value:        true
  Service Version:  0.5.0
  Volume Claim Templates:
    Name:  data
    Spec:
      Access Modes:
        ReadWriteOnce
      Resources:
        Requests:
          Storage:  20Gi
Status:
  Conditions:
    Last Transition Time:  2024-10-10T07:58:13Z
    Message:               requeue after: 1s as: the referenced ComponentDefinition is unavailable: redis-twemproxy-0.5
    Reason:                PreCheckFailed
    Status:                False
    Type:                  ProvisioningStarted
Events:                    <none>
➜  ~ 

describe cmpd

kubectl describe cmpd redis-twemproxy-0.5
Name:         redis-twemproxy-0.5
Namespace:    
Labels:       app.kubernetes.io/instance=kb-addon-redis
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=redis
              app.kubernetes.io/version=7.2.4
              config.kubeblocks.io/tpl-redis-scripts=redis-scripts
              helm.sh/chart=redis-0.9.0
Annotations:  apps.kubeblocks.io/immutable-hash: 8b7fd97c8
              meta.helm.sh/release-name: kb-addon-redis
              meta.helm.sh/release-namespace: kb-system
API Version:  apps.kubeblocks.io/v1alpha1
Kind:         ComponentDefinition
Metadata:
  Creation Timestamp:  2024-07-30T07:29:44Z
  Finalizers:
    componentdefinition.kubeblocks.io/finalizer
  Generation:        3
  Resource Version:  41382510
  UID:               dca7b4ca-e592-4495-9f6e-72acced87c2d
Spec:
  Description:        A Twemproxy component definition for Kubernetes
  Min Ready Seconds:  0
  Provider:           KubeBlocks
  Role Arbitrator:    External
  Runtime:
    Containers:
      Command:
        sh
        -c
        nutcracker -c /etc/proxy/nutcracker.conf -v 4 -m 16384
      Image:              apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/twemproxy:0.5.0
      Image Pull Policy:  IfNotPresent
      Name:               redis-twemproxy
      Ports:
        Container Port:  22121
        Name:            redis-twemproxy
        Protocol:        TCP
      Volume Mounts:
        Mount Path:  /data
        Name:        data
        Mount Path:  /etc/conf
        Name:        redis-config
        Mount Path:  /etc/proxy
        Name:        proxy-conf
        Mount Path:  /scripts
        Name:        scripts
    Init Containers:
      Command:
        /scripts/redis-twemproxy-setup-v2.sh
      Image:              apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/busybox:1.36
      Image Pull Policy:  IfNotPresent
      Name:               init-redis-twemproxy
      Volume Mounts:
        Mount Path:  /data
        Name:        data
        Mount Path:  /etc/conf
        Name:        redis-config
        Mount Path:  /etc/proxy
        Name:        proxy-conf
        Mount Path:  /scripts
        Name:        scripts
  Scripts:
    Default Mode:   365
    Name:           redis-scripts
    Namespace:      kb-system
    Template Ref:   redis-scripts
    Volume Name:    scripts
  Service Kind:     redis-twemproxy
  Service Version:  0.5.0
  Services:
    Name:          twemproxy
    Pod Service:   false
    Service Name:  twemproxy
    Spec:
      Ports:
        Name:         redis-twemproxy
        Port:         22121
        Protocol:     TCP
        Target Port:  redis-twemproxy
      Type:           ClusterIP
  Update Strategy:    Serial
  Vars:
    Name:  REDIS_SERVICE_NAMES
    Value From:
      Service Var Ref:
        Comp Def:  redis-7
        Host:      Required
        Multiple Cluster Object Option:
          Strategy:  combined
        Name:        redis
        Optional:    false
    Name:            REDIS_SERVICE_PORTS
    Value From:
      Service Var Ref:
        Comp Def:  redis-7
        Multiple Cluster Object Option:
          Strategy:  combined
        Name:        redis
        Optional:    false
        Port:
          Name:    redis
          Option:  Required
    Name:          REDIS_DEFAULT_USER
    Value From:
      Credential Var Ref:
        Comp Def:  redis-7
        Multiple Cluster Object Option:
          Strategy:  individual
        Name:        default
        Username:    Required
    Name:            REDIS_DEFAULT_PASSWORD
    Value From:
      Credential Var Ref:
        Comp Def:  redis-7
        Multiple Cluster Object Option:
          Strategy:  individual
        Name:        default
        Password:    Required
  Volumes:
    High Watermark:  0
    Name:            data
    Need Snapshot:   false
Status:
  Message:              immutable fields can't be updated
  Observed Generation:  3
  Phase:                Unavailable
Events:                 <none>

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.

@JashBook JashBook added the kind/bug Something isn't working label Oct 10, 2024
@JashBook JashBook added this to the Release 0.9.2 milestone Oct 10, 2024
@shanshanying
Copy link
Contributor

annotate all CMPD with apps.kubeblocks.io/skip-immutable-check=true

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