-
Notifications
You must be signed in to change notification settings - Fork 304
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
add timeout for polling NEG health status for pod readiness #834
Conversation
pkg/neg/readiness/reflector.go
Outdated
// 3. syncPod patches the neg readiness condition to be false | ||
reason = negNotReadyReason | ||
message = fmt.Sprintf("Waiting for pod to become healthy in at least one of the NEG(s): %v", negs) | ||
// check if the pod has been waiting for the endpoint to show up as Healthy in NEG for too long |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make things return early for the code to be easier to reason about
if len(negs) == 0 {
expectedCondition.Status = ...
expectedCondition... = ...
return r.ensurePodNegCondition(pod, expectedCondition)
}
and so forth (get rid of the else's)
pkg/neg/readiness/reflector_test.go
Outdated
{ | ||
desc: "timeout waiting for endpoint to become healthy in NEGs", | ||
mutateState: func() { | ||
//pod := generatePodWithTimestamp(testNamespace, podName, true, false, false, now.Truncate(unreadyTimeout)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete
Type: shared.NegReadinessGate, | ||
Reason: negReadyTimedOutReason, | ||
Status: v1.ConditionTrue, | ||
Message: fmt.Sprintf("Timeout waiting for pod to become healthy in at least one of the NEG(s): %v. Marking condition %q to True.", []string{"neg1", "neg2"}, shared.NegReadinessGate), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is pretty fragile, I guess it's ok since the code is so close the test
pkg/neg/readiness/reflector.go
Outdated
negReadyReason = "LoadBalancerNegReady" | ||
negNotReadyReason = "LoadBalancerNegNotReady" | ||
maxRetries = 15 | ||
negReadyReason = "LoadBalancerNegReady" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to document each of these
Addressed the comments. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bowei, freehan 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 |
Cherrypick #834 into release 1.6
prevent pod to be stuck in unready state due to misconfiguration