Skip to content

Fix kubelet.conf server line indentation (#13277)#13284

Open
longxiucai wants to merge 2 commits into
kubernetes-sigs:masterfrom
longxiucai:fix/kubelet-conf-indent-13277
Open

Fix kubelet.conf server line indentation (#13277)#13284
longxiucai wants to merge 2 commits into
kubernetes-sigs:masterfrom
longxiucai:fix/kubelet-conf-indent-13277

Conversation

@longxiucai

@longxiucai longxiucai commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?
/kind bug

What this PR does / why we need it:
Fix invalid YAML indentation in kubelet.conf caused by hardcoded 4-space indent in lineinfile module.
The original task breaks the structure of kubelet.conf when the file uses different indentation levels.
This change uses regex back-reference to preserve original indentation.

Which issue(s) this PR fixes:

Fixes #13277

Special notes for your reviewer:

  • Uses backrefs: true to ensure group capture works
  • Regex matches any indentation before "server: https"
  • Safe for all indentation styles
  • Only affects worker nodes when external LB is enabled

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: longyuxiang <longyuxiang@kylinos.cn>
@k8s-ci-robot k8s-ci-robot added do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jun 1, 2026
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 1, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: longxiucai / name: longyuxiang (1fb0b68)

@k8s-ci-robot k8s-ci-robot requested review from guoard and yankay June 1, 2026 09:13
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Welcome @longxiucai!

It looks like this is your first PR to kubernetes-sigs/kubespray 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubespray has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 1, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Hi @longxiucai. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@longxiucai longxiucai closed this Jun 1, 2026
@longxiucai longxiucai reopened this Jun 1, 2026
@longxiucai longxiucai closed this Jun 1, 2026
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jun 1, 2026
@longxiucai longxiucai reopened this Jun 1, 2026
@longxiucai longxiucai changed the title Fix kubelet.conf server line indentation (fix #13277) Fix kubelet.conf server line indentation (#13277) Jun 1, 2026
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jun 1, 2026
@tico88612

Copy link
Copy Markdown
Member

Could you fix your CLA?

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 2, 2026
@tico88612

Copy link
Copy Markdown
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 2, 2026
Signed-off-by: longyuxiang <longyuxiang@kylinos.cn>
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 2, 2026
@yankay

yankay commented Jun 16, 2026

Copy link
Copy Markdown
Member

Thanks @longxiucai
/approve

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: longxiucai, yankay

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 16, 2026
@yankay yankay requested a review from Copilot June 16, 2026 03:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a kubeadm worker-node upgrade failure where the lineinfile task could rewrite the server: entry in kubelet.conf at an incorrect YAML indentation level, breaking kubeconfig parsing and causing kubelet to crash-loop.

Changes:

  • Updates the lineinfile regex to capture and reuse the existing indentation on the server: line.
  • Enables backrefs: true so the replacement line preserves the matched indentation instead of hardcoding spaces.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Worker node kubelet crash-loop after upgrade: lineinfile task writes server: at wrong YAML indentation in kubelet.conf

5 participants