Hello community, here is the log from the commit of package kubernetes for openSUSE:Leap:15.2 checked in at 2020-03-21 16:45:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/kubernetes (Old) and /work/SRC/openSUSE:Leap:15.2/.kubernetes.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kubernetes" Sat Mar 21 16:45:59 2020 rev:3 rq:786795 version:1.17.4 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/kubernetes/kubernetes.changes 2020-03-19 11:07:54.716035997 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.kubernetes.new.3160/kubernetes.changes 2020-03-21 16:47:23.917660992 +0100 @@ -64,0 +65,5 @@ +Wed Feb 5 09:10:13 UTC 2020 - Ludovic Cavajani <[email protected]> + +- Do not use upstream default volume-plugin-dir only for openSUSE (bsc#1162093) + +------------------------------------------------------------------- @@ -110,0 +116,6 @@ + +------------------------------------------------------------------- +Mon Dec 16 12:17:19 UTC 2019 - Itxaka serrano <[email protected]> + +- Add patch for kubeadm: Improve resiliency in CreateOrMutateConfigMap + kubeadm-improve-resilency-CreateOrMutateConfigMap.patch New: ---- kubeadm-improve-resilency-CreateOrMutateConfigMap.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kubernetes.spec ++++++ --- /var/tmp/diff_new_pack.ZsL4KZ/_old 2020-03-21 16:47:25.509661999 +0100 +++ /var/tmp/diff_new_pack.ZsL4KZ/_new 2020-03-21 16:47:25.517662005 +0100 @@ -68,6 +68,8 @@ Patch3: opensuse-version-checks.patch # Patch to change the default flexvolume path in kubeadm to match that used by our kubelet, else kubeadm tries to write to /usr when kubelet is already looking at a path on /var thanks to the fix to bsc#1084766 Patch4: kubeadm-opensuse-flexvolume.patch +# https://github.com/kubernetes/kubernetes/pull/85763 - Drop this patch in 1.18 as its already in +Patch5: kubeadm-improve-resilency-CreateOrMutateConfigMap.patch BuildRequires: bash-completion BuildRequires: fdupes BuildRequires: git @@ -315,6 +317,10 @@ %patch3 -p1 %patch4 -p0 %endif +# from 1.18, kubeadm already has the patch +%if "%{baseversion}" == "1.16" || "%{baseversion}" == "1.17" +%patch5 -p1 +%endif %if !0%{?is_opensuse} %{goprep} github.com/kubernetes/kubernetes %endif @@ -462,8 +468,15 @@ # install the place the kubelet defaults to put volumes install -d %{buildroot}%{_localstatedir}/lib/kubelet -# install VolumePluginDir (bsc#1084766) +# install VolumePluginDir (bsc#1084766, bsc#1162093) +# FIXME: CaaSP 4 defines the volume_plugin_dir in a directory that is not writeable +# on transactional-systems. This is ok but will be an issue when willing to support +# CaaSP on transactional-systems. +%if !0%{?is_opensuse} +%define volume_plugin_dir %{_libexecdir}/kubernetes/kubelet-plugins/volume/exec +%else %define volume_plugin_dir %{_localstatedir}/lib/kubelet/volume-plugin +%endif install -d %{buildroot}/%{volume_plugin_dir} # Remove dangling symlink (breaks post-build scripts) ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.ZsL4KZ/_old 2020-03-21 16:47:25.581662046 +0100 +++ /var/tmp/diff_new_pack.ZsL4KZ/_new 2020-03-21 16:47:25.581662046 +0100 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/kubernetes/kubernetes.git</param> - <param name="changesrevision">589a6e12b58314615c045ad70821f500e8d43486</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">589a6e12b58314615c045ad70821f500e8d43486</param></service></servicedata> ++++++ kubeadm-improve-resilency-CreateOrMutateConfigMap.patch ++++++ >From 14fe7225c1499e20d5c0734f4c9d7e250a2b476c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Fern=C3=A1ndez=20L=C3=B3pez?= <[email protected]> Date: Sat, 30 Nov 2019 13:19:38 +0100 Subject: [PATCH] kubeadm: Improve resiliency in CreateOrMutateConfigMap CreateOrMutateConfigMap was not resilient when it was trying to Create the ConfigMap. If this operation returned an unknown error the whole operation would fail, because it was strict in what error it was expecting right afterwards: if the error returned by the Create call was a IsAlreadyExists error, it would work fine. However, if an unexpected error (such as an EOF) happened, this call would fail. We are seeing this error specially when running control plane node joins in an automated fashion, where things happen at a relatively high speed pace. It was specially easy to reproduce with kind, with several control plane instances. E.g.: ``` [upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace I1130 11:43:42.788952 887 round_trippers.go:443] POST https://172.17.0.2:6443/api/v1/namespaces/kube-system/configmaps?timeout=10s in 1013 milliseconds Post https://172.17.0.2:6443/api/v1/namespaces/kube-system/configmaps?timeout=10s: unexpected EOF unable to create ConfigMap k8s.io/kubernetes/cmd/kubeadm/app/util/apiclient.CreateOrMutateConfigMap /go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/cmd/kubeadm/app/util/apiclient/idempotency.go:65 ``` This change makes this logic more resilient to unknown errors. It will retry on the light of unknown errors until some of the expected error happens: either `IsAlreadyExists`, in which case we will mutate the ConfigMap, or no error, in which case the ConfigMap has been created. --- cmd/kubeadm/app/util/apiclient/idempotency.go | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/cmd/kubeadm/app/util/apiclient/idempotency.go b/cmd/kubeadm/app/util/apiclient/idempotency.go index 4ae951db3c5d0..1729611367cdb 100644 --- a/cmd/kubeadm/app/util/apiclient/idempotency.go +++ b/cmd/kubeadm/app/util/apiclient/idempotency.go @@ -45,11 +45,11 @@ type ConfigMapMutator func(*v1.ConfigMap) error func CreateOrUpdateConfigMap(client clientset.Interface, cm *v1.ConfigMap) error { if _, err := client.CoreV1().ConfigMaps(cm.ObjectMeta.Namespace).Create(cm); err != nil { if !apierrors.IsAlreadyExists(err) { - return errors.Wrap(err, "unable to create configmap") + return errors.Wrap(err, "unable to create ConfigMap") } if _, err := client.CoreV1().ConfigMaps(cm.ObjectMeta.Namespace).Update(cm); err != nil { - return errors.Wrap(err, "unable to update configmap") + return errors.Wrap(err, "unable to update ConfigMap") } } return nil @@ -60,13 +60,27 @@ func CreateOrUpdateConfigMap(client clientset.Interface, cm *v1.ConfigMap) error // to conflicts, and a retry will be issued if the ConfigMap was modified on the server between the refresh and the update (while the mutation was // taking place) func CreateOrMutateConfigMap(client clientset.Interface, cm *v1.ConfigMap, mutator ConfigMapMutator) error { - if _, err := client.CoreV1().ConfigMaps(cm.ObjectMeta.Namespace).Create(cm); err != nil { - if !apierrors.IsAlreadyExists(err) { - return errors.Wrap(err, "unable to create ConfigMap") + var lastError error + err := wait.ExponentialBackoff(wait.Backoff{ + Steps: 20, + Duration: 500 * time.Millisecond, + Factor: 1.0, + Jitter: 0.1, + }, func() (bool, error) { + if _, err := client.CoreV1().ConfigMaps(cm.ObjectMeta.Namespace).Create(cm); err != nil { + lastError = err + if apierrors.IsAlreadyExists(err) { + lastError = MutateConfigMap(client, metav1.ObjectMeta{Namespace: cm.ObjectMeta.Namespace, Name: cm.ObjectMeta.Name}, mutator) + return lastError == nil, nil + } + return false, nil } - return MutateConfigMap(client, metav1.ObjectMeta{Namespace: cm.ObjectMeta.Namespace, Name: cm.ObjectMeta.Name}, mutator) + return true, nil + }) + if err == nil { + return nil } - return nil + return lastError } // MutateConfigMap takes a ConfigMap Object Meta (namespace and name), retrieves the resource from the server and tries to mutate it @@ -100,7 +114,7 @@ func CreateOrRetainConfigMap(client clientset.Interface, cm *v1.ConfigMap, confi } if _, err := client.CoreV1().ConfigMaps(cm.ObjectMeta.Namespace).Create(cm); err != nil { if !apierrors.IsAlreadyExists(err) { - return errors.Wrap(err, "unable to create configmap") + return errors.Wrap(err, "unable to create ConfigMap") } } }
