Commit Graph

108 Commits

Author SHA1 Message Date
abikouo
46494a18bd Revert "k8s ability to wait on arbitrary property (#105)" (#133)
This reverts commit 4ccb15d4ad.
2021-06-15 14:32:21 +02:00
abikouo
4ccb15d4ad k8s ability to wait on arbitrary property (#105)
* missing implementation of jsonpath library

* not tested

* sanity

* save

* updates

* Update args_common.py

* lint validation

* fix

* Update k8s.py

* attribute should match for all

* select wait

* Revert "select wait"

This reverts commit a20a1f6f01.

* sanity

* Update molecule/default/tasks/waiter.yml

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>

* Update jsonpath_extractor.py

* Update k8s_wait_options.py

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-06-15 10:44:26 +02:00
abikouo
481521a09d k8s_scale - add option label_selectors and continue_on_error (#114)
k8s_scale suppport for label selector
2021-06-07 09:57:50 +02:00
Mike Graves
5b5777d202 Split JSON patch out into a new module (#99)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-05-24 18:05:48 +05:30
Abhijeet Kasurde
1f47931c7c helm: Add complex values example (#108) 2021-05-24 18:02:00 +05:30
Elliot Blackburn
e112417d4c Correct helm_info return type docs for app_version (#97) 2021-05-21 13:22:02 +05:30
abikouo
192cae1507 k8s - patch existing resource (#90)
* patch only

* add changelogs

* Rename 89-k8s-add-parameter-patch_only.yml to 90-k8s-add-parameter-patch_only.yml

* Update 90-k8s-add-parameter-patch_only.yml

* patch_only parameter changed to state=patched

* Update 90-k8s-add-parameter-patch_only.yml

* Update plugins/modules/k8s.py

Co-authored-by: Fabian von Feilitzsch <fabian@fabianism.us>

* Update molecule/default/tasks/patched.yml

Co-authored-by: John Mazzitelli <mazz@redhat.com>

* Update molecule/default/tasks/patched.yml

Co-authored-by: John Mazzitelli <mazz@redhat.com>

* sanity issue

Co-authored-by: Fabian von Feilitzsch <fabian@fabianism.us>
Co-authored-by: John Mazzitelli <mazz@redhat.com>
2021-05-19 11:03:11 +02:00
Mike Graves
01a0815e56 Replace openshift client with kubernetes client (#96)
* Replace openshift client with kubernetes client

This commit primarily just removes mentions of openshift from the docs
and updates the requirements. Most of the work to replace the client has
been done through the following commits:

edc48ee577
c214376cac
48c5170018
2b6a989cf9

* Add changelog fragment

* Update changelogs/fragments/96-replace-openshift-client.yaml

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>

* Update plugins/modules/k8s.py

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>

* Update plugins/modules/k8s_info.py

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>

* Update plugins/modules/k8s_service.py

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>

* Bump minimum kubernetes version to 12.0.0

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-05-06 14:44:17 -04:00
Mike Graves
2b6a989cf9 Replicate base resource for lists functionality (#89)
* Replicate base resource for lists functionality

This replicates specific functionality from the openshift client to more
reliably retrieve the base resource from a resource list.

* Add changelog fragment
2021-05-05 10:09:22 -04:00
abikouo
fc80540db5 drop python 2 support (breaking changes) (#86)
* drop python 2 support

* change log

* Update changelogs/fragments/86_drop_python2_support.yaml

Co-authored-by: Mike Graves <mgraves@redhat.com>

* Update k8s.py

Co-authored-by: Mike Graves <mgraves@redhat.com>
2021-05-04 18:07:22 +02:00
abikouo
e754a6cd31 `helm_plugin and helm_plugin_info remove unused parameter release_namespace` (#85)
* remove unused parameter release_namespace from documentation

* Update changelogs/fragments/85_helm_plugin.yaml

Co-authored-by: Mike Graves <mgraves@redhat.com>
2021-05-04 15:05:18 +02:00
abikouo
963aa3fbe6 support merge_type`json` (#83)
Fixes #54
2021-04-28 09:06:43 -04:00
abikouo
361061c727 k8s loop flattening for template argument (#49)
* repo migration

* Update and rename 411-k8s-loop-flattening-and-continue_on_error.yaml to 49-k8s-loop-flattening-and-continue_on_error.yaml

* Update plugins/modules/k8s.py

Co-authored-by: Mike Graves <mgraves@redhat.com>

* split into multiple lines

* linting

* Update .gitignore

* Update template.yml

* merge

* Update template.yml

* deep copy environment

* deepcopy

* lint

* remove useless comment

* multiple definition

* tests update

* jmespath

* Update ci.yml

* Update template.yml

Co-authored-by: Mike Graves <mgraves@redhat.com>
2021-04-22 19:28:07 +02:00
Gonéri Le Bouder
c516d7ecb9 k8s_exec: reuse existing connection (#76)
Initialize the CoreV1Api object with the existing Kubernetes connection.
2021-04-22 12:50:40 -04:00
Gonéri Le Bouder
9a529fc8f3 helm: accept context and validate_certs (#74)
I've got the following environment variable set:
- `K8S_AUTH_VERIFY_SSL=False`

Helm's `validate_certs` parameter fallback on this environment variable.
Which means, on my system, the `validate_certs` will already be set.

So we cannot make this parameter exclusive wih another one.
2021-04-22 10:30:38 -04:00
Abhijeet Kasurde
5a0f5d6b93 helm: handle multiline output (#64)
Fixes: #399

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-04-20 12:07:28 +05:30
abikouo
8cee069ff1 Fix apis being overwritten when using k8s_cluster_info (#47)
* Update and rename 389-fix-apis-being-overwritten-in-k8s_cluster_info.yaml to 41-fix-apis-being-overwritten-in-k8s_cluster_info.yaml

* Update changelogs/fragments/41-fix-apis-being-overwritten-in-k8s_cluster_info.yaml

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-04-19 09:05:13 -04:00
Mike Graves
ba586a8ed8 Rename from community.kubernetes to kubernetes.core (#6)
* Rename from community.kubernetes to kubernetes.core

This goes through and renames community.kubernetes to kubernetes.core.
Most of this was generated from the downstream build script that was
used on the community repository, plus whatever hand edits I could find
that were needed.

The downstream build and test process has also been removed as this
repository is now the downstream repository.

* Fix CONTRIBUTING.md
2021-04-08 08:48:27 -04:00
Timothy Appnel
5fc3dd02bf Adds a wait example to k8s.py (#386)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-03-18 14:48:07 +05:30
Gonéri Le Bouder
39660dd40e refactoring for ansible_module.turbo integration (#313)
* refactoring for ansible_module.turbo integration

This refactoring prepares the integration of `ansible_module.turbo`

- Delay the loading of `common.py`, move the shared structure in
  `args_common`.
- Avoid the use of one single object per module, this to increase the
  amount of Python structure that we can cache.
- Cache the Kubernetes client.

See: https://github.com/ansible-collections/community.kubernetes/pull/270

Co-authored-by: Jill Rouleau <jill.rouleau@bespokess.com>
2021-03-16 17:16:18 -04:00
Abhijeet Kasurde
1e511113a5 k8s_auth: remove module (#376) 2021-03-08 22:54:22 +05:30
Mike Graves
a4ac078625 Add support for helm template (#368)
* Add support for helm template
This commit adds basic support for helm template. The functionality
allows one to either render a chart's templates to a specific directory,
or capture the rendered templates as a string of concatenated yaml
documents.
* Add changelog fragment
* Address PR feedback
* Set changed to true
2021-02-17 08:01:49 -05:00
Joshua Hügli
8f098b14f2 make has_plugin detection method more reliable (#362)
* fix has_plugin detection method
* use even better method :)
* add changelog fragment
* fix forgotten file extension
* Double Backticks ;)
* Add PR link to changelog
Co-authored-by: Mike Graves <mgraves@redhat.com>
2021-02-16 12:38:29 -05:00
Mike Graves
80b914021f Add skip_crds option to helm (#349)
This adds an option to skip the installation of CRDs when installing or
upgrading a chart.

Closes: #296
2021-02-09 09:51:10 +05:30
Mike Graves
981493dfb6 Add note about required permissions for k8s_exec (#361) 2021-02-08 19:42:13 -05:00
Abhijeet Kasurde
92e373239c k8s: Add example for download and apply manifest from URL (#359)
Fixes: #352

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-02-03 21:16:44 +05:30
Mike Graves
2640084143 Add optional support for helm diff (#355)
There are some cases where the existing module has difficulty
determining if an upgrade would result in changes. This can particularly
be a problem when changes are made to a local chart.

This adds optional support for helm diff. If the plugin is present it
will be used. Otherwise, the default implementation will be used and a
warning will be issued. One caveat: helm diff does not currently support
using a repo url, so the default implementation will be used in this
case, as well.

Closes: #248
2021-02-03 13:46:26 +05:30
Abhijeet Kasurde
86c5c446dd Make unused release_namespace parameter as optional (#358) 2021-02-03 13:45:25 +05:30
Gonéri Le Bouder
5a5ed79b89 Revert "helm - remove trailing whitespaces (#337) (#345)" (#346)
This reverts commit 003d802065.

See: https://github.com/ansible-collections/community.kubernetes/pull/345#issuecomment-760291333
2021-01-14 11:19:12 -05:00
Alina Buzachis
003d802065 helm - remove trailing whitespaces (#337) (#345)
Add remove_trailing_spaces() to remove trailing whitespaces for each helm_repository parameter.
2021-01-14 10:52:33 -05:00
Mike Graves
a9b8cc68d5 Add support for configuring garbage collection (#334)
* Add support for configuring garbage collection

This surfaces deleteOptions functionality in a top-level delete_options
parameter.

* Add changelog fragment

* Remove kind and apiVersion from delete_options

* Add release version to docs
2021-01-12 14:17:18 -05:00
Gonéri Le Bouder
01ee3e603c helm: 'changed' flag takes 'values' in consideration (#332)
Return `changed` `False` is the `values_files` match the `values` of
the existing deployment.

Closes: #274
2021-01-05 13:53:20 -06:00
Gonéri Le Bouder
221631c06a helm: add support for the K8S_ envvars (#319)
Add support for:

- K8S_AUTH_HOST
- K8S_AUTH_API_KEY
- K8S_AUTH_VERIFY_SSL
- K8S_AUTH_SSL_CA_CERT

This commit also refactor the way we pass K8S related configuration to `helm`:

All the calls are now done in a new module_utils module (`helm.py`).
The handling of the `kube_*` variables has also been moved in this new
module.

We need https://github.com/helm/helm/pull/8622 to be able to ignore the
certificate validation. As a workaround, the generate a temporary
kubeconfig configuration file.

Closes: #279
2020-12-11 11:41:08 -05:00
Gonéri Le Bouder
befc0f6853 helm and helm_info: adjust the name of two parameters (#324) 2020-12-10 09:28:27 +05:30
Gonéri Le Bouder
486a179c7a add 3 doc-default-does-not-match-spec errors (#325)
Address the following error with the test-suite:

- plugins/modules/k8s.py:0:0: doc-default-does-not-match-spec: Argument 'append_hash' in argument_spec defines default as (False) but documentation defines default as (None)
- plugins/modules/k8s.py:0:0: doc-default-does-not-match-spec: Argument 'apply' in argument_spec defines default as (False) but documentation defines default as (None)
- plugins/modules/k8s_service.py:0:0: doc-default-does-not-match-spec: Argument 'apply' in argument_spec defines default as (False) but documentation defines default as (None)
2020-12-08 09:20:20 +05:30
Abhijeet Kasurde
86ce0b5556 add changelog and version added information. (#312)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-11-30 12:46:02 +05:30
Fabian von Feilitzsch
2474ef1b2c k8s_info now outputs whether the api was found (#308) 2020-11-30 10:26:54 +05:30
Abhijeet Kasurde
e2d4cff952 Updated chart repo URLs (#297) 2020-11-10 14:13:09 -05:00
Abhijeet Kasurde
77e48d0c97 helm: return correct information in check mode (#281)
Fixes: #280

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-10-22 15:22:17 -05:00
Abhijeet Kasurde
d03823794e helm_repository: Add information about 'RETURN' (#269)
Fixes: #256

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-10-12 11:20:53 -04:00
Jeff Geerling
cbd3a2554e Issue #260: Sanity test 'compile' failing because of positional args. (#261)
* Issue #260: Sanity test 'compile' failing because of positional args.

* Issue #260: Run integration tests on older Python 3.6 still.

* Issue #260: Add changelog fragment.
2020-10-09 10:17:52 -05:00
Timothy Appnel
f0dacc083c Embedded docs clarifications and refinements. (#258)
* Another embedded docs clarifications in k8s_rollback

* Embedded docs clarification in helm_pljugin_info

* Embedded docs clarification in k8s

* More embedded docs clarification in k8s inventory plugin

* Fixed markdown formatting to RST in k8s_rollback
2020-10-08 15:32:54 -05:00
Timothy Appnel
ef256060f1 Embedded docs clarification in k8s_rollback (#255) 2020-10-08 13:10:06 -04:00
Timothy Appnel
5fa34b6b60 Embedded docs clarification in helm_plugin 2020-10-08 13:09:21 -04:00
Timothy Appnel
784347703b Embedded docs clarification in k8s_cluster_info 2020-10-08 12:33:20 -04:00
Nathan Loika
50c82056b3 Add appVersion check to Helm (#247)
When upgrading a Helm release include the chart's appVersion in the idempotence check. Fixes #246
2020-10-07 16:40:59 -04:00
Julien Huon
0377a892d5 k8s_rollback: new module (#26)
This module allows user to rollback deployment and daemonsets.

Signed-off-by: Julien Huon <julien@huon.email>
2020-10-07 10:07:47 +05:30
Jeff Geerling
fc1f4e5ffd helm: Support for single or multiple values files (#236 was #136) 2020-10-05 13:19:36 -04:00
Gerald Spencer
7946b398a7 Return status in check mode (#192)
It is useful to return both the current values of the release, as well as the proposed values.
2020-09-29 14:09:43 -04:00
Abhijeet Kasurde
5de49373b7 k8s_cluster_info: new module (#160)
Get information about k8s APIs

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-09-28 14:01:37 +05:30