opensearch-project / opensearch-k8s-operator

OpenSearch Kubernetes Operator
Apache License 2.0
387 stars 202 forks source link

Allow changing storageclass after the opensearch cluster is created. #873

Open vinodhreddyg opened 1 week ago

vinodhreddyg commented 1 week ago

Is your feature request related to a problem?

Once opensearch cluster is created the storageClass can't be changed.

What solution would you like?

I understand that changing the storageClass isn't allowed by sts validation but when teams are ok for a rolling restart with data migrated to the new pvc operator can facilitated this feature. In elasticsearch this is achieved by changing the nodeset name and storageClassName at once. So the operator creates new nodeset with new pvc's and migrate the data from older nodeset to new nodeset. Please refer below discussion

https://discuss.elastic.co/t/change-storageclass-of-an-already-running-cluster/267573/2

What alternatives have you considered?

no alternatives. Looking for operator support

Do you have any additional context?

Please ref this discussion https://discuss.elastic.co/t/change-storageclass-of-an-already-running-cluster/267573/2

gaiksaya commented 6 days ago

[Triage] Hi @swoehrl-mw @prudhvigodithi Do we plan to support this? Any plans? Thanks!

swoehrl-mw commented 6 days ago

Hi @vinodhreddyg. Without having tried it out, a similar approach should be possible using the opensarch-operator: Add a new nodePool with the new storageclass, reduce the replicas of the old nodepool to 0, then remove it completely.

I don't see us implementing this as a separate feature. If someone wants to contribute it, we would probably accept it (unless it has a too high impact on the existing code), but I see this as a nieche feature that does not have priority.

cc @gaiksaya

vinodhreddyg commented 2 days ago

@swoehrl-mw @peterzhuamazon

I tried you're suggested of adding another nodepool and set old nodepool to 0. This doesn't work indices are red now.

red   open elasticsearch-index          dHpoJviqSHi6MFiTxmZF9w 1 1

Also one more caveat if we change the name of any nodepool instead of changing the name it creates one more nodepool. I don't want to divert the topic but an observation/bug on it's own.

swoehrl-mw commented 22 hours ago

@vinodhreddyg Can you provide more details why the cluster is red? Are indices completely missing because it was scaled down too fast? Did you enable the smartscaler via spec.confMgmt.smartScaler? Because AFAIK otherwise the operator will not explicitly drain the nodes it removes.