redis-operator icon indicating copy to clipboard operation
redis-operator copied to clipboard

Add a state (ready, initializing,...) In Status of redis/redisCluster resource

Open MathieuCesbron opened this issue 3 years ago • 2 comments

Hello,

It would be nice to have the global state of the cluster In the redis/redisCluster resource. The percona-xtradb-cluster-operator have it (https://github.com/percona/percona-xtradb-cluster-operator).

From what I have seen, it is almost always the key "state" in the status of the resource. And the values are "ready", "failed", "initialising",...

Are you interested in this feature ?

We could start by adding the state "ready" when the redis/redisCluster is ready to accept connections.

Have a good day,

MathieuCesbron avatar Jan 13 '22 19:01 MathieuCesbron

I think this is a great addition, especially for the RedisCluster CR, as there are multiple stages.

I was thinking similar for my PR for Sentinel support to highlight what the controller believes to be the leader for example.

In terms of API what were you thinking? I think Conditions makes the most sense to me?

Something Along the lines of:

status:
  conditions:
    - lastTransitionTime: "2019-10-22T16:29:24Z"
      status: "True"
      type: ClusterScheduled
    - lastTransitionTime: "2019-10-22T16:29:24Z"
      status: "True"
      type: ClusterInitialized
    - lastTransitionTime: "2019-10-22T16:29:31Z"
      status: "True"
      type: LeadersReady
    - lastTransitionTime: "2019-10-22T16:29:31Z"
      status: "True"
      type: Ready

This would have the following transition:

PodsInitilized -> ServicesDeployed -> ClusterInitilized -> LeadersReady -> Ready

Ready would then be determined when all the Leaders and Followers are Ready and part of the cluster.

wdyt?

For additional context my colleague has the following Blog post which helps understand the rational: https://maelvls.dev/kubernetes-conditions/

davidcollom avatar Jan 18 '22 18:01 davidcollom

I agree. The 'conditions' is what I have seen on other operators.

So:

status:
  conditions:
    - lastTransitionTime: "2019-10-22T16:29:24Z"
      status: "True"
      type: ClusterScheduled
    - lastTransitionTime: "2019-10-22T16:29:24Z"
      status: "True"
      type: ClusterInitialized
    - lastTransitionTime: "2019-10-22T16:29:31Z"
      status: "True"
      type: LeadersReady
    - lastTransitionTime: "2019-10-22T16:29:31Z"
      status: "True"
      type: Ready

    state: Ready

I also like to have a state outside of conditions that equal the most recent status in conditions. Checking the most recent lastTransitionTime is not human readable. The official xtradb operator do that.

I don't really know about the transitions to be honest but the more detailed the transitions the better it is for debugging.

MathieuCesbron avatar Jan 18 '22 18:01 MathieuCesbron

fixed by : https://github.com/OT-CONTAINER-KIT/redis-operator/pull/612

shubham-cmyk avatar Sep 10 '23 20:09 shubham-cmyk