opensearch-project/opensearch-k8s-operator

[PROPOSAL] OpenSearchISMPolicy.applyToExistingIndices

cthtrifork opened this issue · 2 comments

What/Why

What are you proposing?

In a few sentences, describe the feature and its core capabilities.

We are considering a design where a applyToExistingIndices is added to the OpenSearchISMPolicy api/CRD.

If true, this will the policy to all existing indices matching the index pattern of the template.

What problems are you trying to solve?

We would like to avoid having to rely on "database administrators" as much as possible and going in the GitOps direction. Right now I do not see a way of applying a policy to any existing indices.

Are there any security considerations?

I am not sure I understand all the dataflows related to ISM policies. It seems like state and other metadata is stored outside the index, so I am unsure of the riscs involved in adding this flag.

What will it take to execute?

We would be willing to make a PR for this feature, if is no major concerns.
We would add it to the reconciler logic for ISM policies and ensure that we call the update policy API endpoint in the gateway using the index pattern supplied in the ISM policy.

https://opensearch.org/docs/latest/im-plugin/ism/api/#add-policy

Adds a policy to an index. This operation does not change the policy if the index already has one.

Hi @cthtrifork. Adding this feature is fine by me. I don't have a real concerns.

Implementation-wise the reconciler should do this apply only when the policy is first created or the pattern is changed.