-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Add k8s_exec module to execute command through the API #55029
Conversation
The test
The test
The test
The test
The test
The test
The test
The test
|
The test
The test
|
This is really awesome. Out of curiousity, did you consider instead writing a This is pretty clean and simple though so I don't have any personal opposition to it, but I'm curious to hear @willthames more expert opinion. https://docs.ansible.com/ansible/latest/plugins/connection/kubectl.html |
I haven't consider a connection plugin because that exec api is rather limited and it will be hard to use it with generic task like Another improvement to consider is to use a lookup('k8s', kind='Pod') object as a k8s_exec argument. |
Makes sense to me |
shipit |
bot_status |
Componentslib/ansible/modules/clustering/k8s/k8s_exec.py Metadatawaiting_on: maintainer |
3a5504b
to
60ba246
Compare
b4ce4e5
to
9c36f8d
Compare
hum, the failed job doesn't seem related ( |
The last commits fixed the issue for me in my standalone test playbook. I'm checking my operator's RBAC and it seems like for the pod in question (which it's trying to exec on), it should have access:
But it is probably not related to this module's code, so the module itself gets the green light from me. Test failure looks unrelated and probably just needs a re-run. |
@geerlingguy thank you for the feedback. About your RBAC, iiuc the pods exec api is in the v1 apiGroups, or the rule could use: |
@TristanCacqueray ah, thanks. Digging further, I found I had to change my rule for pods to be like so:
Found in this comment: kubernetes-client/python#690 (comment) Strangely, though, I'm now getting the following error from
|
The test
|
Something is broken indeed, I now also get |
@TristanCacqueray I think that's an issue with the proxy that the Ansible Operator creates, it seems for whatever reason it is unable to handle the |
@fabianvf that would make sense. IIRC the kubectl clients uses the legacy |
@TristanCacqueray - I can confirm that it's an issue with the Operator proxy as @fabianvf states; see operator-framework/operator-sdk#2204 for the downstream bug report. |
@TristanCacqueray - The Kubernetes-related modules and plugins have been moved to a new Collection repo: https://github.com/ansible-collections/kubernetes As I've already been testing this module thoroughly related to my work on some operators (it is extremely useful for many situations, and will be for more once that operator-sdk proxying issue is resolved, I for one am +1 to shipping it quickly once submitted! |
This change adds a new module to execute command in a container through the API: https://docs.okd.io/latest/dev_guide/executing_remote_commands.html#protocol Related: ansible/ansible#55029 Closes: ansible-collections#7
@geerlingguy sure thing, here is the initial draft: ansible-collections/community.kubernetes#14 |
This change adds a new module to execute command in a container through the API: https://docs.okd.io/latest/dev_guide/executing_remote_commands.html#protocol Related: ansible/ansible#55029 Closes: ansible-collections#7
This change adds a new module to execute command in a container through the API: https://docs.okd.io/latest/dev_guide/executing_remote_commands.html#protocol Related: ansible/ansible#55029 Closes: ansible-collections#7
This change adds a new module to execute command in a container through the API: https://docs.okd.io/latest/dev_guide/executing_remote_commands.html#protocol Related: ansible/ansible#55029 Closes: ansible-collections#7
This change adds a new module to execute command in a container through the API: https://docs.okd.io/latest/dev_guide/executing_remote_commands.html#protocol Related: ansible/ansible#55029 Closes: ansible-collections#7
This now lives in ansible-collections/community.kubernetes#14 |
SUMMARY
This change adds a new module to execute command in a container through the API:
https://docs.okd.io/latest/dev_guide/executing_remote_commands.html#protocol
ISSUE TYPE
COMPONENT NAME
k8s_exec
ADDITIONAL INFORMATION
Test playbook:
Results in: