Skip to content

Commit

Permalink
fix: rewrite scale down code to be resilient to API calls failures
Browse files Browse the repository at this point in the history
Delete the node first, then remove the machine from etcd.
Also implement a test that verifies rolling update with 2 running
control planes.

Signed-off-by: Artem Chernyshev <[email protected]>
  • Loading branch information
Unix4ever committed Apr 26, 2023
1 parent db4f973 commit 6be6eec
Show file tree
Hide file tree
Showing 8 changed files with 472 additions and 222 deletions.
21 changes: 0 additions & 21 deletions controllers/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ package controllers
import (
"context"
"fmt"
"net"
"reflect"
"time"

"github.com/pkg/errors"
cabptv1 "github.com/siderolabs/cluster-api-bootstrap-provider-talos/api/v1alpha3"
Expand All @@ -20,29 +18,10 @@ import (
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/util/connrotation"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"
)

type kubernetesClient struct {
*kubernetes.Clientset

dialer *connrotation.Dialer
}

// Close kubernetes client.
func (k *kubernetesClient) Close() error {
k.dialer.CloseAll()

return nil
}

func newDialer() *connrotation.Dialer {
return connrotation.NewDialer((&net.Dialer{Timeout: 30 * time.Second, KeepAlive: 30 * time.Second}).DialContext)
}

// talosconfigForMachine will generate a talosconfig that uses *all* found addresses as the endpoints.
func (r *TalosControlPlaneReconciler) talosconfigForMachines(ctx context.Context, tcp *controlplanev1.TalosControlPlane, machines ...clusterv1.Machine) (*talosclient.Client, error) {
if len(machines) == 0 {
Expand Down
21 changes: 0 additions & 21 deletions controllers/consts.go

This file was deleted.

Loading

0 comments on commit 6be6eec

Please sign in to comment.