From 202564935429c696745a5b952a215629e5baa103 Mon Sep 17 00:00:00 2001 From: Artem Chernyshev Date: Fri, 14 May 2021 15:33:53 +0300 Subject: [PATCH 1/2] fix: properly populate AllowSchedulingOnMasters option in gen config RPC Previosly it was set only if NetworkConfig is not nil. Signed-off-by: Artem Chernyshev (cherry picked from commit bed6b15d6fcf0634a887b79797d639e221fe9387) --- internal/pkg/configuration/configuration.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/pkg/configuration/configuration.go b/internal/pkg/configuration/configuration.go index 26c0a09848..920bdc3029 100644 --- a/internal/pkg/configuration/configuration.go +++ b/internal/pkg/configuration/configuration.go @@ -90,10 +90,10 @@ func Generate(ctx context.Context, in *machine.GenerateConfigurationRequest) (re CNIUrls: in.ClusterConfig.ClusterNetwork.CniConfig.Urls, })) } - - options = append(options, generate.WithAllowSchedulingOnMasters(in.ClusterConfig.AllowSchedulingOnMasters)) } + options = append(options, generate.WithAllowSchedulingOnMasters(in.ClusterConfig.AllowSchedulingOnMasters)) + var ( input *generate.Input cfgBytes []byte From 231d7997d07fcd729a5e67155348aead8526b838 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Fri, 14 May 2021 21:19:50 +0300 Subject: [PATCH 2/2] fix: stop networkd and pods before leaving etcd on upgrade The change is essentially same as #3590, but applied to the upgrade path which is very similar to the reset path. We have to stop networkd (and remove the VIP/lease on the VIP) before we leave and stop etcd. Plus we stop the kube-apiserver before the etcd is stopped, so that we don't have unhealthy kube-apiserver. Signed-off-by: Andrey Smirnov (cherry picked from commit 0825cf11f412eef930db269b6cae02d059058101) --- .../pkg/runtime/v1alpha1/v1alpha1_sequencer.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer.go b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer.go index c964044ed2..4558c4f790 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer.go @@ -371,14 +371,14 @@ func (*Sequencer) StageUpgrade(r runtime.Runtime, in *machineapi.UpgradeRequest) case runtime.ModeContainer: return nil default: - phases = phases.AppendWhen( - !in.GetPreserve() && (r.Config().Machine().Type() != machine.TypeJoin), - "leave", - LeaveEtcd, - ).Append( + phases = phases.Append( "cleanup", StopAllPods, StopNetworkd, + ).AppendWhen( + !in.GetPreserve() && (r.Config().Machine().Type() != machine.TypeJoin), + "leave", + LeaveEtcd, ).AppendList( stopAllPhaselist(r), ).Append( @@ -401,10 +401,6 @@ func (*Sequencer) Upgrade(r runtime.Runtime, in *machineapi.UpgradeRequest) []ru phases = phases.Append( "drain", CordonAndDrainNode, - ).AppendWhen( - !in.GetPreserve() && (r.Config().Machine().Type() != machine.TypeJoin), - "leave", - LeaveEtcd, ).AppendWhen( !in.GetPreserve(), "cleanup", @@ -415,6 +411,10 @@ func (*Sequencer) Upgrade(r runtime.Runtime, in *machineapi.UpgradeRequest) []ru "cleanup", StopAllPods, StopNetworkd, + ).AppendWhen( + !in.GetPreserve() && (r.Config().Machine().Type() != machine.TypeJoin), + "leave", + LeaveEtcd, ).Append( "stopServices", StopServicesForUpgrade,