Skip to content

Commit

Permalink
Fix external etcd connection
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Savian <[email protected]>
  • Loading branch information
vitorsavian committed Aug 2, 2024
1 parent 9604188 commit db057b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ require (
github.com/iamacarpet/go-win64api v0.0.0-20210311141720-fe38760bed28
github.com/k3s-io/helm-controller v0.16.1
github.com/k3s-io/k3s v1.30.3-0.20240715171250-37830fe170fa // master
github.com/k3s-io/kine v0.11.11
github.com/libp2p/go-netroute v0.2.1
github.com/natefinch/lumberjack v2.0.0+incompatible
github.com/onsi/ginkgo/v2 v2.16.0
Expand Down Expand Up @@ -251,7 +252,6 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/josharian/native v1.1.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/k3s-io/kine v0.11.11 // indirect
github.com/karrick/godirwalk v1.17.0 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
Expand Down
11 changes: 9 additions & 2 deletions pkg/rke2/rke2_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/k3s-io/k3s/pkg/cli/cmds"
"github.com/k3s-io/k3s/pkg/cluster/managed"
"github.com/k3s-io/k3s/pkg/etcd"
"github.com/k3s-io/kine/pkg/endpoint"
"github.com/pkg/errors"
"github.com/rancher/rke2/pkg/cli/defaults"
"github.com/rancher/rke2/pkg/images"
Expand Down Expand Up @@ -63,8 +64,14 @@ func initExecutor(clx *cli.Context, cfg Config, isServer bool) (*podexecutor.Sta
if cmds.ServerConfig.DatastoreEndpoint != "" || (clx.Bool("disable-etcd") && !clx.IsSet("server")) {
cmds.ServerConfig.DisableETCD = false
cmds.ServerConfig.ClusterInit = false
cmds.ServerConfig.KineTLS = true
ExternalDatabase = true

// When the datastore sets a etcd endpoint, rke2 does not need kine with tls and changes
// in the --etcd-servers inside podexecutor using ExternalDatabase
driver, _ := endpoint.ParseStorageEndpoint(cmds.ServerConfig.DatastoreEndpoint)
if !(driver == endpoint.ETCDBackend) {
cmds.ServerConfig.KineTLS = true
ExternalDatabase = true
}
} else {
managed.RegisterDriver(&etcd.ETCD{})
}
Expand Down

0 comments on commit db057b8

Please sign in to comment.