Skip to content

Commit e74d8d9

Browse files
authored
Set the default snapshot compression to true. (#1202)
1 parent aacf6c8 commit e74d8d9

6 files changed

Lines changed: 11 additions & 11 deletions

File tree

api/core/v1alpha1/etcd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const (
3131
// DefaultCompression is constant for default compression policy(only if compression is enabled).
3232
DefaultCompression = GzipCompression
3333
// DefaultCompressionEnabled is constant to define whether to compress the snapshots or not.
34-
DefaultCompressionEnabled = false
34+
DefaultCompressionEnabled bool = true
3535

3636
// Periodic is a constant to set auto-compaction-mode 'periodic' for duration based retention.
3737
Periodic CompactionMode = "periodic"

examples/etcd/druid_v1alpha1_etcd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ spec:
5454
# provider: local # options: aws,azure,gcp,openstack,alicloud,dell,openshift,local
5555
# prefix: etcd-test
5656
compression:
57-
enabled: false
57+
enabled: true # false (to disable compression)
5858
policy: "gzip"
5959
leaderElection:
6060
reelectionPeriod: 5s

examples/etcd/druid_v1alpha1_etcd_azurite.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ spec:
5454
secretRef:
5555
name: etcd-backup-azurite
5656
compression:
57-
enabled: false
57+
enabled: true
5858
policy: "gzip"
5959
leaderElection:
6060
reelectionPeriod: 5s

examples/etcd/druid_v1alpha1_etcd_fakegcs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ spec:
5454
secretRef:
5555
name: etcd-backup-gcp
5656
compression:
57-
enabled: false
57+
enabled: true
5858
policy: "gzip"
5959
leaderElection:
6060
reelectionPeriod: 5s

examples/etcd/druid_v1alpha1_etcd_localstack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ spec:
5454
secretRef:
5555
name: etcd-backup-aws
5656
compression:
57-
enabled: false
57+
enabled: true
5858
policy: "gzip"
5959
leaderElection:
6060
reelectionPeriod: 5s

internal/component/statefulset/builder.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -565,15 +565,15 @@ func (b *stsBuilder) getBackupStoreCommandArgs() []string {
565565

566566
// Snapshot compression and timeout command line args
567567
// -----------------------------------------------------------------------------------------------------------------
568+
compressionEnabled, compressionPolicy := druidv1alpha1.DefaultCompressionEnabled, druidv1alpha1.DefaultCompression
568569
if b.etcd.Spec.Backup.SnapshotCompression != nil {
569-
if ptr.Deref(b.etcd.Spec.Backup.SnapshotCompression.Enabled, false) {
570-
commandArgs = append(commandArgs, fmt.Sprintf("--compress-snapshots=%t", *b.etcd.Spec.Backup.SnapshotCompression.Enabled))
571-
}
572-
if b.etcd.Spec.Backup.SnapshotCompression.Policy != nil {
573-
commandArgs = append(commandArgs, fmt.Sprintf("--compression-policy=%s", string(*b.etcd.Spec.Backup.SnapshotCompression.Policy)))
574-
}
570+
compressionEnabled = ptr.Deref(b.etcd.Spec.Backup.SnapshotCompression.Enabled, druidv1alpha1.DefaultCompressionEnabled)
571+
compressionPolicy = ptr.Deref(b.etcd.Spec.Backup.SnapshotCompression.Policy, druidv1alpha1.DefaultCompression)
575572
}
576573

574+
commandArgs = append(commandArgs, fmt.Sprintf("--compress-snapshots=%t", compressionEnabled))
575+
commandArgs = append(commandArgs, fmt.Sprintf("--compression-policy=%s", compressionPolicy))
576+
577577
etcdSnapshotTimeout := defaultEtcdSnapshotTimeout
578578
if b.etcd.Spec.Backup.EtcdSnapshotTimeout != nil {
579579
etcdSnapshotTimeout = b.etcd.Spec.Backup.EtcdSnapshotTimeout.Duration.String()

0 commit comments

Comments
 (0)