Skip to content

Use node status.addresses for kubelet health-check - #331

Open
kwohlfahrt wants to merge 6 commits into
medik8s:mainfrom
kwohlfahrt:kubelet-node-address
Open

Use node status.addresses for kubelet health-check#331
kwohlfahrt wants to merge 6 commits into
medik8s:mainfrom
kwohlfahrt:kubelet-node-address

Conversation

@kwohlfahrt

@kwohlfahrt kwohlfahrt commented Aug 3, 2026

Copy link
Copy Markdown

Why we need this PR

To support clusters where the node's name is not resolvable, but the addresses in status.addresses can be used instead.

Changes made

  • Add a new config options (preferredAddressTypes) that allows selecting addresses from status.addresses (and a special NodeName value, for the old behaviour, on by default)
  • Get node addresses on startup from the node's status.addresses, use the enabled ones when trying the kubelet health-check
  • Small tweak to Makefile to download the correct protoc on aarch64 dev machines

Which issue(s) this PR fixes

Closes #330.

Test plan

Added new unit tests for control-plane manager kubelet liveness checks, and new e2e tests for daemonset rendering.

@openshift-ci

openshift-ci Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kwohlfahrt
Once this PR has been reviewed and has the lgtm label, please assign clobrano for approval. For more information see the Code Review Process.

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

@openshift-ci

openshift-ci Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Hi @kwohlfahrt. Thanks for your PR.

I'm waiting for a medik8s 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.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added configurable node address preferences for kubelet health checks.
    • Supports NodeName, hostname, DNS, and IP address types, with fallback ordering.
    • Preserves NodeName behavior when no preference is configured.
    • Added support for architecture-specific protoc downloads on ARM64 systems.
  • Bug Fixes

    • Kubelet checks now try multiple configured addresses and provide clearer connection errors.

Walkthrough

Changes

Kubelet address selection

Layer / File(s) Summary
Address configuration and DaemonSet wiring
api/v1alpha1/..., config/crd/..., bundle/manifests/..., internal/controller/..., install/...
Adds optional PreferredAddressTypes configuration, CRD validation, deepcopy support, and PREFERRED_ADDRESS_TYPES DaemonSet wiring.
Ordered kubelet address checks
internal/controlplane/...
Parses configured address types, stores node addresses, and checks kubelet endpoints in preference order with fallback behavior covered by tests.

Architecture-aware protoc download

Layer / File(s) Summary
Architecture-specific protoc download
Makefile
Maps GOARCH values to protoc archive architectures and uses the mapped value for downloads.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: slintes, mshitrit

Sequence Diagram(s)

sequenceDiagram
  participant SelfNodeRemediationConfig
  participant Controller
  participant DaemonSet
  participant Manager
  participant KubernetesNode
  participant Kubelet

  SelfNodeRemediationConfig->>Controller: Set PreferredAddressTypes
  Controller->>DaemonSet: Render PREFERRED_ADDRESS_TYPES
  DaemonSet->>Manager: Provide environment configuration
  Manager->>KubernetesNode: Read status.addresses
  Manager->>Kubelet: Try preferred addresses in order
  Kubelet-->>Manager: Return health response
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The Makefile change for downloading aarch64 protoc is unrelated to the linked kubelet address objective [#330]. Move the aarch64 protoc download change to a separate pull request, or link it to an issue that requires this build improvement.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes implement ordered kubelet address selection, preserve NodeName behavior by default, and add tests for the requested scenarios [#330].
Title check ✅ Passed The title clearly identifies the main change: using node status addresses for kubelet health checks.
Description check ✅ Passed The description explains configurable address selection, fallback behavior, tests, and the related Makefile change.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/controlplane/manager.go`:
- Around line 184-205: Update isKubeletServiceRunningOnAddress to build the
kubelet endpoint with net.JoinHostPort(address, manager.kubeletPort) before
constructing the HTTPS URL, preserving valid formatting for both IPv4 and IPv6
addresses. Add a test using an IPv6 loopback listener to verify the address is
contacted successfully.

In `@Makefile`:
- Around line 409-412: Update the PROTOC_ARCH mapping to translate GOARCH values
ppc64le, s390x, and 386 to ppcle_64, s390_64, and x86_32 respectively, or make
the Makefile fail early with a clear unsupported-architecture error for unmapped
values before the protoc download runs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8eb1c779-5525-4ec1-a7d2-a6cdc73857ea

📥 Commits

Reviewing files that changed from the base of the PR and between 08359bb and 93555dc.

📒 Files selected for processing (11)
  • Makefile
  • api/v1alpha1/selfnoderemediationconfig_types.go
  • api/v1alpha1/zz_generated.deepcopy.go
  • bundle/manifests/self-node-remediation.medik8s.io_selfnoderemediationconfigs.yaml
  • config/crd/bases/self-node-remediation.medik8s.io_selfnoderemediationconfigs.yaml
  • install/self-node-remediation-deamonset.yaml
  • internal/controller/selfnoderemediationconfig_controller.go
  • internal/controller/tests/config/selfnoderemediationconfig_controller_test.go
  • internal/controlplane/manager.go
  • internal/controlplane/manager_test.go
  • internal/controlplane/suite_test.go

Comment thread internal/controlplane/manager.go Outdated
Comment thread Makefile
@kwohlfahrt kwohlfahrt changed the title Kubelet node address Use node status.addresses for kubelet health-check Aug 3, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kwohlfahrt
kwohlfahrt force-pushed the kubelet-node-address branch from 05b17b1 to 1f44fdd Compare August 3, 2026 15:55
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.

Support getting kubelet address from status.addresses

1 participant