Skip to content

Commit

Permalink
Merge pull request #1371 from facchettos/etcd-ha-fix
Browse files Browse the repository at this point in the history
fixed etcd ha not coming up
  • Loading branch information
Thomas Kosiewski authored Nov 22, 2023
2 parents ef319e4 + a828c21 commit 3d0498e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/setup/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package setup
import (
"context"
"fmt"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -138,6 +139,17 @@ func GenerateK8sCerts(ctx context.Context, currentNamespaceClient kubernetes.Int
"*." + etcdService + "-headless" + "." + currentNamespace,
}

//expect up to 20 etcd members, number could be lower since more
//than 5 is generally a bad idea
for i := 0; i < 20; i++ {
// this is for embedded etcd
hostname := vClusterName + "-" + strconv.Itoa(i)
etcdSans = append(etcdSans, hostname, hostname+"."+vClusterName+"-headless", hostname+"."+vClusterName+"-headless"+"."+currentNamespace)
// this is for external etcd
etcdHostname := etcdService + "-" + strconv.Itoa(i)
etcdSans = append(etcdSans, etcdHostname, etcdHostname+"."+etcdService+"-headless", etcdHostname+"."+etcdService+"-headless"+"."+currentNamespace)
}

// generate certificates
err := certs.EnsureCerts(ctx, serviceCIDR, currentNamespace, currentNamespaceClient, vClusterName, certificatesDir, clusterDomain, etcdSans)
if err != nil {
Expand Down

0 comments on commit 3d0498e

Please sign in to comment.