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

Throwing exception for status pod that does not exist #294

Open
Bongani opened this issue Sep 26, 2019 · 0 comments
Open

Throwing exception for status pod that does not exist #294

Bongani opened this issue Sep 26, 2019 · 0 comments

Comments

@Bongani
Copy link

Bongani commented Sep 26, 2019

I have just came across a case, and would like to understand the concept behind this as it seems odd to me.

The case I had was doing a status check for pods to see if there running or not. Now when the pod is not running and status check is done, an exception is thrown at KubernetesClientImpl.scala:648. Which means a failed future.

This is in particular to me is odd, because the call it self was successful (check if a pod has a status), but instead of returning an exception the status of the pod should be None with UNKNOWN.

To deal with the exception I did this:

for { status <- pod.status phase <- status.phase } yield phase } recover { case err: K8SException if err.status.code.map(_ == 404).getOrElse(false) => None }

None, in my case will be translated into UNKNOWN by the caller.

To clarify my question would it not be better to return an UNKNOWN status for a pod that is not found when doing a status check?

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

No branches or pull requests

1 participant