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

Handle error while registering/deregistering target during load balancer update calls #997

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

jaydeokar
Copy link
Contributor

@jaydeokar jaydeokar commented Jul 17, 2024

What type of PR is this?
/kind bug

What this PR does / why we need it:
If the RegisterInstancesWithLoadBalancer fails for any reason during an LoadBalancer Update call, we do not throw the error and return nil. So we will never know if the target group registration passes or fails

For testing -
I tried to mock the ELB API as I wasn't able to hit the throttling every time.

I introduced a 50% chance of ELB API failing to register the target using Mocked return message

		val := rand.Int()
		if val%2 != 0 {
			klog.V(1).Infof("Not using Mocked call %s", loadBalancerName)
			_, err = c.elb.RegisterInstancesWithLoadBalancer(registerRequest)
		} else {
			klog.V(1).Infof("Using Mocked call %s", loadBalancerName)
			err = fmt.Errorf("mocked throttled call")
		}

		if err != nil {
			return err
		}
		klog.V(1).Infof("Instances added to load-balancer %s", loadBalancerName)

The events on the service

Warning  UnAvailableLoadBalancer   6m31s                 service-controller  There are no available nodes for LoadBalancer
  Warning  UpdateLoadBalancerFailed  2m34s                 service-controller  Error updating load balancer with new hosts [i-035ae0c5cd612d191 i-05560870005eef14b i-0661ad74a5ae13914 i-0a48dd4251b3e24d3] [node names limited, total number of nodes: 4], error: mocked throttled call
  Normal   UpdatedLoadBalancer       2m6s (x6 over 6m58s)  service-controller  Updated load balancer with new hosts
  Warning  UpdateLoadBalancerFailed  53s                   service-controller  Error updating load balancer with new hosts [i-00153b6992defc5d0 i-035ae0c5cd612d191 i-05560870005eef14b i-0661ad74a5ae13914 i-0a48dd4251b3e24d3 i-0cc2ee458bb7db682] [node names limited, total number of nodes: 6], error: mocked throttled call
  Warning  SyncLoadBalancerFailed    28s (x6 over 2m30s)   service-controller  Error syncing load balancer: failed to ensure load balancer: mocked throttled call
  Normal   EnsuringLoadBalancer      8s (x9 over 13m)      service-controller  Ensuring load balancer
  Normal   EnsuredLoadBalancer       8s (x3 over 13m)      service-controller  Ensured load balancer

This shows that the controller retries and reconciles again in case of failures.

The logs in the controller shows the new warn message that was added

W0729 21:20:19.689788       1 aws.go:3016] Error registering/deregistering instances with the load balancer: "mocked throttled call"
I0729 21:20:19.747638       1 event.go:389] "Event occurred" object="ui/ui-nlb-11" fieldPath="" kind="Service" apiVersion="v1" type="Warning" reason="UpdateLoadBalancerFailed" message="Error updating load balancer with new hosts [i-00153b6992defc5d0 i-035ae0c5cd612d191 i-05560870005eef14b i-0661ad74a5ae13914 i-0a48dd4251b3e24d3 i-0cc2ee458bb7db682] [node names limited, total number of nodes: 6], error: mocked throttled call"

Which issue(s) this PR fixes:
N/A

Fixes #

Special notes for your reviewer:
N.A

Does this PR introduce a user-facing change?:
N/A

Fixes an bug with UpdateLoadBalancer call where any failure in RegisterInstances API to ELB is always returned as success

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 17, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If cloud-provider-aws contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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 requested review from hakman and nckturner July 17, 2024 20:56
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jul 17, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @jaydeokar!

It looks like this is your first PR to kubernetes/cloud-provider-aws 🎉. 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/cloud-provider-aws 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 the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 17, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @jaydeokar. 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/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 17, 2024
@M00nF1sh
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 Jul 17, 2024
@M00nF1sh
Copy link
Contributor

/approve
/lgtm

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cartermckinnon, M00nF1sh

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 17, 2024
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 18, 2024
@jaydeokar jaydeokar changed the title Handle error while registring/deregistring target during load balancer update calls Handle error while registering/deregistering target during load balancer update calls Jul 18, 2024
@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 Jul 26, 2024
pkg/providers/v1/aws.go Outdated Show resolved Hide resolved
@jayanthvn
Copy link

/lgtm

@k8s-ci-robot
Copy link
Contributor

@jayanthvn: changing LGTM is restricted to collaborators

In response to this:

/lgtm

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 release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jul 29, 2024
@kmala
Copy link
Member

kmala commented Jul 29, 2024

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 29, 2024
@k8s-ci-robot k8s-ci-robot merged commit 3558394 into kubernetes:master Jul 29, 2024
11 checks passed
k8s-ci-robot added a commit that referenced this pull request Jul 30, 2024
…-upstream-release-1.29

Automated cherry pick of #997: Handle error while registering/deregistering target during
k8s-ci-robot added a commit that referenced this pull request Jul 30, 2024
…-upstream-release-1.30

Automated cherry pick of #997: Handle error while registering/deregistering target during
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

6 participants