Skip to content

Commit

Permalink
Enabled jobs instead of cronjobs to take care of running compaction.
Browse files Browse the repository at this point in the history
  • Loading branch information
abdasgupta committed Oct 6, 2021
1 parent 1d427e9 commit 5314db6
Show file tree
Hide file tree
Showing 13 changed files with 1,820 additions and 1,623 deletions.
4 changes: 4 additions & 0 deletions api/v1alpha1/etcd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ type BackupSpec struct {
// More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
// +optional
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
// CompactionResources defines the compute Resources required by compaction job.
// More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
// +optional
CompactionResources *corev1.ResourceRequirements `json:"compactionResources,omitempty"`
// FullSnapshotSchedule defines the cron standard schedule for full snapshots.
// +optional
FullSnapshotSchedule *string `json:"fullSnapshotSchedule,omitempty"`
Expand Down
241 changes: 0 additions & 241 deletions charts/etcd/templates/etcd-compaction-cronjob.yaml

This file was deleted.

12 changes: 3 additions & 9 deletions charts/etcd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: test
uid: uuid-of-etcd-resource
serviceName: test
configMapName: test
jobName: test

replicas: 1
#priorityClassName: foo
Expand Down Expand Up @@ -51,17 +52,10 @@ backup:
compactionResources:
limits:
cpu: 700m
memory: 3Gi
memory: 4Gi
requests:
cpu: 500m
memory: 2Gi
compactionResourcesTempFS:
limits:
cpu: 900m
memory: 12Gi
requests:
cpu: 700m
memory: 10Gi
memory: 3Gi
# compression:
# enabled: true
# policy: "gzip"
Expand Down
28 changes: 25 additions & 3 deletions config/crd/bases/druid.gardener.cloud_etcds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,28 @@ spec:
backupCompactionSchedule:
description: BackupCompactionSchedule defines the cron standard for compacting the snapstore
type: string
etcdSnapshotTimeout:
description: EtcdSnapshotTimeout defines the timeout duration for etcd FullSnapshot operation
type: string
compactionResources:
description: 'CompactionResources defines the compute Resources required by compaction job. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
requests:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
type: object
compression:
description: SnapshotCompression defines the specification for compression of Snapshots.
properties:
Expand All @@ -78,6 +97,9 @@ spec:
enableProfiling:
description: EnableProfiling defines if profiling should be enabled for the etcd-backup-restore-sidecar
type: boolean
etcdSnapshotTimeout:
description: EtcdSnapshotTimeout defines the timeout duration for etcd FullSnapshot operation
type: string
fullSnapshotSchedule:
description: FullSnapshotSchedule defines the cron standard schedule for full snapshots.
type: string
Expand Down
24 changes: 24 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@ metadata:
creationTimestamp: null
name: manager-role
rules:
- apiGroups:
- batch
resources:
- jobs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- druid.gardener.cloud
resources:
Expand Down
23 changes: 23 additions & 0 deletions controllers/config/compaction.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package config

// CompactionConfig contains configuration for the compaction controller.
type CompactionConfig struct {
// EventsThreshold is Total number of events that can be allowed before a compaction job is triggered
EventsThreshold int64
// ActiveDeadlineDuration is the duration after which a running compaction job will be killed (Ex: "300ms", "20s", "-1.5h" or "2h45m")
ActiveDeadlineDuration string
}
Loading

0 comments on commit 5314db6

Please sign in to comment.