Skip to content

fix: misleading MissingCRDException exception #553

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,8 @@ public void start() throws OperatorException {
CustomResourceUtils.assertCustomResource(resClass, crd);
}

try {
DefaultEventSourceManager<R> eventSourceManager = new DefaultEventSourceManager<>(this);
controller.init(eventSourceManager);
} catch (MissingCRDException e) {
throwMissingCRDException(crdName, specVersion, controllerName);
}
DefaultEventSourceManager<R> eventSourceManager = new DefaultEventSourceManager<>(this);
controller.init(eventSourceManager);

if (failOnMissingCurrentNS()) {
throw new OperatorException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
import org.slf4j.LoggerFactory;

import io.fabric8.kubernetes.client.CustomResource;
import io.fabric8.kubernetes.client.KubernetesClientException;
import io.javaoperatorsdk.operator.MissingCRDException;
import io.javaoperatorsdk.operator.OperatorException;
import io.javaoperatorsdk.operator.processing.ConfiguredController;
import io.javaoperatorsdk.operator.processing.CustomResourceCache;
Expand Down Expand Up @@ -89,12 +87,6 @@ public final void registerEventSource(String name, EventSource eventSource)
// leave untouched
throw e;
}
if (e instanceof KubernetesClientException) {
KubernetesClientException ke = (KubernetesClientException) e;
if (404 == ke.getCode()) {
throw new MissingCRDException(null, null);
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@csviri @metacosm removed this because a 404 may also be the result of watching a resource by name or in a namespace that does not exists so assuming 404 is only when a CRD is missing seems wrong

throw new OperatorException("Couldn't register event source named '" + name + "'", e);
} finally {
lock.unlock();
Expand Down