Open aggarwalShivani opened 1 year ago
Hi, Any thoughts on this request? Is this being evaluated as a potential feature to be added in the plan?
Hi @bowenlan-amzn Could U assign me to this ticket plz
Hi @ikibo
For my own learning, I have been trying to understand the code and where changes would be needed for this feature request. Just a few questions/suggestions from my side on the planned implementation around snapshot selection -
fun List<SnapshotInfo>.filterBySMPolicyInSnapshotMetadata(policyName: String): List<SnapshotInfo> {
return filter { it.userMetadata()?.get(SM_TYPE) == policyName }
}
But snapshots created externally (through REST APIs and not ISM), would not have this field. I believe this function could be modified for delete-only policies, to not look for metadata for policy-name.
Are you also planning to add a new field for some regex pattern to match snapshot-name to be deleted for policy? Or the matching will continue to be as done currently - i.e. snapshots starting with << policy-name >> would be marked for deletion?
Also, what is the plan for the 'creation' field in the SM policy spec? Would it made optional? Or some new end point would be created to have delete-only policies?
Would request maintainers too for their inputs.
@aggarwalShivani Thanks for spending time on this!
1,2 I think we can introduce new field under deletion
in create policy API
This new field contains the delete snapshot name pattern and its belonging repository.
3 we can make the creation
field optional, no need to introduce new API.
In my case, we create snapshots with ISM, and expect to do housekeeping with SM.
In my case, we create snapshots with ISM, and expect to do housekeeping with SM.
@wilalalee Yes, so this feature would ideally allow both the use-cases:
Hi @ikibo, are you still working on this feature?
Is your feature request related to a problem? Snapshot Managment should allow creating an SM policy that only deletes snapshots created manually (not through SM policy).
Problem statement -
I create snapshots for opensearch to backup its data. These snapshots should be created on demand by a user when required (at random times) and not based on any cron schedule.
The name of the snapshot too is decided by the user and not known beforehand. The name is appended with the timestamp of snapshot creation.
As a housekeeping activity, in order to control the number of snapshots retained in the system, we want to automate deletion of old snapshots from the system. For ex. The user could trigger snapshots n number of times in a week, but we want to enable a cron that runs once everyday and deletes any snapshots older than 7days. I do not want to use the snapshot management plugin to "create" snapshots, but only "delete" the snapshots.
However, on creating a policy like below, it failed due to missing configuration for creation.
What alternatives have you considered? Elasticsearch-curator provides this feature and we have been using the same successfully. We now are trying to migrate to ISM plugin (in replacement of curator) and want to achieve similar use-case. https://www.elastic.co/guide/en/elasticsearch/client/curator/current/delete_snapshots.html
What solution would you like?
For ex. If user creates snapshots by the name, os-snapshot- (For ex. os-snapshot-2023.07.19-10:15:12, os-snapshot-2023.07.19-12:10:10 etc), there should be a provision to create a policy to only "delete" snapshots older than 7d that match the pattern os-snapshot-*