From 01c89aa208530c7d718bdfcff6b19fb0e350b1db Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Fri, 17 Nov 2023 01:30:49 +0000 Subject: [PATCH 1/2] Reorder snapshot configmap reconcile to reduce log spew during initial startup Signed-off-by: Brad Davidson --- pkg/etcd/snapshot_controller.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pkg/etcd/snapshot_controller.go b/pkg/etcd/snapshot_controller.go index a21da8481719..b5e3be32251a 100644 --- a/pkg/etcd/snapshot_controller.go +++ b/pkg/etcd/snapshot_controller.go @@ -160,21 +160,6 @@ func (e *etcdSnapshotHandler) onRemove(key string, esf *apisv1.ETCDSnapshotFile) } func (e *etcdSnapshotHandler) reconcile() error { - logrus.Infof("Reconciling snapshot ConfigMap data") - - snapshotConfigMap, err := e.configmaps.Get(metav1.NamespaceSystem, snapshotConfigMapName, metav1.GetOptions{}) - if err != nil { - if !apierrors.IsNotFound(err) { - return errors.Wrap(err, "failed to get snapshot ConfigMap") - } - snapshotConfigMap = &v1.ConfigMap{ - ObjectMeta: metav1.ObjectMeta{ - Name: snapshotConfigMapName, - Namespace: metav1.NamespaceSystem, - }, - } - } - // Get a list of all etcd nodes currently in the cluster. // We will use this list to prune local entries for any node that does not exist. nodes := e.etcd.config.Runtime.Core.Core().V1().Node() @@ -202,6 +187,8 @@ func (e *etcdSnapshotHandler) reconcile() error { return errNotReconciled } + logrus.Infof("Reconciling snapshot ConfigMap data") + // Get a list of existing snapshots snapshotList, err := e.snapshots.List(metav1.ListOptions{}) if err != nil { @@ -219,6 +206,19 @@ func (e *etcdSnapshotHandler) reconcile() error { snapshots[sfKey] = esf } + snapshotConfigMap, err := e.configmaps.Get(metav1.NamespaceSystem, snapshotConfigMapName, metav1.GetOptions{}) + if err != nil { + if !apierrors.IsNotFound(err) { + return errors.Wrap(err, "failed to get snapshot ConfigMap") + } + snapshotConfigMap = &v1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Name: snapshotConfigMapName, + Namespace: metav1.NamespaceSystem, + }, + } + } + // Make a copy of the configmap for change detection existing := snapshotConfigMap.DeepCopyObject() From 7320f07ba311a65e1320568f3bab64eff0740471 Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Fri, 17 Nov 2023 01:32:27 +0000 Subject: [PATCH 2/2] Bump dynamiclistener to fix secret sync race Signed-off-by: Brad Davidson --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 7ef56e26dc25..fad2ce505ea5 100644 --- a/go.mod +++ b/go.mod @@ -124,8 +124,8 @@ require ( github.com/opencontainers/selinux v1.11.0 github.com/otiai10/copy v1.7.0 github.com/pkg/errors v0.9.1 - github.com/rancher/dynamiclistener v0.3.6-rc2 - github.com/rancher/lasso v0.0.0-20230629200414-8a54b32e6792 + github.com/rancher/dynamiclistener v0.3.6 + github.com/rancher/lasso v0.0.0-20230830164424-d684fdeb6f29 github.com/rancher/remotedialer v0.3.0 github.com/rancher/wharfie v0.5.3 github.com/rancher/wrangler v1.1.1 diff --git a/go.sum b/go.sum index 774d506279c2..bda17d5b6a8c 100644 --- a/go.sum +++ b/go.sum @@ -1270,10 +1270,10 @@ github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rancher/dynamiclistener v0.3.6-rc2 h1:Y1nai+Xv+4qqlB3c+hmrY2uBo1EcCDU9kmN5hbnmZhA= -github.com/rancher/dynamiclistener v0.3.6-rc2/go.mod h1:wOh62hdJIgyqTdD/VAHO77UPKAbUsJJ5gYRjzgBL3Wo= -github.com/rancher/lasso v0.0.0-20230629200414-8a54b32e6792 h1:IaPhDqppVYX2v/nCR8j2i0nqOLD5yggzzy39QUlcqDw= -github.com/rancher/lasso v0.0.0-20230629200414-8a54b32e6792/go.mod h1:dNcwXjcqgdOuKFIVETNAPURRh3e5PAi/nWUjj+MLVZA= +github.com/rancher/dynamiclistener v0.3.6 h1:iAFWeiFNra6tYlt4k+jINrK3hOxZ8mjW2S/9nA6sxKs= +github.com/rancher/dynamiclistener v0.3.6/go.mod h1:VqBaJNi+bZmre0+gi+2Jb6jbn7ovHzRueW+M7QhVKsk= +github.com/rancher/lasso v0.0.0-20230830164424-d684fdeb6f29 h1:+kige/h8/LnzWgPjB5NUIHz/pWiW/lFpqcTUkN5uulY= +github.com/rancher/lasso v0.0.0-20230830164424-d684fdeb6f29/go.mod h1:kgk9kJVMj9FIrrXU0iyM6u/9Je4bEjPImqswkTVaKsQ= github.com/rancher/remotedialer v0.3.0 h1:y1EO8JCsgZo0RcqTUp6U8FXcBAv27R+TLnWRcpvX1sM= github.com/rancher/remotedialer v0.3.0/go.mod h1:BwwztuvViX2JrLLUwDlsYt5DiyUwHLlzynRwkZLAY0Q= github.com/rancher/wharfie v0.5.3 h1:6hiO26H7YTgChbLAE6JppxFRjaH3tbKfMItv/LqV0Q0=