Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix external etcd connection #6355

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading