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

Check if k8s resources are supported in runReflectorUntil #3037

Merged
merged 1 commit into from
Jan 22, 2018

Conversation

rbruggem
Copy link
Contributor

@rbruggem rbruggem commented Jan 19, 2018

isResourceSupported checks whether a kubernetes resource is supported by the api server.
This ensures that, if the probe is unable to communicate with the api server, the call is retried until a true/false response.

If isResourceSupported returns false, ListAndWatch is not called and runReflectorUntil just exits.

Fixes #3027.

Tested with kubernetes v1.3.0 and v1.8.0.

case "jobs":
group = "batch/v1"
default:
return false, fmt.Errorf("Support check not available for resource %v", resource)

This comment was marked as abuse.

return store
}

// runReflectorUntil runs cache.Reflector#ListAndWatch in an endless loop.
// Errors are logged and retried with exponential backoff.

This comment was marked as abuse.

@@ -24,6 +24,8 @@ import (
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
)

const errResourceNotFound = "the server could not find the requested resource"

This comment was marked as abuse.

@rbruggem rbruggem force-pushed the failed-to-connect-to-api branch from 5799039 to fd31b15 Compare January 22, 2018 13:44
@rbruggem rbruggem requested a review from rade January 22, 2018 13:45
`isResourceSupported` checks whether a kubernetes resource is supported by the api server.
This ensures that, if the probe is unable to communicate with the api server, the call is retried until a true/false response.

If `isResourceSupported` returns false, `ListAndWatch` is not called and `runReflectorUntil` just exits.
@rbruggem rbruggem force-pushed the failed-to-connect-to-api branch from fd31b15 to 2f9e2fc Compare January 22, 2018 13:47
Copy link
Member

@rade rade left a comment

Choose a reason for hiding this comment

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

Nice!

@rbruggem rbruggem merged commit 2d26c72 into master Jan 22, 2018
@rbruggem rbruggem deleted the failed-to-connect-to-api branch January 22, 2018 14:18
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.

2 participants