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

Instance Group Manager does not remove nodes with empty string in the zone field #2658

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

08volt
Copy link
Contributor

@08volt 08volt commented Sep 3, 2024

Updates Instance Group Manager to Support Nodes with Empty Zones

Bug:

The Load Balancer controller removes nodes with an empty string in the Zone field, even when they are already in the correct instance group.

Solution:

Prevents the removal of nodes with an empty string in the Zone field.

Details:

  • Nodes can have an empty Zone if it hasn't been assigned yet.
  • The Zone was previously retrieved from the providerID using a regular expression (var providerIDRE = regexp.MustCompile(^+ "gce" +://([^/]+)/([^/]+)/([^/]+)$)) that didn't account for empty Zones, leading to errors.
  • The regular expression has been updated to: var providerIDRE = regexp.MustCompile(^+ "gce" +://([^/]+)/([^/]*)/([^/]+)$) to support empty Zones.
  • Instances where the code checked for errors have been updated to also handle empty Zones.
  • The Instance Group Manager has been updated to not remove nodes without an assigned Zone.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 3, 2024
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 3, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @08volt. Thanks for your PR.

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

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.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 3, 2024
@08volt
Copy link
Contributor Author

08volt commented Sep 3, 2024

@cezarygerard

@cezarygerard
Copy link
Contributor

/lgtm

@cezarygerard
Copy link
Contributor

/hold

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 3, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 08volt, cezarygerard

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

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Sep 3, 2024
@cezarygerard
Copy link
Contributor

/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 Sep 3, 2024
@cezarygerard
Copy link
Contributor

my lgtm was accidental, for now

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 4, 2024
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@08volt 08volt force-pushed the empty-zones branch 3 times, most recently from 1f151d8 to 726a46f Compare September 4, 2024 12:55
pkg/instancegroups/manager.go Outdated Show resolved Hide resolved
pkg/instancegroups/manager.go Outdated Show resolved Hide resolved
pkg/utils/zonegetter/zone_getter.go Outdated Show resolved Hide resolved
@08volt 08volt force-pushed the empty-zones branch 2 times, most recently from fb05798 to 0b2fcc6 Compare September 4, 2024 14:29
Nodes can have empty zone if it not has been assigned yet.

The zone was retrieved from providerID using the following Regular Expression Matching and taking the second match: ```var providerIDRE = regexp.MustCompile(`^` + "gce" + `://([^/]+)/([^/]+)/([^/]+)$`)```

In the case of empty zone it was generating an Error.
In order to allow an empty zone to match the Regular Expression, it has been updated to:

```var providerIDRE = regexp.MustCompile(`^` + "gce" + `://([^/]+)/([^/]*)/([^/]+)$`)```

After that, I updated all the instances where the code was checking the error, to check also for the empty zone.

I updated the Instance Group Manager to not remove the nodes which do not have a zone assigned.
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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

4 participants