From a536929fecfb7575408c79658ecfe5f0886c57df Mon Sep 17 00:00:00 2001 From: Ole Markus With Date: Thu, 8 Jul 2021 22:05:55 +0200 Subject: [PATCH] Add auto compaction to new cilium etcd clusters and to docs --- docs/networking/cilium.md | 7 +++++++ upup/pkg/fi/cloudup/new_cluster.go | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/docs/networking/cilium.md b/docs/networking/cilium.md index d146a7fda7..adde2ddec6 100644 --- a/docs/networking/cilium.md +++ b/docs/networking/cilium.md @@ -44,6 +44,7 @@ kops create cluster \ For existing clusters, add the following to `spec.etcdClusters`: Make sure `instanceGroup` match the other etcd clusters. +You should also enable auto compaction. ```yaml - etcdMembers: @@ -53,6 +54,12 @@ Make sure `instanceGroup` match the other etcd clusters. name: b - instanceGroup: master-az-1c name: c + manager: + env: + - name: ETCD_AUTO_COMPACTION_MODE + value: revision + - name: ETCD_AUTO_COMPACTION_RETENTION + value: "2500" name: cilium ``` diff --git a/upup/pkg/fi/cloudup/new_cluster.go b/upup/pkg/fi/cloudup/new_cluster.go index 53b60a5557..fe937c18ba 100644 --- a/upup/pkg/fi/cloudup/new_cluster.go +++ b/upup/pkg/fi/cloudup/new_cluster.go @@ -1173,6 +1173,19 @@ func createEtcdCluster(etcdCluster string, masters []*api.InstanceGroup, encrypt m.InstanceGroup = fi.String(ig.ObjectMeta.Name) etcd.Members = append(etcd.Members, m) } + + // Cilium etcd server is not compacted by the k8s API server. + if etcd.Name == "cilium" { + if etcd.Manager == nil { + etcd.Manager = &api.EtcdManagerSpec{ + Env: []api.EnvVar{ + {Name: "ETCD_AUTO_COMPACTION_MODE", Value: "revision"}, + {Name: "ETCD_AUTO_COMPACTION_RETENTION", Value: "2500"}, + }, + } + } + } + return etcd }