Skip to content

Commit

Permalink
jsonnet: Extend PVC auto deletion support to ingesters (#8736)
Browse files Browse the repository at this point in the history
This PR extends existing jsonnet PVC auto-deletion support to ingester statefulsets. It defaults to "off" just like the others.
  • Loading branch information
seizethedave authored Aug 29, 2024
1 parent 4658643 commit 47e5e44
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
* `ingest_storage_ingester_autoscaling_min_replicas` changed to `ingest_storage_ingester_autoscaling_min_replicas_per_zone`
* `ingest_storage_ingester_autoscaling_max_replicas` changed to `ingest_storage_ingester_autoscaling_max_replicas_per_zone`
* [CHANGE] Changed the overrides configmap generation to remove any field with `null` value. #9116
* [FEATURE] Add support for automatically deleting compactor, store-gateway and read-write mode backend PVCs when the corresponding StatefulSet is scaled down. #8382
* [FEATURE] Add support for automatically deleting compactor, store-gateway, ingester and read-write mode backend PVCs when the corresponding StatefulSet is scaled down. #8382 #8736
* [ENHANCEMENT] Added the following config options to set the number of partition ingester replicas when migrating to experimental ingest storage. #8517
* `ingest_storage_migration_partition_ingester_zone_a_replicas`
* `ingest_storage_migration_partition_ingester_zone_b_replicas`
Expand Down
6 changes: 6 additions & 0 deletions operations/mimir-tests/test-pvc-auto-deletion-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,8 @@ metadata:
name: ingester-zone-a
namespace: default
spec:
persistentVolumeClaimRetentionPolicy:
whenScaled: Delete
podManagementPolicy: Parallel
replicas: 1
selector:
Expand Down Expand Up @@ -1204,6 +1206,8 @@ metadata:
name: ingester-zone-b
namespace: default
spec:
persistentVolumeClaimRetentionPolicy:
whenScaled: Delete
podManagementPolicy: Parallel
replicas: 1
selector:
Expand Down Expand Up @@ -1326,6 +1330,8 @@ metadata:
name: ingester-zone-c
namespace: default
spec:
persistentVolumeClaimRetentionPolicy:
whenScaled: Delete
podManagementPolicy: Parallel
replicas: 1
selector:
Expand Down
1 change: 1 addition & 0 deletions operations/mimir-tests/test-pvc-auto-deletion.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ mimir {

enable_pvc_auto_deletion_for_compactors: true,
enable_pvc_auto_deletion_for_store_gateways: true,
enable_pvc_auto_deletion_for_ingesters: true,
},
}
10 changes: 9 additions & 1 deletion operations/mimir/pvc-auto-deletion.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local statefulset = k.apps.v1.statefulSet;
// https://kubernetes.io/blog/2023/05/04/kubernetes-1-27-statefulset-pvc-auto-deletion-beta/ has more details on PVC auto-deletion.
enable_pvc_auto_deletion_for_store_gateways: false,
enable_pvc_auto_deletion_for_compactors: false,

enable_pvc_auto_deletion_for_ingesters: false,
enable_pvc_auto_deletion_for_read_write_mode_backend: false,
},

Expand All @@ -20,6 +20,9 @@ local statefulset = k.apps.v1.statefulSet;
local compactor_pvc_auto_deletion = if !$._config.enable_pvc_auto_deletion_for_compactors then {} else
statefulset.spec.persistentVolumeClaimRetentionPolicy.withWhenScaled('Delete'),

local ingester_pvc_auto_deletion = if !$._config.enable_pvc_auto_deletion_for_ingesters then {} else
statefulset.spec.persistentVolumeClaimRetentionPolicy.withWhenScaled('Delete'),

local backend_pvc_auto_deletion = if !$._config.enable_pvc_auto_deletion_for_read_write_mode_backend then {} else
statefulset.spec.persistentVolumeClaimRetentionPolicy.withWhenScaled('Delete'),

Expand All @@ -30,6 +33,11 @@ local statefulset = k.apps.v1.statefulSet;

compactor_statefulset: overrideSuperIfExists('compactor_statefulset', compactor_pvc_auto_deletion),

ingester_statefulset: overrideSuperIfExists('ingester_statefulset', ingester_pvc_auto_deletion),
ingester_zone_a_statefulset: overrideSuperIfExists('ingester_zone_a_statefulset', ingester_pvc_auto_deletion),
ingester_zone_b_statefulset: overrideSuperIfExists('ingester_zone_b_statefulset', ingester_pvc_auto_deletion),
ingester_zone_c_statefulset: overrideSuperIfExists('ingester_zone_c_statefulset', ingester_pvc_auto_deletion),

mimir_backend_zone_a_statefulset: overrideSuperIfExists('mimir_backend_zone_a_statefulset', backend_pvc_auto_deletion),
mimir_backend_zone_b_statefulset: overrideSuperIfExists('mimir_backend_zone_b_statefulset', backend_pvc_auto_deletion),
mimir_backend_zone_c_statefulset: overrideSuperIfExists('mimir_backend_zone_c_statefulset', backend_pvc_auto_deletion),
Expand Down

0 comments on commit 47e5e44

Please sign in to comment.