Skip to content

Commit

Permalink
Skip scale-up checks for first member of etcd cluster.
Browse files Browse the repository at this point in the history
  • Loading branch information
ishan16696 committed Jul 19, 2023
1 parent 9407ade commit 645023e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/initializer/initializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"time"

"github.com/gardener/etcd-backup-restore/pkg/errors"
Expand Down Expand Up @@ -57,8 +58,14 @@ func (e *EtcdInitializer) Initialize(mode validator.Mode, failBelowRevision int6
ctx := context.Background()
var err error

//Etcd cluster scale-up case
if miscellaneous.IsMultiNode(logger) {
podName, err := miscellaneous.GetEnvVarOrError("POD_NAME")
if err != nil {
logger.Fatalf("Error reading POD_NAME env var : %v", err)
}

// Etcd cluster scale-up case
// Note: first member of etcd cluster can never be part of scale-up case.
if miscellaneous.IsMultiNode(logger) && !strings.HasSuffix(podName, "0") {
clientSet, err := miscellaneous.GetKubernetesClientSetOrError()
if err != nil {
logger.Fatalf("failed to create clientset, %v", err)
Expand Down

0 comments on commit 645023e

Please sign in to comment.