Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[node-agent] Introduce hostname-check controller #9280

Merged
merged 3 commits into from
Feb 28, 2024

Conversation

rfranzke
Copy link
Member

@rfranzke rfranzke commented Feb 28, 2024

How to categorize this PR?

/area usability
/kind bug

What this PR does / why we need it:
With this PR, a new hostname-check controller is introduced. It periodically (each 30s) checks if the hostname of the node gardener-node-agent runs on has changed compared to what it has read during its start-up. If a change is detected, it calls the cancel function of the root context, leading to a termination and an eventual restart of the gardener-node-agent systemd unit.

Motivation: We have seen cases where the hostname has changed for some nodes. Without this, gardener-node-agent will stuck forever in

if node == nil {
log.Info("Waiting for Node to get registered by kubelet, requeuing")
return reconcile.Result{RequeueAfter: 5 * time.Second}, nil
}
until it gets restarted. In addition, the hostname is used to compute a label selector predicate here:
nodePredicate, err := predicate.LabelSelectorPredicate(metav1.LabelSelector{MatchLabels: map[string]string{corev1.LabelHostname: hostName}})
if err != nil {
return fmt.Errorf("failed computing label selector predicate for node: %w", err)
}

Which issue(s) this PR fixes:
Part of #8023
Follow-up of #9114

Special notes for your reviewer:
/cc @oliver-goetz @ialidzhikov

Release note:

`gardener-node-agent` now terminates itself (leading to a restart of its `systemd` unit) in case it determines that the hostname of its node has changed.

rfranzke and others added 2 commits February 28, 2024 13:55
Co-Authored-By: Oliver Götz <47362717+oliver-goetz@users.noreply.github.com>
Co-Authored-By: Oliver Götz <47362717+oliver-goetz@users.noreply.github.com>
@gardener-prow gardener-prow bot added area/usability Usability related kind/bug Bug cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 28, 2024
Co-Authored-By: Oliver Götz <47362717+oliver-goetz@users.noreply.github.com>
@rfranzke
Copy link
Member Author

/cherry-pick release-v1.89

@gardener-ci-robot
Copy link
Contributor

@rfranzke: once the present PR merges, I will cherry-pick it on top of release-v1.89 in a new PR and assign it to you.

In response to this:

/cherry-pick release-v1.89

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/test-infra repository.

@rfranzke
Copy link
Member Author

/cherry-pick release-v1.88

@rfranzke
Copy link
Member Author

/cherry-pick release-v1.87

@gardener-ci-robot
Copy link
Contributor

@rfranzke: once the present PR merges, I will cherry-pick it on top of release-v1.88 in a new PR and assign it to you.

In response to this:

/cherry-pick release-v1.88

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/test-infra repository.

@gardener-ci-robot
Copy link
Contributor

@rfranzke: once the present PR merges, I will cherry-pick it on top of release-v1.87 in a new PR and assign it to you.

In response to this:

/cherry-pick release-v1.87

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/test-infra repository.

@oliver-goetz
Copy link
Member

awesome 🚀
/lgtm
/approve

@gardener-prow gardener-prow bot added the lgtm Indicates that a PR is ready to be merged. label Feb 28, 2024
Copy link
Contributor

gardener-prow bot commented Feb 28, 2024

LGTM label has been added.

Git tree hash: 16191e75c27071003c52c203b1ad39cd721a020d

Copy link
Contributor

gardener-prow bot commented Feb 28, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: oliver-goetz

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

The pull request process is described here

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

@gardener-prow gardener-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 28, 2024
@gardener-prow gardener-prow bot merged commit 2e1feec into gardener:master Feb 28, 2024
17 checks passed
@gardener-ci-robot
Copy link
Contributor

@rfranzke: new pull request created: #9286

In response to this:

/cherry-pick release-v1.89

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/test-infra repository.

@gardener-ci-robot
Copy link
Contributor

@rfranzke: new pull request created: #9287

In response to this:

/cherry-pick release-v1.88

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/test-infra repository.

@gardener-ci-robot
Copy link
Contributor

@rfranzke: new pull request created: #9288

In response to this:

/cherry-pick release-v1.87

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/test-infra repository.

@rfranzke rfranzke deleted the gna/hostname-checker branch February 28, 2024 16:44
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. area/usability Usability related cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. kind/bug Bug lgtm Indicates that a PR is ready to be merged. 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.

None yet

3 participants