-
Notifications
You must be signed in to change notification settings - Fork 104
Add k8s_exec module to execute command through the API #14
Add k8s_exec module to execute command through the API #14
Conversation
(Just noting that the test failures here are due to upstream issues in the ansible-base repository; the issues should hopefully be cleared up by end of week, and then one of the maintainers can re-run the GitHub Actions workflow to see if it passes.) Also, I would like to have a test or two using |
bd74b9a
to
b803781
Compare
@geerlingguy how are we doing the tests? If it's the same way as ansible/ansible then it won't work because it's just spinning up an API server, no containers are actually being run. We should probably rewrite the tests to make use of |
@fabianvf - Ah, in that case yes. And I'd say #10 is super-necessary in that case, to make our test coverage way nicer. I know you had ansible/ansible#61466 lined up in ansible/ansible... time to pull the trigger? (Though we'd still need the change for ansible-test to work—but I might be able to pummel that through). (We can also consider using Molecule, so we drop the dependency on ansible-test / ansible/ansible.) |
yeah, that could do it, we could also just move to using the official
edit: We should probably move the discussion to #10, |
@fabianvf - I like that approach (using official CNCF kind). Do you have time to work on that? Otherwise I may be able to work on it next week. Just don't want to duplicate efforts! |
@geerlingguy I'll be out on PTO next week so go for it! I'm happy to help out when I get back though. The new |
@TristanCacqueray you could still do something like what I've done for the k8s_log module, where I added tests and verified locally but didn't import them, so they won't be run in CI: https://github.com/ansible-collections/kubernetes/pull/16/files#diff-31a24fedeb58002db40bc88400eec0feR1 |
@TristanCacqueray - If you get a chance, can you rebase, just to make sure tests pass? I'm still working on the new kind-cluster-based tests, but at least the tests should pass since #13 is resolved. |
b4f2e88
to
a1f6de7
Compare
Codecov Report
@@ Coverage Diff @@
## master #14 +/- ##
=======================================
Coverage 43.28% 43.28%
=======================================
Files 3 3
Lines 536 536
Branches 109 109
=======================================
Hits 232 232
Misses 261 261
Partials 43 43
Continue to review full report at Codecov.
|
Is there an easy way to get to the failed task in those check results? |
@geerlingguy @fabianvf the pod creation (needed to test k8s_exec) is failing because of |
@TristanCacqueray - Go ahead and remove from |
056db60
to
13a7d10
Compare
@TristanCacqueray - After #22 was merged, there's now a KinD cluster environment managed by Molecule—can you add your integration test there (add in tasks, with a reference from playbook.yml to it)? |
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
13a7d10
to
ea0326e
Compare
@geerlingguy ok, ea0326e adds the integration test to molecule. |
LGTM! |
Finally, thanks! I haven't follow what is a collection, would you mind sharing the instructions how to use that module now? e.g. a playbook or ansible.cfg... |
@TristanCacqueray - This project's README file has instructions for using the collection in your playbook—in Ansible 2.10, the k8s modules will be moving out of the ansible/ansible project and instead will come from this collection (though there will be a distribution of Ansible that includes them, copied over from this collection). But basically, you can do the following to use the collection (and your shiny new module):
Then in your playbook, add the section:
Alternatively you can drop the |
(Note that the above requires at least Ansible 2.8.) |
@geerlingguy alright, that works, thanks again. |
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: #7