Skip to content

Do not create etcd name file if etcd is not in use#13727

Merged
brandond merged 1 commit intok3s-io:mainfrom
brandond:kine-etcd-name
Mar 6, 2026
Merged

Do not create etcd name file if etcd is not in use#13727
brandond merged 1 commit intok3s-io:mainfrom
brandond:kine-etcd-name

Conversation

@brandond
Copy link
Copy Markdown
Member

@brandond brandond commented Mar 4, 2026

Proposed Changes

Do not create etcd name file if etcd is not in use

etcd.setName was being called during managed driver creation, even if the managed driver (etcd) is not in use. Let etcd.Register handle calling setName.

The two call paths are:

main.main(main.go:88)
github.com/urfave/cli/v2.(*App).Run(app.go:307)
github.com/urfave/cli/v2.(*App).RunContext(app.go:333)
github.com/urfave/cli/v2.(*Command).Run(command.go:269)
github.com/urfave/cli/v2.(*Command).Run(command.go:276)
github.com/k3s-io/k3s/pkg/cli/server.Run(server.go:48)
github.com/k3s-io/k3s/pkg/cli/server.run(server.go:533)
github.com/k3s-io/k3s/pkg/server.PrepareServer(server.go:61)
github.com/k3s-io/k3s/pkg/daemons/control.Prepare(server.go:44)
github.com/k3s-io/k3s/pkg/daemons/control.prepare(server.go:327)
github.com/k3s-io/k3s/pkg/cluster.(*Cluster).Bootstrap(bootstrap.go:39)
github.com/k3s-io/k3s/pkg/cluster.(*Cluster).assignManagedDriver(managed.go:87)
github.com/k3s-io/k3s/pkg/etcd.(*ETCD).SetControlConfig(etcd.go:192)
github.com/k3s-io/k3s/pkg/etcd.(*ETCD).setName(etcd.go:724)

and then again later, if etcd is actually enabled:

main.main(main.go:88)
github.com/urfave/cli/v2.(*App).Run(app.go:307)
github.com/urfave/cli/v2.(*App).RunContext(app.go:333)
github.com/urfave/cli/v2.(*Command).Run(command.go:269)
github.com/urfave/cli/v2.(*Command).Run(command.go:276)
github.com/k3s-io/k3s/pkg/cli/server.Run(server.go:48)
github.com/k3s-io/k3s/pkg/cli/server.run(server.go:533)
github.com/k3s-io/k3s/pkg/server.PrepareServer(server.go:61)
github.com/k3s-io/k3s/pkg/daemons/control.Prepare(server.go:44)
github.com/k3s-io/k3s/pkg/daemons/control.prepare(server.go:335)
github.com/k3s-io/k3s/pkg/cluster.(*Cluster).ListenAndServe(cluster.go:42)
github.com/k3s-io/k3s/pkg/cluster.(*Cluster).initClusterAndHTTPS(https.go:113)
github.com/k3s-io/k3s/pkg/cluster.(*Cluster).registerDBHandlers(managed.go:76)
github.com/k3s-io/k3s/pkg/etcd.(*ETCD).Register(etcd.go:712)
github.com/k3s-io/k3s/pkg/etcd.(*ETCD).setName(etcd.go:724)

Types of Changes

bugfix

Verification

See linked

Testing

Linked Issues

User-Facing Change

Further Comments

@brandond brandond requested a review from a team as a code owner March 4, 2026 20:35
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 22.22%. Comparing base (b51167a) to head (b928ce8).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13727      +/-   ##
==========================================
+ Coverage   21.84%   22.22%   +0.37%     
==========================================
  Files         191      191              
  Lines       15539    15539              
==========================================
+ Hits         3394     3453      +59     
+ Misses      11692    11611      -81     
- Partials      453      475      +22     
Flag Coverage Δ
unittests 22.22% <100.00%> (+0.37%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

etcd.setName was being called during managed driver creation, even if the managed driver (etcd) is not in use. Let etcd.Register handle calling setName.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
@brandond
Copy link
Copy Markdown
Member Author

brandond commented Mar 6, 2026

trivy breakage is unrelated. merging.

@brandond brandond merged commit 8908d5f into k3s-io:main Mar 6, 2026
90 of 93 checks passed
brandond added a commit to brandond/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to brandond/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to brandond/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to brandond/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to brandond/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to brandond/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to brandond/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to brandond/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to brandond/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to brandond/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to brandond/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to brandond/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to brandond/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to brandond/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to rancher/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to rancher/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to rancher/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to rancher/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
brandond added a commit to rancher/rke2 that referenced this pull request Mar 13, 2026
Also return error context when podtemplate.Pod fails to hash files.
Related to k3s-io/k3s#13727

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants