This repository has been archived by the owner on Jun 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix controlplane running as DaemonSet on single node clusters
This commit fixes passed 'control_plane_replicas' value to Kubernetes Helm chart which caused kube-scheduler and kube-controller-manager to run as DaemonSet on single controlplane node clusters, which breaks the ability to update it gracefully. It also adds tests that controlplane is using right resource type on different controlplane sizes and that both can be gracefully updated without breaking cluster functionality. Closes #1097 Closes #90 Signed-off-by: Mateusz Gozdek <[email protected]>
- Loading branch information
Showing
7 changed files
with
183 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
test/components/kubernetes/controlplane-multi-node_disruptive_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright 2020 The Lokomotive Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// +build aws aws_edge | ||
// +build disruptivee2e | ||
|
||
package kubernetes_test | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
"time" | ||
|
||
testutil "github.com/kinvolk/lokomotive/test/components/util" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
func TestControlplaneComponentsDaemonSetsCanBeGracefullyUpdated(t *testing.T) { | ||
client := testutil.CreateKubeClient(t) | ||
dsClient := client.AppsV1().DaemonSets(namespace) | ||
|
||
components := components() | ||
components["kube-proxy"] = testutil.RetryInterval | ||
|
||
for c, waitTime := range components { | ||
c := c | ||
waitTime := waitTime | ||
|
||
t.Run(c, func(t *testing.T) { | ||
ds, err := dsClient.Get(context.TODO(), c, metav1.GetOptions{}) | ||
if err != nil { | ||
t.Fatalf("Getting DaemonSet %q: %v", c, err) | ||
} | ||
|
||
// Use current time to have different value on each test run. | ||
ds.Spec.Template.Annotations["update-test"] = time.Now().String() | ||
|
||
if _, err := dsClient.Update(context.TODO(), ds, metav1.UpdateOptions{}); err != nil { | ||
t.Fatalf("Updating DaemonSet %q: %v", c, err) | ||
} | ||
|
||
// Wait a bit to let Kubernetes trigger pod updates. | ||
time.Sleep(waitTime) | ||
|
||
testutil.WaitForDaemonSet(t, client, namespace, c, testutil.RetryInterval, testutil.Timeout) | ||
}) | ||
} | ||
} |
Oops, something went wrong.