Skip to content

keadm: honor --certPath when generating edgecore.yaml - #7362

Open
Thanatos9404 wants to merge 1 commit into
kubeedge:masterfrom
Thanatos9404:fix/keadm-join-certpath
Open

Thanatos9404 wants to merge 1 commit into
kubeedge:masterfrom
Thanatos9404:fix/keadm-join-certpath

Conversation

@Thanatos9404

@Thanatos9404 Thanatos9404 commented Oct 19, 2026 •

Copy link
Copy Markdown

What type of PR is this?

/kind bug

What this PR does / why we need it:

keadm join --certPath is parsed but never used when edgecore.yaml is generated (createEdgeConfigFiles in join_others.go and join_windows.go), so the certificate and key paths always keep their defaults.

Now --certPath sets the certificate to <certPath>/server.crt and the key to <certPath>/server.key for edgeHub, edgeStream, eventBus TLS and metaServer, the modules that use that key pair by default. A relative path is made absolute, --set still takes precedence, and a join without --certPath writes the same config as before. The CA file stays at its default and can be moved with --set.

This builds on #4926 by @Shelley-BaoYue but keeps the existing directory layout instead of changing DefaultCertPath. Happy to switch to the #4926 layout if you prefer it.

Which issue(s) this PR fixes:

Fixes #4866

#2974 reports the same problem.

Special notes for your reviewer:

The new join_test.go checks the generated paths for the default, an empty, a custom and a relative cert path, plus a --set override. The custom, relative and --set cases fail on master and pass with this change.

Known limitation: keadm reset doesn't remove a custom cert directory, so delete the old server.crt/server.key before re-joining with the same --certPath. I can handle that in a follow-up.

Does this PR introduce a user-facing change?:

keadm join: `--certPath` now sets the certificate and private key paths in edgecore.yaml to `<certPath>/server.crt` and `<certPath>/server.key`. The CA file stays at its default and can be changed with `--set`.

@kubeedge-bot kubeedge-bot added the kind/bug Categorizes issue or PR as related to a bug. label Oct 19, 2026
@kubeedge-bot kubeedge-bot added the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Oct 19, 2026
@kubeedge-bot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign subpathdev after the PR has been reviewed.
You can assign the PR to them by writing /assign @subpathdev in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubeedge-bot

Copy link
Copy Markdown
Collaborator

Welcome @Thanatos9404! It looks like this is your first PR to kubeedge/kubeedge 🎉

@kubeedge-bot kubeedge-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 19, 2026
keadm join parses --certPath, but neither createEdgeConfigFiles (Linux
and Windows) reads it. The certificate and key paths in edgecore.yaml
keep their defaults, edgecore stores the certificate it gets from
cloudcore there, and the wait after starting edgecore polls the
default paths too.

Point every module that uses the edge certificate at
<certPath>/server.crt and <certPath>/server.key: edgeHub, edgeStream
(which loads the same key pair for the tunnel), the eventBus MQTT TLS
settings and the metaServer client settings. DefaultCertPath is
already the directory that holds those two files, so the default
config does not change. The CA files keep their own path, since by
default the CA lives outside the certs directory, and --set still
takes precedence over --certPath.

edgecore resolves a relative path against its own working directory,
so a relative --certPath is made absolute first. The flag help now
says what the directory holds and where the CA file goes.

Signed-off-by: Yashvardhan Thanvi <[email protected]>
@Thanatos9404
Thanatos9404 force-pushed the fix/keadm-join-certpath branch from dafb867 to a2ce11e Compare October 19, 2026 08:35
@kubeedge-bot kubeedge-bot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

keadm join param "certPath" not take effect

2 participants