diff --git a/api/v1alpha1/etcd_types.go b/api/v1alpha1/etcd_types.go index 9f81aadb9..3bdce9226 100644 --- a/api/v1alpha1/etcd_types.go +++ b/api/v1alpha1/etcd_types.go @@ -143,6 +143,9 @@ type EtcdSpec struct { Backup BackupSpec `json:"backup"` // +required Replicas int `json:"replicas"` + // PriorityClassName is the name of a priority class that shall be used for the etcd pods. + // +optional + PriorityClassName *string `json:"priorityClassName,omitempty"` // StorageClass defines the name of the StorageClass required by the claim. // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 // +optional diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 4004458d7..b8f363e64 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -259,6 +259,11 @@ func (in *EtcdSpec) DeepCopyInto(out *EtcdSpec) { } in.Etcd.DeepCopyInto(&out.Etcd) in.Backup.DeepCopyInto(&out.Backup) + if in.PriorityClassName != nil { + in, out := &in.PriorityClassName, &out.PriorityClassName + *out = new(string) + **out = **in + } if in.StorageClass != nil { in, out := &in.StorageClass, &out.StorageClass *out = new(string) diff --git a/charts/etcd/templates/etcd-statefulset.yaml b/charts/etcd/templates/etcd-statefulset.yaml index e92d97937..ef1de19b3 100644 --- a/charts/etcd/templates/etcd-statefulset.yaml +++ b/charts/etcd/templates/etcd-statefulset.yaml @@ -48,6 +48,9 @@ spec: - ip: "127.0.0.1" hostnames: - {{ .Values.name }}-local + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} + {{- end }} containers: - name: etcd image: {{ .Values.etcd.image }} @@ -306,4 +309,4 @@ spec: {{ end }} resources: requests: - storage: {{ .Values.storageCapacity }} \ No newline at end of file + storage: {{ .Values.storageCapacity }} diff --git a/charts/etcd/values.yaml b/charts/etcd/values.yaml index 2059692f3..68993a3b5 100644 --- a/charts/etcd/values.yaml +++ b/charts/etcd/values.yaml @@ -1,9 +1,10 @@ name: test uid: uuid-of-etcd-resource -serviceName: test +serviceName: test configMapName: test replicas: 1 +#priorityClassName: foo tlsServerSecret: etcd-server-tls tlsClientSecret: etcd-client-tls @@ -31,8 +32,8 @@ etcd: backup: pullPolicy: IfNotPresent - snapstoreTempDir: "/tmp" - etcdConnectionTimeout: 30 + snapstoreTempDir: "/var/etcd/data/temp" + etcdConnectionTimeout: 5m etcdQuotaBytes: 8Gi garbageCollectionPolicy: LimitBased maxBackups: 7 @@ -51,4 +52,4 @@ storageCapacity: 16Gi store: storageProvider: "" storePrefix: "" - storageContainer: "" \ No newline at end of file + storageContainer: "" diff --git a/config/samples/druid_v1alpha1_etcd.yaml b/config/samples/druid_v1alpha1_etcd.yaml index e78fe1beb..881d1c870 100644 --- a/config/samples/druid_v1alpha1_etcd.yaml +++ b/config/samples/druid_v1alpha1_etcd.yaml @@ -55,5 +55,6 @@ spec: provider: aws prefix: etcd-test replicas: 1 + # priorityClassName: foo storageClass: gardener.cloud-fast storageCapacity: 80Gi diff --git a/controllers/etcd_controller.go b/controllers/etcd_controller.go index 4966b7b3c..da7f03988 100644 --- a/controllers/etcd_controller.go +++ b/controllers/etcd_controller.go @@ -808,12 +808,12 @@ func (r *EtcdReconciler) getMapFromEtcd(etcd *druidv1alpha1.Etcd) (map[string]in etcdValues["image"] = etcd.Spec.Etcd.Image } - var quota int64 = 2 * 1024 * 1024 * 1024 // 2Gib + var quota int64 = 8 * 1024 * 1024 * 1024 // 8Gi if etcd.Spec.Etcd.Quota != nil { quota = etcd.Spec.Etcd.Quota.Value() } - var deltaSnapshotMemoryLimit int64 = 0 + var deltaSnapshotMemoryLimit int64 = 100 * 1024 * 1024 // 100Mi if etcd.Spec.Backup.DeltaSnapshotMemoryLimit != nil { deltaSnapshotMemoryLimit = etcd.Spec.Backup.DeltaSnapshotMemoryLimit.Value() } @@ -826,8 +826,8 @@ func (r *EtcdReconciler) getMapFromEtcd(etcd *druidv1alpha1.Etcd) (map[string]in "pullPolicy": corev1.PullIfNotPresent, "garbageCollectionPolicy": etcd.Spec.Backup.GarbageCollectionPolicy, "etcdQuotaBytes": quota, - "etcdConnectionTimeout": "30s", - "snapstoreTempDir": "/tmp", + "etcdConnectionTimeout": "5m", + "snapstoreTempDir": "/var/etcd/data/temp", "garbageCollectionPeriod": etcd.Spec.Backup.GarbageCollectionPeriod, "deltaSnapshotPeriod": etcd.Spec.Backup.DeltaSnapshotPeriod, "deltaSnapshotMemoryLimit": deltaSnapshotMemoryLimit, @@ -860,6 +860,10 @@ func (r *EtcdReconciler) getMapFromEtcd(etcd *druidv1alpha1.Etcd) (map[string]in "selector": etcd.Spec.Selector, } + if etcd.Spec.PriorityClassName != nil { + values["priorityClassName"] = *etcd.Spec.PriorityClassName + } + if etcd.Spec.Etcd.TLS != nil { values["tlsServerSecret"] = etcd.Spec.Etcd.TLS.ServerTLSSecretRef.Name values["tlsClientSecret"] = etcd.Spec.Etcd.TLS.ClientTLSSecretRef.Name diff --git a/go.mod b/go.mod index c77861905..894c9c3f2 100644 --- a/go.mod +++ b/go.mod @@ -35,6 +35,7 @@ require ( k8s.io/klog v1.0.0 // indirect k8s.io/utils v0.0.0-20191218082557-f07c713de883 // indirect sigs.k8s.io/controller-runtime v0.4.0 + sigs.k8s.io/controller-tools v0.2.4 // indirect ) replace ( diff --git a/go.sum b/go.sum index ec665281d..fa710a3da 100644 --- a/go.sum +++ b/go.sum @@ -94,6 +94,8 @@ github.com/emicklei/go-restful v2.9.6+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/frankban/quicktest v1.5.0/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03DbaAcR7Ks/o= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -159,6 +161,8 @@ github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobuffalo/flect v0.1.5 h1:xpKq9ap8MbYfhuPCF0dBH854Gp9CxZjr/IocxELFflo= +github.com/gobuffalo/flect v0.1.5/go.mod h1:W3K3X9ksuZfir8f/LrfVtWmCDQFfayuylOJ7sz/Fj80= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -272,6 +276,10 @@ github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mholt/archiver v3.1.1+incompatible/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU= @@ -505,6 +513,7 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -625,6 +634,8 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20190905181640-827449938966 h1:B0J02caTR6tpSJozBJyiAzT6CtBzjclw4pgm9gg8Ys0= +gopkg.in/yaml.v3 v3.0.0-20190905181640-827449938966/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -680,6 +691,8 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8 sigs.k8s.io/controller-runtime v0.2.0-beta.5/go.mod h1:HweyYKQ8fBuzdu2bdaeBJvsFgAi/OqBBnrVGXcqKhME= sigs.k8s.io/controller-runtime v0.4.0 h1:wATM6/m+3w8lj8FXNaO6Fs/rq/vqoOjO1Q116Z9NPsg= sigs.k8s.io/controller-runtime v0.4.0/go.mod h1:ApC79lpY3PHW9xj/w9pj+lYkLgwAAUZwfXkME1Lajns= +sigs.k8s.io/controller-tools v0.2.4 h1:la1h46EzElvWefWLqfsXrnsO3lZjpkI0asTpX6h8PLA= +sigs.k8s.io/controller-tools v0.2.4/go.mod h1:m/ztfQNocGYBgTTCmFdnK94uVvgxeZeE3LtJvd/jIzA= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= sigs.k8s.io/structured-merge-diff v0.0.0-20190817042607-6149e4549fca/go.mod h1:IIgPezJWb76P0hotTxzDbWsMYB8APh18qZnxkomBpxA= sigs.k8s.io/testing_frameworks v0.1.1/go.mod h1:VVBKrHmJ6Ekkfz284YKhQePcdycOzNH9qL6ht1zEr/U=