Commit Graph

386 Commits

Author SHA1 Message Date
Abhijeet Kasurde
8182a3afd4 Added docs for the collection (#50) 2021-04-12 22:25:10 +05:30
Abhijeet Kasurde
4aa983509b Remove old changelog fragment files (#51) 2021-04-12 18:32:47 +05:30
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
Andrew Klychkov
a55edac38f Add ignore.txt for 2.12 (#7) 2021-04-08 14:00:02 +05:30
Mike Graves
d6f251173e Add unit tests to CI (#407)
* Add unit tests to CI

The unit tests were not being run during CI. This adds a GitHub Action
for it.

* Add changelog fragment
2021-04-05 09:39:01 -04:00
Abhijeet Kasurde
c9157ce713 k8s: fix get_api_client usage in inventory plugin (#395)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-03-26 14:36:47 -04:00
Mike Graves
34e6e09fb8 Restrict molecule version to <3.3.0 (#396)
The 3.3.0 version of molecule broke the test suite. Restricting the
version until we can either fix upstream or decide on the best
workaround.
2021-03-25 09:22:59 +05:30
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
2f6fae322c Removed openshift inventory for community.kubernetes (#377) 2021-03-16 18:43:07 +05:30
Mike Graves
af928a255f Remove old openshift integration tests (#382) 2021-03-16 09:05:52 -04:00
Mike Graves
07915509c1 Remove deprecated KubernetesRawModule (#379)
* Remove deprecated KubernetesRawModule

* Add changelog fragment
2021-03-16 09:05:07 -04:00
Mike Graves
c4182ad84f Fix helm ignoring given context (#387)
Fixes: #385
2021-03-15 10:04:06 +05:30
Timothy Appnel
af41efdf46 Fix typo in README.md
helm_template had a typo in it.
2021-03-08 18:49:45 -05:00
Abhijeet Kasurde
1e511113a5 k8s_auth: remove module (#376) 2021-03-08 22:54:22 +05:30
Timothy Appnel
8caca90c11 Update README.md with helm_template module under Included Content (#375) 2021-03-04 19:43:42 +05:30
Mike Graves
5eb280f35a Prep for 1.2 release (#370) 2021-02-19 13:02:07 -05:00
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
Abhijeet Kasurde
dc80c418e9 Update minimum version of Ansible required (#366)
https://github.com/ansible-collections/community.kubernetes/pull/276
is backported to 2.9.17
Any Ansible version lesser than this will not work due to
Kubernetes-python compatibility issues.

Fixes: #314
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-02-16 15:05:53 -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
9f7b6fb3ff Honor wait_timeout in k8s_info for missing resource (#360)
* Honor wait in k8s_info for missing resource

The wait logic in the k8s_info module immediately returns when no
resources are found, regardless whether a wait_timeout has been
specified. This expands the logic to wait when a name has been provided.
The case this is specifically meant to address is when querying for a
resource that is indirectly created by another resource, for example, a
pod created by a deployment or an operator.

The existing logic in every other case should remain as it was before.
This means if a query might return more than one resource--all pods with
some label, for example--the module will return immediately if no pods
are found, even if a wait_timeout has been provided.

* Add changelog fragment
2021-02-16 10:19:22 -07: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
Mike Graves
b26afc3518 Fix Secret check_mode (#343)
When adding a Secret and using stringData, check_mode will always show
changes. An existing resource fetched from Kubernetes will have the
stringData already base64 encoded and merged into the data attribute.
This change performs the base64 encoding and merging with the provided
definition to more accurately represent the current state of the
cluster.

This change only affects check_mode. When making any changes to the
cluster the stringData is passed along as provided in the definition.

Closes #282.
2021-01-14 11:05:11 -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
Abhijeet Kasurde
9059f2c526 k8s: Handle ValueError raised (#330) 2021-01-12 21:38:58 +05:30
Gonéri Le Bouder
a6cb6c4821 action/k8s_info: refactoring to simplify the code base (#331)
Break down the long `run()` method to simplify the readability of the
plugin.
2021-01-11 11:04:11 +05:30
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
Abhijeet Kasurde
5d3e465672 k8s: handle remote src and kubeconfig (#320)
* k8s: Add a parameter remote_src

remote_src is boolean parameter to specify if
src file is located on remote node or Ansible Controller.

Fixes: #307

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

* remove parameters

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-12-10 10:58:33 -07: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
Abhijeet Kasurde
549dd262d2 Loosen strictness for boolean (#326) 2020-12-08 20:01:44 +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
4b447cc301 CI fix (#322)
Fixes: #316
2020-12-04 12:33:10 +05:30
Gonéri Le Bouder
11191e40b0 molecule: conditional statements should not include jinja2 templating (#305)
This address the following warning:
```
[WARNING]: conditional statements should not include jinja2 templating
delimiters such as {{ }} or {% %}. Found: {{ scale_down_no_wait_pods.resources
| length == 1 }
```
2020-12-02 14:10:07 -05:00
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
Gonéri Le Bouder
8f14bf6c46 The type of wait_condition.status is str (#310)
The `wait_condition.status` key is a string.

- Use actually string in the documentation
- Use core's `boolean()` method to convert the value internally to
  boolean
2020-11-25 13:01:38 -06:00
Abhijeet Kasurde
4d94cb9439 tests: remove old openshift tests (#311)
Older openshift test cases are no longer valid for this
collection. Removing them for now.

Fixes: #300

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-11-25 11:27:13 -06:00
Gonéri Le Bouder
1513bced36 test: k8s's merge_type expect a list (#309)
The `merge_type` parameter of `k8s` is a list, not a string.
2020-11-23 15:39:25 -05:00
Gonéri Le Bouder
fac0478293 molecule: clone the chart repos with depth=1 (#303) 2020-11-19 13:31:51 -05:00
Jeff Geerling
b97c5ce85b Update to latest version of kind action so kind cluster setup succeeds. (#306) 2020-11-18 11:32:02 -06:00
Abhijeet Kasurde
108efaf065 Properly format list in README.md (#302) 2020-11-11 14:39:25 +05:30
Abhijeet Kasurde
90a1c626a2 Fix CI (#301)
Missing variables in Chart local_path testing.
2020-11-11 10:29:10 +05:30
Gonéri Le Bouder
eff6759660 test: older_openshift_fail.yml fails with py3.7+ (#291)
The `older_openshift_fail.yml` test playbook fails with Python 3.7 because the old `kubernetes.client.apis.admissionregistration_api` module uses the new `async` keyword as a function parameter name. From: https://docs.python.org/3/whatsnew/3.7.html

Backwards incompatible syntax changes:

    `async` and `await` are now reserved keywords.

In this case, we get a `SyntaxError` exception instead of the expected `Failed to import the required Python library (openshift >= 0.7.2)`.
2020-11-10 14:27:23 -05:00