Skip to content

Commit 1afcb89

Browse files
committed
Bump kine for sql perf improvements
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
1 parent 35e4874 commit 1afcb89

5 files changed

Lines changed: 18 additions & 5 deletions

File tree

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ replace (
1919
github.com/google/cadvisor => github.com/k3s-io/cadvisor v0.52.1
2020
github.com/google/gnostic-models => github.com/google/gnostic-models v0.6.9
2121
github.com/googleapis/gax-go/v2 => github.com/googleapis/gax-go/v2 v2.12.0
22+
github.com/k3s-io/kine => github.com/brandond/kine v0.15.1-bd.10
2223
github.com/opencontainers/cgroups => github.com/opencontainers/cgroups v0.0.5
2324
github.com/opencontainers/runc => github.com/opencontainers/runc v1.4.2
2425
github.com/opencontainers/selinux => github.com/opencontainers/selinux v1.13.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM
305305
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
306306
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
307307
github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
308+
github.com/brandond/kine v0.15.1-bd.10 h1:28tIEEO8gMIKd8jVEvTw6rT3aMNYrDRAwcqAZqDU29o=
309+
github.com/brandond/kine v0.15.1-bd.10/go.mod h1:G3bF+43KaA5h2BEVrmurS+0ryzXksiJ36C0BnszVUKI=
308310
github.com/bronze1man/goStrongswanVici v0.0.0-20231128135937-211cef3b0b20 h1:JMoL5xJSYxo1QVJ3c+4FutWQnks3gZX9DYkgAnvg+5g=
309311
github.com/bronze1man/goStrongswanVici v0.0.0-20231128135937-211cef3b0b20/go.mod h1:fWUtBEPt2yjrr3WFhOqvajM8JSEU8bEeBcoeSCsKRpc=
310312
github.com/buger/jsonparser v1.1.2 h1:frqHqw7otoVbk5M8LlE/L7HTnIq2v9RX6EJ48i9AxJk=
@@ -870,8 +872,6 @@ github.com/k3s-io/etcd/server/v3 v3.6.7-k3s1 h1:ZBV6n9XhjGex9MIOaEAefbhNriH5Gxo4
870872
github.com/k3s-io/etcd/server/v3 v3.6.7-k3s1/go.mod h1:LEM328bPA2uVMhN0+Ht/vAsADW127QS1oM7EuHrOTy0=
871873
github.com/k3s-io/helm-controller v0.17.1 h1:LjZelVfddI5CWFAI5zlkRVhxobpSLRnNA/R9qU706k0=
872874
github.com/k3s-io/helm-controller v0.17.1/go.mod h1:5cuEedP5BgBkWpUO1C3BY05hnaBLycsm/2PsW3DY6WE=
873-
github.com/k3s-io/kine v0.15.0 h1:KRb+DrZFd8YLRNbeAt+UYpyaCHCwJlilFVSrrkvpndc=
874-
github.com/k3s-io/kine v0.15.0/go.mod h1:G3bF+43KaA5h2BEVrmurS+0ryzXksiJ36C0BnszVUKI=
875875
github.com/k3s-io/klog/v2 v2.140.0-k3s1 h1:Z6S9oqaxcKtLaTcQNgWsaZNE5a+qJmCrTI+Lahor4X8=
876876
github.com/k3s-io/klog/v2 v2.140.0-k3s1/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0=
877877
github.com/k3s-io/kube-router/v2 v2.6.3-k3s1 h1:RZjUBIuitXCuYoCzm1aM6p5EgQFC5k3N72j4pBIc2j4=

pkg/cli/server/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
8484
// If exiting due to an error, ensure that contexts are cancelled so that the
8585
// WaitGroup exits. Otherwise, wait for something else to initiate shutdown.
8686
defer func() {
87+
if r := recover(); r != nil {
88+
rerr = fmt.Errorf("server panicked: %v", r)
89+
}
8790
if rerr != nil {
8891
// do not need to pass the error in here, it will be reported by the CLI error handler
8992
signals.RequestShutdown(nil)

pkg/cluster/cluster.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,16 @@ func (c *Cluster) startStorage(ctx context.Context, bootstrap bool) error {
182182
}()
183183
c.storageRunning = true
184184

185+
if !c.config.KineTLS {
186+
// if TLS is not enabled for kine, storage will only be started once,
187+
// so go ahead and register metrics now
188+
c.config.Datastore.MetricsRegisterer = metrics.DefaultRegisterer
189+
}
185190
if !bootstrap {
186-
// only register metrics when not bootstrapping, to prevent
187-
// multiple datastore metrics from being registered.
191+
// only register metrics after boostrapping is done, to prevent
192+
// multiple datastore metrics from being registered
188193
c.config.Datastore.MetricsRegisterer = metrics.DefaultRegisterer
189-
// set the tls config for the kine storage
194+
// set the tls config for the kine storage, once bootstrapped
190195
c.config.Datastore.ServerTLSConfig.CAFile = c.config.Runtime.ETCDServerCA
191196
c.config.Datastore.ServerTLSConfig.CertFile = c.config.Runtime.ServerETCDCert
192197
c.config.Datastore.ServerTLSConfig.KeyFile = c.config.Runtime.ServerETCDKey

tests/unit.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77

88
"github.com/k3s-io/k3s/pkg/daemons/config"
99
"github.com/k3s-io/k3s/pkg/daemons/control/deps"
10+
"github.com/k3s-io/k3s/pkg/metrics"
11+
"github.com/prometheus/client_golang/prometheus"
1012
)
1113

1214
// GenerateDataDir creates a temporary directory at "/tmp/k3s/<RANDOM_STRING>/".
@@ -43,6 +45,8 @@ func CleanupDataDir(cnf *config.Control) {
4345
// GenerateRuntime creates a temporary data dir and configures
4446
// config.ControlRuntime with all the appropriate certificate keys.
4547
func GenerateRuntime(cnf *config.Control) error {
48+
// reset metrics registerer to avoid panicing if test cover metrics registration
49+
metrics.DefaultRegisterer = prometheus.NewRegistry()
4650
// reuse ready channel from existing runtime if set
4751
cnf.Runtime = config.NewRuntime()
4852
if err := GenerateDataDir(cnf); err != nil {

0 commit comments

Comments
 (0)