From cfa60e91ba80aeb96d06ff739ef73b5b1c7db575 Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Fri, 11 Jun 2021 08:56:43 +0200 Subject: [PATCH 1/4] Enable profiling of etcd-backup-restore-sidecar --- charts/etcd/templates/etcd-statefulset.yaml | 3 +++ charts/etcd/values.yaml | 1 + 2 files changed, 4 insertions(+) diff --git a/charts/etcd/templates/etcd-statefulset.yaml b/charts/etcd/templates/etcd-statefulset.yaml index 64f8b7533..94219df5c 100644 --- a/charts/etcd/templates/etcd-statefulset.yaml +++ b/charts/etcd/templates/etcd-statefulset.yaml @@ -135,6 +135,9 @@ spec: {{- if .Values.backup.etcdQuotaBytes }} - --embedded-etcd-quota-bytes={{ int $.Values.backup.etcdQuotaBytes }} {{- end }} +{{- if .Values.backup.enableProfiling }} + - --enable-profiling={{ .Values.backup.enableProfiling }} +{{- end }} {{- if .Values.etcd.enableTLS }} - --cert=/var/etcd/ssl/client/tls.crt - --key=/var/etcd/ssl/client/tls.key diff --git a/charts/etcd/values.yaml b/charts/etcd/values.yaml index 323261d82..b1027b83f 100644 --- a/charts/etcd/values.yaml +++ b/charts/etcd/values.yaml @@ -36,6 +36,7 @@ backup: snapstoreTempDir: "/var/etcd/data/temp" etcdConnectionTimeout: 5m etcdQuotaBytes: 8Gi + enableProfiling: true garbageCollectionPolicy: LimitBased maxBackups: 7 resources: From 134684511adeaf57a76fbfd3fca5f6cfd2cb7932 Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Mon, 14 Jun 2021 09:26:06 +0200 Subject: [PATCH 2/4] default to false, make configurable via etcdconfig --- api/v1alpha1/etcd_types.go | 3 +++ charts/etcd/values.yaml | 2 +- config/crd/bases/druid.gardener.cloud_etcds.yaml | 2 +- controllers/etcd_controller.go | 7 +++++++ .../gardener/etcd-druid/api/v1alpha1/etcd_types.go | 3 +++ 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/api/v1alpha1/etcd_types.go b/api/v1alpha1/etcd_types.go index 8d8a76982..d47cbfba5 100644 --- a/api/v1alpha1/etcd_types.go +++ b/api/v1alpha1/etcd_types.go @@ -166,6 +166,9 @@ type EtcdConfig struct { Resources *corev1.ResourceRequirements `json:"resources,omitempty"` // +optional TLS *TLSConfig `json:"tls,omitempty"` + // EnableProfiling defines if profiling should be enabled for the etcd-backup-restore-sidecar + // +optional + EnableProfiling *bool `json:"enableProfiling,omitempty"` } // SharedConfig defines parameters shared and used by Etcd as well as backup-restore sidecar. diff --git a/charts/etcd/values.yaml b/charts/etcd/values.yaml index b1027b83f..8cd4b946c 100644 --- a/charts/etcd/values.yaml +++ b/charts/etcd/values.yaml @@ -36,7 +36,7 @@ backup: snapstoreTempDir: "/var/etcd/data/temp" etcdConnectionTimeout: 5m etcdQuotaBytes: 8Gi - enableProfiling: true + enableProfiling: false garbageCollectionPolicy: LimitBased maxBackups: 7 resources: diff --git a/config/crd/bases/druid.gardener.cloud_etcds.yaml b/config/crd/bases/druid.gardener.cloud_etcds.yaml index a1e375e2b..08d97aa2a 100644 --- a/config/crd/bases/druid.gardener.cloud_etcds.yaml +++ b/config/crd/bases/druid.gardener.cloud_etcds.yaml @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.5.0 creationTimestamp: null name: etcds.druid.gardener.cloud spec: diff --git a/controllers/etcd_controller.go b/controllers/etcd_controller.go index 2f2df8dce..a8c1c721e 100644 --- a/controllers/etcd_controller.go +++ b/controllers/etcd_controller.go @@ -890,12 +890,19 @@ func (r *EtcdReconciler) getMapFromEtcd(etcd *druidv1alpha1.Etcd) (map[string]in deltaSnapshotMemoryLimit = etcd.Spec.Backup.DeltaSnapshotMemoryLimit.Value() } + var enableProfiling = false + if etcd.Spec.Etcd.EnableProfiling != nil { + enableProfiling = *etcd.Spec.Etcd.EnableProfiling + + } + backupValues := map[string]interface{}{ "pullPolicy": corev1.PullIfNotPresent, "etcdQuotaBytes": quota, "etcdConnectionTimeout": "5m", "snapstoreTempDir": "/var/etcd/data/temp", "deltaSnapshotMemoryLimit": deltaSnapshotMemoryLimit, + "enableProfiling": enableProfiling, } if etcd.Spec.Backup.Resources != nil { diff --git a/vendor/github.com/gardener/etcd-druid/api/v1alpha1/etcd_types.go b/vendor/github.com/gardener/etcd-druid/api/v1alpha1/etcd_types.go index 8d8a76982..d47cbfba5 100644 --- a/vendor/github.com/gardener/etcd-druid/api/v1alpha1/etcd_types.go +++ b/vendor/github.com/gardener/etcd-druid/api/v1alpha1/etcd_types.go @@ -166,6 +166,9 @@ type EtcdConfig struct { Resources *corev1.ResourceRequirements `json:"resources,omitempty"` // +optional TLS *TLSConfig `json:"tls,omitempty"` + // EnableProfiling defines if profiling should be enabled for the etcd-backup-restore-sidecar + // +optional + EnableProfiling *bool `json:"enableProfiling,omitempty"` } // SharedConfig defines parameters shared and used by Etcd as well as backup-restore sidecar. From 10ea5688aa2780ec314e64c8f2960d262290822a Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Tue, 15 Jun 2021 18:22:11 +0200 Subject: [PATCH 3/4] add to crd --- config/crd/bases/druid.gardener.cloud_etcds.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/crd/bases/druid.gardener.cloud_etcds.yaml b/config/crd/bases/druid.gardener.cloud_etcds.yaml index 08d97aa2a..f2762320e 100644 --- a/config/crd/bases/druid.gardener.cloud_etcds.yaml +++ b/config/crd/bases/druid.gardener.cloud_etcds.yaml @@ -229,6 +229,10 @@ spec: description: DefragmentationSchedule defines the cron standard schedule for defragmentation of etcd. type: string + enableProfiling: + description: EnableProfiling defines if profiling should be enabled + for the etcd-backup-restore-sidecar + type: boolean image: description: Image defines the etcd container image and tag type: string From 2ae46494bf9bb56c05e1bea89e4ab18d10af380d Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Wed, 16 Jun 2021 07:53:05 +0200 Subject: [PATCH 4/4] put profiling config under backupSpec --- api/v1alpha1/etcd_types.go | 6 +++--- config/crd/bases/druid.gardener.cloud_etcds.yaml | 8 ++++---- controllers/etcd_controller.go | 4 ++-- .../gardener/etcd-druid/api/v1alpha1/etcd_types.go | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/api/v1alpha1/etcd_types.go b/api/v1alpha1/etcd_types.go index d47cbfba5..d44061afb 100644 --- a/api/v1alpha1/etcd_types.go +++ b/api/v1alpha1/etcd_types.go @@ -138,6 +138,9 @@ type BackupSpec struct { // SnapshotCompression defines the specification for compression of Snapshots. // +optional SnapshotCompression *CompressionSpec `json:"compression,omitempty"` + // EnableProfiling defines if profiling should be enabled for the etcd-backup-restore-sidecar + // +optional + EnableProfiling *bool `json:"enableProfiling,omitempty"` } // EtcdConfig defines parameters associated etcd deployed @@ -166,9 +169,6 @@ type EtcdConfig struct { Resources *corev1.ResourceRequirements `json:"resources,omitempty"` // +optional TLS *TLSConfig `json:"tls,omitempty"` - // EnableProfiling defines if profiling should be enabled for the etcd-backup-restore-sidecar - // +optional - EnableProfiling *bool `json:"enableProfiling,omitempty"` } // SharedConfig defines parameters shared and used by Etcd as well as backup-restore sidecar. diff --git a/config/crd/bases/druid.gardener.cloud_etcds.yaml b/config/crd/bases/druid.gardener.cloud_etcds.yaml index f2762320e..e4f089c9f 100644 --- a/config/crd/bases/druid.gardener.cloud_etcds.yaml +++ b/config/crd/bases/druid.gardener.cloud_etcds.yaml @@ -78,6 +78,10 @@ spec: description: DeltaSnapshotPeriod defines the period after which delta snapshots will be taken type: string + enableProfiling: + description: EnableProfiling defines if profiling should be enabled + for the etcd-backup-restore-sidecar + type: boolean fullSnapshotSchedule: description: FullSnapshotSchedule defines the cron standard schedule for full snapshots. @@ -229,10 +233,6 @@ spec: description: DefragmentationSchedule defines the cron standard schedule for defragmentation of etcd. type: string - enableProfiling: - description: EnableProfiling defines if profiling should be enabled - for the etcd-backup-restore-sidecar - type: boolean image: description: Image defines the etcd container image and tag type: string diff --git a/controllers/etcd_controller.go b/controllers/etcd_controller.go index a8c1c721e..36a4a4107 100644 --- a/controllers/etcd_controller.go +++ b/controllers/etcd_controller.go @@ -891,8 +891,8 @@ func (r *EtcdReconciler) getMapFromEtcd(etcd *druidv1alpha1.Etcd) (map[string]in } var enableProfiling = false - if etcd.Spec.Etcd.EnableProfiling != nil { - enableProfiling = *etcd.Spec.Etcd.EnableProfiling + if etcd.Spec.Backup.EnableProfiling != nil { + enableProfiling = *etcd.Spec.Backup.EnableProfiling } diff --git a/vendor/github.com/gardener/etcd-druid/api/v1alpha1/etcd_types.go b/vendor/github.com/gardener/etcd-druid/api/v1alpha1/etcd_types.go index d47cbfba5..d44061afb 100644 --- a/vendor/github.com/gardener/etcd-druid/api/v1alpha1/etcd_types.go +++ b/vendor/github.com/gardener/etcd-druid/api/v1alpha1/etcd_types.go @@ -138,6 +138,9 @@ type BackupSpec struct { // SnapshotCompression defines the specification for compression of Snapshots. // +optional SnapshotCompression *CompressionSpec `json:"compression,omitempty"` + // EnableProfiling defines if profiling should be enabled for the etcd-backup-restore-sidecar + // +optional + EnableProfiling *bool `json:"enableProfiling,omitempty"` } // EtcdConfig defines parameters associated etcd deployed @@ -166,9 +169,6 @@ type EtcdConfig struct { Resources *corev1.ResourceRequirements `json:"resources,omitempty"` // +optional TLS *TLSConfig `json:"tls,omitempty"` - // EnableProfiling defines if profiling should be enabled for the etcd-backup-restore-sidecar - // +optional - EnableProfiling *bool `json:"enableProfiling,omitempty"` } // SharedConfig defines parameters shared and used by Etcd as well as backup-restore sidecar.