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

Retry behavior for synchronous calls during initialization #2118

Merged
merged 4 commits into from
Jan 5, 2021

Conversation

rjeberhard
Copy link
Member

@rjeberhard rjeberhard commented Dec 23, 2020

As you know, we've been seeing fairly regular integration test failures for the ItIstio* series of tests. The tests fail because the operator fails to start being unable to connect to the Kubernetes master. In each case I analyzed, the operator failed just before the Istio Envoy proxy finished initialization.

Most operator calls are done using the async pattern, which has built-in delay and retry; however, the synchronous calls done during operator initialization do not have this functionality. Therefore, I've added a wrapper method that can do this retry. I've put it down at the CallBuilder level because this gave the easiest location to add the unit-test.

Creating this as draft so that you can take a look. I think I need to use some configured value for the retry delay rather than hardcoding 5 seconds.

Istio tests are clean with this change: https://build.weblogick8s.org:8443/job/weblogic-kubernetes-operator-kind-new/3454/console

try {
result = call.call();
complete = true;
} catch (RuntimeException re) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened if it is a RuntimeException but not an ApiException? Do we want to limit the number of retries or make it retry forever (hopefully the condition can be resolved)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll think about other exceptions... I didn't want to limit the number of retries here because the operator cannot go on until it can connect to the master and the operator will eventually be killed by the liveness probe.

@rjeberhard rjeberhard marked this pull request as ready for review January 4, 2021 23:12
result = call.call();
complete = true;
} catch (RuntimeException re) {
Throwable cause = re.getCause();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the ApiException ever get nested further down? Is there ever a case where you need to loop through the causes looking for ApiException?

LOGGER.warning(MessageKeys.EXCEPTION, cause);
}
} catch (Throwable t) {
LOGGER.warning(MessageKeys.EXCEPTION, t);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment here that we expect the liveness probe to cancel this process if it "retries forever". The next coder may not understand the assumption/expectation.

@rjeberhard rjeberhard merged commit 5812d44 into develop Jan 5, 2021
@rjeberhard rjeberhard deleted the owls-86461 branch January 5, 2021 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants