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

Add a status indicating whether or not the MySQLCluster is being updated. #539

Closed
4 tasks
shunki-fujita opened this issue Jul 11, 2023 · 4 comments
Closed
4 tasks

Comments

@shunki-fujita
Copy link
Contributor

What

If there is a way to verify that the MySQLCluster update is complete, we can update MySQLCluster in stages using ArgoCD or similar.
MySQLCluster has Available and Healthy statuses, but these do not determine if the MySQLCluster is being updated.

Elasticsearch uses PHASE status to achieve this:
https://github.com/argoproj/argo-cd/blob/03026997d1a30befd89ae90e5f319304d8b25b84/resource_customizations/elasticsearch.k8s.elastic.co/Elasticsearch/health.lua#L28-L40

How

Add status to indicate if MySQLCluster is being updated

Checklist

  • Finish implementation of the issue
  • Test all functions
  • Have enough logs to trace activities
  • Notify developers of necessary actions
@ymmt2005
Copy link
Member

@shunki-fujita
Since MySQLCluster creates a StatefulSet, can't we use these?

// replicas is the number of Pods created by the StatefulSet controller.
	Replicas [int32](https://pkg.go.dev/builtin#int32) `json:"replicas" protobuf:"varint,2,opt,name=replicas"`

	// readyReplicas is the number of pods created for this StatefulSet with a Ready Condition.
	ReadyReplicas [int32](https://pkg.go.dev/builtin#int32) `json:"readyReplicas,omitempty" protobuf:"varint,3,opt,name=readyReplicas"`

	// currentReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version
	// indicated by currentRevision.
	CurrentReplicas [int32](https://pkg.go.dev/builtin#int32) `json:"currentReplicas,omitempty" protobuf:"varint,4,opt,name=currentReplicas"`

	// updatedReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version
	// indicated by updateRevision.
	UpdatedReplicas [int32](https://pkg.go.dev/builtin#int32) `json:"updatedReplicas,omitempty" protobuf:"varint,5,opt,name=updatedReplicas"`

	// currentRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the
	// sequence [0,currentReplicas).
	CurrentRevision [string](https://pkg.go.dev/builtin#string) `json:"currentRevision,omitempty" protobuf:"bytes,6,opt,name=currentRevision"`

	// updateRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the sequence
	// [replicas-updatedReplicas,replicas)
	UpdateRevision [string](https://pkg.go.dev/builtin#string) `json:"updateRevision,omitempty" protobuf:"bytes,7,opt,name=updateRevision"`

https://pkg.go.dev/k8s.io/api/apps/v1#StatefulSetStatus

These are all exported by kube-state-metrics.
https://github.com/kubernetes/kube-state-metrics/blob/main/docs/statefulset-metrics.md

@masa213f
Copy link
Contributor

@ymmt2005
We want to detect the update status of MySQLCluster by Argo CD properly.
For this purpose, I want to add the following checks to Argo CD.

  1. Reconcile is finished.
    • MySQLCluster's .metadata.generation == .status.reconcileInfo.generation.
  2. Rolling update of StatefulSet is finished.
  3. MySQLCluster is Healthy.

However, I cannot implement check 2 by Argo CD's Lua script.
So we want to add the new status to MySQLCluster.

@ymmt2005
Copy link
Member

@masa213f understood.

@masa213f
Copy link
Contributor

masa213f commented Oct 6, 2023

This feature has been released in MOCO v0.17.0.
#546

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants