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
c7n kubernetes provider #2760
c7n kubernetes provider #2760
Conversation
The official Python client library for Kubernetes - https://github.com/kubernetes-client/python - which this work uses seems to have extensive unit tests. We should investigate what can be used. |
class resource_type(TypeInfo): | ||
group = 'Core' | ||
version = 'V1' | ||
enum_spec = ('list_namespace', 'items', {'watch': False}) |
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.
isn't watch: False
a default?
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.
yeah, watch shouldn't be necessary here
tools/c7n_kube/setup.py
Outdated
}, | ||
install_requires=[ | ||
"c7n", | ||
"kubernetes==6.0.0" |
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.
probably want to update to 7.0.0
@ewbankkit i think the operative word wrt to the client tests was 'seems' to.. in practice it looks like smoke and mirrors as the test files are generated and the contents empty afaics for every test file |
we can probably leverage some of the azure testing infrastructure here, both are to a common urllib3 adapter pattern, ie. reuse vcr here. not sure how it will play with the watch style method (websocket), but otherwise that should cover off on most api usage. |
tools/c7n_kube/c7n_kube/provider.py
Outdated
|
||
log = logging.getLogger('custodian.kube') | ||
|
||
@clouds.register('kube') |
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.
thoughts on kube
vs k8s
for the provider name, if we're going to use an abbreviation, i figure let's use the one common in that community.
hmm, looks like kubernetes client api is not compatible with python 3.7 due to use of async keyword. [update] resolved with upgrade to client lib version 7.0 |
renamed provider to k8s, after some discussion with hackathon team that contributed this, going to go ahead and merge as is. intent will be going forward backfilling on test infrastructure (reusing azure vcr/requests integration). |
work in progress from hackathon, still needs some testing infrastructure.