-
-
Notifications
You must be signed in to change notification settings - Fork 389
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
WIP: Kubernetes support #416
base: 1.x
Are you sure you want to change the base?
Conversation
518dfb6
to
899d901
Compare
Codecov Report
@@ Coverage Diff @@
## master #416 +/- ##
==========================================
- Coverage 92.73% 91.56% -1.17%
==========================================
Files 105 106 +1
Lines 6192 6307 +115
==========================================
+ Hits 5742 5775 +33
- Misses 450 532 +82
Continue to review full report at Codecov.
|
I don't know enough about Python 2 to fix this, please suggest. |
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.
@leahneukirchen apologies for taking so long to get back to you on this - keen for this to be merged as an additional connector - it's never occurred to me the idea of targeting a live K8s pod.
Looks great so far, left a couple of comments!
Sidenote: it should be possible to use setuptools entrypoints such that external packages can add connectors without being part of pyinfra itself.
9b40b99
to
5186173
Compare
Not sure why this is failing now, seems unrelated to my PR. |
This appears to be a linting issue now; ./pyinfra/api/connectors/kubernetes.py:64:32: C812 missing trailing comma
./pyinfra/api/connectors/kubernetes.py:69:42: C812 missing trailing comma
./pyinfra/api/connectors/kubernetes.py:75:34: C812 missing trailing comma
./pyinfra/api/connectors/kubernetes.py:216:19: C812 missing trailing comma
./pyinfra/api/connectors/kubernetes.py:219:63: Q000 Remove bad quotes The verbose pytest output has basically buried it way up in the log - I've pushed f45ea1a to stop this happening in future! |
Argh, I ran a local copy of flake8, not the one in the venv. Thanks! |
5186173
to
b89c030
Compare
Great! A suggestion is allow to pass the |
c498185
to
d899763
Compare
025e1db
to
f5ad1f7
Compare
5a9e175
to
f01ba12
Compare
This is still a really cool idea but should definitely be managed as an external project. v2 & upcoming v3 both support this via setuptools entrypoints, I am going to provide an example project as part of the upcoming v3 release cycle at which point I shall link it here and close this PR. |
I'm not using k8s currently, but still think it could be useful to somebody. |
This is a WIP to create a Kubernetes connector and helpers for dynamic inventory.
The Kubernetes connector is modeled after the Docker connector and uses
kubectl exec
(andkubectl cp
). Pods can be specified as@kubernetes/namespace/podname
.The dynamic inventory provides a method
get_pods
that can select pods by Kubernetes labels.There are no docs or tests yet, first trying to see if this interests you. Else, I would also maintain this as an external project, but adding third-party connectors doesn't seem to be supported.