apache / rocketmq-operator

Apache RocketMQ Operator
https://rocketmq.apache.org/
Apache License 2.0
308 stars 126 forks source link

Broker status can not reflect current state #185

Closed drivebyer closed 6 months ago

drivebyer commented 9 months ago
  1. Please describe the issue you observed:

broker can not start:

NAME↑                                                                              PF                         READY                                                 RESTARTS STATUS                                     IP                                       NODE                              AGE
broker-0-master-0                                                                  ●                          0/1                                                          4 CrashLoopBackOff                           192.168.137.99                           master1                           2m29s
broker-0-replica-1-0                                                               ●                          0/1                                                          4 CrashLoopBackOff                           192.168.180.51                           master2                           2m29s
- What did you see instead?

apiVersion: rocketmq.apache.org/v1alpha1 kind: Broker metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | {"apiVersion":"rocketmq.apache.org/v1alpha1","kind":"Broker","metadata":{"annotations":{},"name":"broker","namespace":"mcamel-system"},"spec":{"allowRestart":true,"brokerImage":"ghcr.m.daocloud.io/ksmartdata/rocketmq-broker:v4.5.0","env":[{"name":"BROKER_MEM","valueFrom":{"configMapKeyRef":{"key":"BROKER_MEM","name":"broker-config"}}}],"hostPath":"/data/rocketmq/broker","imagePullPolicy":"Always","nameServers":"","replicaPerGroup":1,"resources":{"limits":{"cpu":"500m","memory":"20Mi"},"requests":{"cpu":"250m","memory":"10Mi"}},"scalePodName":"broker-0-master-0","size":1,"storageMode":"EmptyDir","volumeClaimTemplates":[{"metadata":{"annotations":{"volume.beta.kubernetes.io/storage-class":"rocketmq-storage"},"name":"broker-storage"},"spec":{"accessModes":["ReadWriteOnce"[],"resources":{"requests":{"storage":"8Gi"}}}}],"volumes":[{"configMap":{"items":[{"key":"broker-common.conf","path":"broker-common.conf"}],"name":"broker-config"},"name":"broker-config"}]}} creationTimestamp: "2023-10-09T06:33:41Z" generation: 1 name: broker namespace: mcamel-system resourceVersion: "6066816" uid: 93bb193c-cffa-47d3-8c8e-821dbd1cef37 ... ... ... status: nodes:

  1. Please tell us about your environment: NULL
  2. Other information (e.g. detailed explanation, logs, related issues, suggestions how to fix, etc): As described in: https://github.com/kubernetes/api/blob/9a776fe3a720323e4f706b3ebb462b3dd661634f/core/v1/types.go#L4225-L4226 && https://github.com/kubernetes/api/blob/9a776fe3a720323e4f706b3ebb462b3dd661634f/core/v1/types.go#L4217-L4219 Running can not be represented pod is ready. We should use conditions of status

Mayve we should also wait when pod not ready: https://github.com/apache/rocketmq-operator/blob/f2d0706a4cf6eb3438f036b710d3863adfd3580c/pkg/controller/broker/broker_controller.go#L270-L275