diff --git a/Makefile b/Makefile index 3f7a418436..b76f3af502 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # Also needs to be updated in galaxy.yml -VERSION = 2.4.0 +VERSION = 3.0.0 TEST_ARGS ?= "" PYTHON_VERSION ?= `python -c 'import platform; print(".".join(platform.python_version_tuple()[0:2]))'` diff --git a/README.md b/README.md index c02ffd4355..67993a06e0 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ You can also include it in a `requirements.yml` file and install it via `ansible --- collections: - name: kubernetes.core - version: 2.4.0 + version: 3.0.0 ``` ### Installing the Kubernetes Python Library diff --git a/changelogs/fragments/20230206-deprecate-k8s-inventory.yml b/changelogs/fragments/20230206-deprecate-k8s-inventory.yml deleted file mode 100644 index 01f4ddf403..0000000000 --- a/changelogs/fragments/20230206-deprecate-k8s-inventory.yml +++ /dev/null @@ -1,2 +0,0 @@ -deprecated_features: -- k8s - the ``k8s`` inventory plugin has been deprecated and will be removed in release 4.0.0 (https://github.com/ansible-collections/kubernetes.core/issues/31). diff --git a/changelogs/fragments/20231110-helm-quote-ref.yaml b/changelogs/fragments/20231110-helm-quote-ref.yaml deleted file mode 100644 index fd8af269c8..0000000000 --- a/changelogs/fragments/20231110-helm-quote-ref.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - helm - Put the chart_ref into quotes when running ``helm show chart``, ``helm upgrade`` and ``helm dependency update`` commands (https://github.com/ansible-collections/kubernetes.core/issues/653). diff --git a/changelogs/fragments/517-k8s-make-name-optional.yaml b/changelogs/fragments/517-k8s-make-name-optional.yaml deleted file mode 100644 index e7ef01de69..0000000000 --- a/changelogs/fragments/517-k8s-make-name-optional.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - k8s - add new option delete_all to support deletion of all resources when state is set to absent. (https://github.com/ansible-collections/kubernetes.core/issues/504) diff --git a/changelogs/fragments/575-helm-add-support-for-reuse_values-and-reset_values.yml b/changelogs/fragments/575-helm-add-support-for-reuse_values-and-reset_values.yml deleted file mode 100644 index 89abd455ed..0000000000 --- a/changelogs/fragments/575-helm-add-support-for-reuse_values-and-reset_values.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - helm - add reuse_values and reset_values support to helm module (https://github.com/ansible-collections/kubernetes.core/issues/394). diff --git a/changelogs/fragments/579-k8s_scale-fix-issue-with-scaling-statefulsets.yml b/changelogs/fragments/579-k8s_scale-fix-issue-with-scaling-statefulsets.yml deleted file mode 100644 index 8639fd303c..0000000000 --- a/changelogs/fragments/579-k8s_scale-fix-issue-with-scaling-statefulsets.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - k8s_scale - fix issue when scaling StatefulSets with updateStrategy=OnDelete (https://github.com/ansible-collections/kubernetes.core/issues/579). diff --git a/changelogs/fragments/583-k8s_scale-clean-handling-of-ResourceTimeout-exception.yaml b/changelogs/fragments/583-k8s_scale-clean-handling-of-ResourceTimeout-exception.yaml deleted file mode 100644 index 3b1f1314c2..0000000000 --- a/changelogs/fragments/583-k8s_scale-clean-handling-of-ResourceTimeout-exception.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - k8s_scale - clean handling of ResourceTimeout exception (https://github.com/ansible-collections/kubernetes.core/issues/583). diff --git a/changelogs/fragments/586-helm-fix-post-renderer-arg.yml b/changelogs/fragments/586-helm-fix-post-renderer-arg.yml deleted file mode 100644 index 2582a48629..0000000000 --- a/changelogs/fragments/586-helm-fix-post-renderer-arg.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - helm - fix post_renderer argument breaking the helm deploy_command (https://github.com/ansible-collections/kubernetes.core/pull/586). diff --git a/changelogs/fragments/588-helm-use-post-renderer-for-helmdiff.yml b/changelogs/fragments/588-helm-use-post-renderer-for-helmdiff.yml deleted file mode 100644 index a1c0f733d8..0000000000 --- a/changelogs/fragments/588-helm-use-post-renderer-for-helmdiff.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - helm - use post_renderer when checking 'changed' status for a helm release (https://github.com/ansible-collections/kubernetes.core/pull/588). diff --git a/changelogs/fragments/589-helm-uninstall-chart-releases-with-statuses-different-than-deployed.yaml b/changelogs/fragments/589-helm-uninstall-chart-releases-with-statuses-different-than-deployed.yaml deleted file mode 100644 index d206fe80a7..0000000000 --- a/changelogs/fragments/589-helm-uninstall-chart-releases-with-statuses-different-than-deployed.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - helm - fix issue occurring when uninstalling chart with statues others than 'deployed' (https://github.com/ansible-collections/kubernetes.core/issues/319). diff --git a/changelogs/fragments/606-k8s_drain-add-pod_selectors-parameter.yaml b/changelogs/fragments/606-k8s_drain-add-pod_selectors-parameter.yaml deleted file mode 100644 index 7faf433ab1..0000000000 --- a/changelogs/fragments/606-k8s_drain-add-pod_selectors-parameter.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - k8s_drain - add ability to filter the list of pods to be drained by a pod label selector (https://github.com/ansible-collections/kubernetes.core/issues/474). diff --git a/changelogs/fragments/612-fix-helm-tests.yaml b/changelogs/fragments/612-fix-helm-tests.yaml deleted file mode 100644 index 1cb86d61ba..0000000000 --- a/changelogs/fragments/612-fix-helm-tests.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - add dependency with `install_helm` for `helm_set_values` and `helm_kubeconfig` integration tests (https://github.com/ansible-collections/kubernetes.core/pull/612). diff --git a/changelogs/fragments/629-add-hidden-fields-option.yaml b/changelogs/fragments/629-add-hidden-fields-option.yaml deleted file mode 100644 index 1f0f80aaa4..0000000000 --- a/changelogs/fragments/629-add-hidden-fields-option.yaml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: - - k8s, k8s_info - add a hidden_fields option to allow fields to be hidden in the results of k8s and k8s_info diff --git a/changelogs/fragments/gha-sanity-fixes.yaml b/changelogs/fragments/gha-sanity-fixes.yaml deleted file mode 100644 index b034fbdebc..0000000000 --- a/changelogs/fragments/gha-sanity-fixes.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - add github workflow and fix sanity failures (https://github.com/ansible-collections/kubernetes.core/pull/614). diff --git a/changelogs/fragments/helm-delete-temporary-file-created-when-using-option-release_values.yaml b/changelogs/fragments/helm-delete-temporary-file-created-when-using-option-release_values.yaml deleted file mode 100644 index 9ad5ab886d..0000000000 --- a/changelogs/fragments/helm-delete-temporary-file-created-when-using-option-release_values.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - helm - delete temporary file created when deploying chart with option release_values set (https://github.com/ansible-collections/kubernetes.core/issues/530). diff --git a/changelogs/fragments/remove_ansible_2_13.yaml b/changelogs/fragments/remove_ansible_2_13.yaml deleted file mode 100644 index f2dc98bfa6..0000000000 --- a/changelogs/fragments/remove_ansible_2_13.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -trivial: - - organize the workflows and pin ansible-lint to 6.21.x. -breaking_changes: - - Remove support for ansible-core < 2.14 diff --git a/changelogs/fragments/update_supported_versions.yaml b/changelogs/fragments/update_supported_versions.yaml deleted file mode 100644 index 312cccb9df..0000000000 --- a/changelogs/fragments/update_supported_versions.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -breaking_changes: - - Update python kubernetes library to 24.2.0 , helm/kind-action to 1.8.0, kubernetes >= 1.24. diff --git a/docs/kubernetes.core.helm_info_module.rst b/docs/kubernetes.core.helm_info_module.rst index f74546b252..4b5ef7c060 100644 --- a/docs/kubernetes.core.helm_info_module.rst +++ b/docs/kubernetes.core.helm_info_module.rst @@ -105,6 +105,27 @@ Parameters

aliases: kube_context
+ + +
+ get_all_values + +
+ boolean +
+
added in 2.4.0
+ + + + + +
Set to True if you want to get all (computed) values of the release.
+
When False (default), only user supplied values are returned.
+ +
@@ -127,7 +148,7 @@ Parameters kubeconfig
- path + raw
@@ -135,6 +156,7 @@ Parameters
Helm option to specify kubeconfig path to use.
If the value is not specified in the task, the value of environment variable K8S_AUTH_KUBECONFIG will be used instead.
+
The configuration can be provided as dictionary. Added in version 2.4.0.

aliases: kubeconfig_path
@@ -172,6 +194,32 @@ Parameters

aliases: namespace
+ + +
+ release_state + +
+ list + / elements=string +
+
added in 2.3.0
+ + + Default:
[]
+ + +
Show releases as per their states.
+
Default value is deployed and failed.
+
If set to all, show all releases without any filter applied.
+
If set to deployed, show deployed releases.
+
If set to failed, show failed releases.
+
If set to pending, show pending releases.
+
If set to superseded, show superseded releases.
+
If set to uninstalled, show uninstalled releases, if helm uninstall --keep-history was used.
+
If set to uninstalling, show releases that are currently being uninstalled.
+ +
@@ -204,11 +252,18 @@ Examples .. code-block:: yaml - - name: Deploy latest version of Grafana chart inside monitoring namespace + - name: Gather information of Grafana chart inside monitoring namespace kubernetes.core.helm_info: name: test release_namespace: monitoring + - name: Gather information about test-chart with pending state + kubernetes.core.helm_info: + name: test-chart + release_namespace: testenv + release_state: + - pending + Return Values @@ -270,6 +325,42 @@ Common return values are documented `here + +   + +
+ hooks + +
+ list + / elements=dictionary +
+
added in 2.4.0
+ + always + +
Hooks of the release
+
+ + + +   + +
+ manifest + +
+ list + / elements=dictionary +
+
added in 2.4.0
+ + always + +
Manifest of the release
+
+ +   @@ -302,6 +393,23 @@ Common return values are documented `here + +   + +
+ notes + +
+ string +
+
added in 2.4.0
+ + always + +
Notes of the release
+
+ +   diff --git a/docs/kubernetes.core.helm_module.rst b/docs/kubernetes.core.helm_module.rst index 77b2c27bf8..93da13595c 100644 --- a/docs/kubernetes.core.helm_module.rst +++ b/docs/kubernetes.core.helm_module.rst @@ -36,12 +36,12 @@ Parameters - + - - - - - - - - - - - - - - - - + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - diff --git a/docs/kubernetes.core.helm_plugin_module.rst b/docs/kubernetes.core.helm_plugin_module.rst index ca1f1d03d4..aae7189927 100644 --- a/docs/kubernetes.core.helm_plugin_module.rst +++ b/docs/kubernetes.core.helm_plugin_module.rst @@ -126,7 +126,7 @@ Parameters kubeconfig
- path + raw
@@ -150,7 +151,7 @@ Parameters @@ -170,6 +171,23 @@ Parameters
Required only if state=present.
+ + + + + @@ -237,6 +257,17 @@ Examples plugin_name: env state: absent + - name: Install Helm plugin with a specific version + kubernetes.core.helm_plugin: + plugin_version: 2.0.1 + plugin_path: https://domain/path/to/plugin.tar.gz + state: present + + - name: Update Helm plugin + kubernetes.core.helm_plugin: + plugin_name: secrets + state: latest + Return Values diff --git a/docs/kubernetes.core.helm_repository_module.rst b/docs/kubernetes.core.helm_repository_module.rst index aa39ede683..ee4169ee77 100644 --- a/docs/kubernetes.core.helm_repository_module.rst +++ b/docs/kubernetes.core.helm_repository_module.rst @@ -40,6 +40,22 @@ Parameters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterParameter Choices/Defaults Comments
+
api_key @@ -57,7 +57,7 @@ Parameters
+
atomic @@ -76,7 +76,7 @@ Parameters
+
binary_path @@ -91,7 +91,7 @@ Parameters
+
ca_cert @@ -108,7 +108,7 @@ Parameters
+
chart_ref @@ -127,7 +127,7 @@ Parameters
+
chart_repo_url @@ -142,7 +142,7 @@ Parameters
+
chart_version @@ -157,7 +157,7 @@ Parameters
+
context @@ -174,7 +174,7 @@ Parameters
+
create_namespace @@ -194,13 +194,14 @@ Parameters
+
dependency_update
boolean
+
added in 2.4.0
    Choices: @@ -209,7 +210,7 @@ Parameters
-
Run standelone helm dependency update CHART before the operation.
+
Run standalone helm dependency update CHART before the operation.
Run inline --dependency-update with helm install command. This feature is not supported yet with the helm upgrade command.
So we should consider to use dependency_update options with replace option enabled when specifying chart_repo_url.
The dependency_update option require the add of dependencies block in Chart.yaml/requirements.yaml file.
@@ -218,7 +219,7 @@ Parameters
+
disable_hook @@ -237,7 +238,7 @@ Parameters
+
force @@ -256,7 +257,7 @@ Parameters
+
history_max @@ -273,7 +274,7 @@ Parameters
+
host @@ -289,12 +290,12 @@ Parameters
+
kubeconfig
- path + raw
@@ -302,11 +303,28 @@ Parameters
Helm option to specify kubeconfig path to use.
If the value is not specified in the task, the value of environment variable K8S_AUTH_KUBECONFIG will be used instead.
+
The configuration can be provided as dictionary. Added in version 2.4.0.

aliases: kubeconfig_path
+ +
+ post_renderer + +
+ string +
+
added in 2.4.0
+
+ +
Path to an executable to be used for post rendering.
+
purge @@ -325,7 +343,7 @@ Parameters
+
release_name @@ -342,7 +360,7 @@ Parameters
+
release_namespace @@ -359,7 +377,7 @@ Parameters
+
release_state @@ -379,7 +397,7 @@ Parameters
+
release_values @@ -396,7 +414,7 @@ Parameters
+
replace @@ -418,7 +436,108 @@ Parameters
+
+ reset_values + +
+ boolean +
+
added in 2.5.0
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
When upgrading package, reset the values to the ones built into the chart.
+
+
+ reuse_values + +
+ boolean +
+
added in 2.5.0
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
When upgrading package, specifies wether to reuse the last release's values and merge in any overrides from parameters release_values, values_files or set_values.
+
If reset_values is set to True, this is ignored.
+
+
+ set_values + +
+ list + / elements=dictionary +
+
added in 2.4.0
+
+ +
Values to pass to chart configuration
+
+
+ value + +
+ string + / required +
+
+ +
Value to pass to chart configuration (e.g phase=prod).
+
+
+ value_type + +
+ - +
+
+
    Choices: +
  • raw ←
  • +
  • string
  • +
  • json
  • +
  • file
  • +
+
+
Use raw set individual value.
+
Use string to force a string for an individual value.
+
Use file to set individual values from a file when the value itself is too long for the command line or is dynamically generated.
+
Use json to set json values (scalars/objects/arrays). This feature requires helm>=3.10.0.
+
skip_crds @@ -438,7 +557,7 @@ Parameters
+
timeout @@ -456,7 +575,7 @@ Parameters
+
update_repo_cache @@ -475,7 +594,7 @@ Parameters
+
validate_certs @@ -496,7 +615,7 @@ Parameters
+
values_files @@ -517,7 +636,7 @@ Parameters
+
wait @@ -537,7 +656,7 @@ Parameters
+
wait_timeout @@ -556,6 +675,12 @@ Parameters
+Notes +----- + +.. note:: + - The default idempotency check can fail to report changes when ``release_state`` is set to ``present`` and ``chart_repo_url`` is defined. Install helm diff >= 3.4.1 for better results. + Examples @@ -612,6 +737,15 @@ Examples state: absent update_repo_cache: true + - name: Deploy Grafana chart using set values on target + kubernetes.core.helm: + name: test + chart_ref: stable/grafana + release_namespace: monitoring + set_values: + - value: phase=prod + value_type: string + # From git - name: Git clone stable repo on HEAD ansible.builtin.git: @@ -657,6 +791,17 @@ Examples logging: enabled: True + # Deploy latest version + - name: Deploy latest version of Grafana chart using reuse_values + kubernetes.core.helm: + name: test + chart_ref: stable/grafana + release_namespace: monitoring + reuse_values: true + values: + replicas: 2 + version: 3e8ec0b2dffa40fb97d5342e4af887de95faa8c61a62480dd7f8aa03dffcf533 + Return Values diff --git a/docs/kubernetes.core.helm_plugin_info_module.rst b/docs/kubernetes.core.helm_plugin_info_module.rst index 86c563f915..ec0b7ce772 100644 --- a/docs/kubernetes.core.helm_plugin_info_module.rst +++ b/docs/kubernetes.core.helm_plugin_info_module.rst @@ -126,7 +126,7 @@ Parameters kubeconfig
- path + raw
@@ -134,6 +134,7 @@ Parameters
Helm option to specify kubeconfig path to use.
If the value is not specified in the task, the value of environment variable K8S_AUTH_KUBECONFIG will be used instead.
+
The configuration can be provided as dictionary. Added in version 2.4.0.

aliases: kubeconfig_path
@@ -134,6 +134,7 @@ Parameters
Helm option to specify kubeconfig path to use.
If the value is not specified in the task, the value of environment variable K8S_AUTH_KUBECONFIG will be used instead.
+
The configuration can be provided as dictionary. Added in version 2.4.0.

aliases: kubeconfig_path
Name of Helm plugin.
-
Required only if state=absent.
+
Required only if state=absent or state=latest.
+
+ plugin_version + +
+ string +
+
added in 2.3.0
+
+ +
Plugin version to install. If this is not specified, the latest version is installed.
+
Ignored when state=absent or state=latest.
+
@@ -183,10 +201,12 @@ Parameters
    Choices:
  • absent
  • present ←
  • +
  • latest
If state=present the Helm plugin will be installed.
+
If state=latest the Helm plugin will be updated. Added in version 2.3.0.
If state=absent the Helm plugin will be removed.
Choices/Defaults Comments
+
+ api_key + +
+ string +
+
added in 2.3.0
+
+ +
Token used to authenticate with the API. Can also be specified via K8S_AUTH_API_KEY environment variable.
+
@@ -55,6 +71,117 @@ Parameters
The path of a helm binary to use.
+
+ ca_cert + +
+ path +
+
added in 2.3.0
+
+ +
Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S_AUTH_SSL_CA_CERT environment variable.
+

aliases: ssl_ca_cert
+
+
+ context + +
+ string +
+
added in 2.4.0
+
+ +
Helm option to specify which kubeconfig context to use.
+
If the value is not specified in the task, the value of environment variable K8S_AUTH_CONTEXT will be used instead.
+

aliases: kube_context
+
+
+ force_update + +
+ boolean +
+
added in 2.4.0
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Whether or not to replace (overwrite) the repo if it already exists.
+

aliases: force
+
+
+ host + +
+ string +
+
added in 2.3.0
+
+ +
Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.
+
+
+ kubeconfig + +
+ raw +
+
added in 2.4.0
+
+ +
Helm option to specify kubeconfig path to use.
+
If the value is not specified in the task, the value of environment variable K8S_AUTH_KUBECONFIG will be used instead.
+
The configuration can be provided as dictionary.
+

aliases: kubeconfig_path
+
+
+ pass_credentials + +
+ boolean +
+
added in 2.3.0
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Pass credentials to all domains.
+
@@ -142,6 +269,27 @@ Parameters

aliases: username
+
+ validate_certs + +
+ boolean +
+
added in 2.3.0
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Whether or not to verify the API server's SSL certificates. Can also be specified via K8S_AUTH_VERIFY_SSL environment variable.
+

aliases: verify_ssl
+

diff --git a/docs/kubernetes.core.helm_template_module.rst b/docs/kubernetes.core.helm_template_module.rst index 67e53716b7..c89d27e216 100644 --- a/docs/kubernetes.core.helm_template_module.rst +++ b/docs/kubernetes.core.helm_template_module.rst @@ -28,12 +28,12 @@ Parameters - + - - - - - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + @@ -271,6 +272,25 @@ Parameters
This option is ignored when content is set or when state is set to from_pod.
+ + + + + @@ -334,6 +336,7 @@ Parameters @@ -353,6 +356,25 @@ Parameters
The name of the node.
+ + + + + + + + + + @@ -134,6 +134,7 @@ Parameters @@ -214,6 +215,7 @@ Parameters @@ -230,7 +232,26 @@ Parameters + + + + + @@ -285,7 +306,7 @@ Parameters @@ -302,7 +323,7 @@ Parameters @@ -449,6 +470,13 @@ Examples msg: "cmd failed" when: command_status.rc != 0 + - name: Specify a container name to execute the command on + kubernetes.core.k8s_exec: + namespace: myproject + pod: busybox-test + container: manager + command: echo "hello" + Return Values diff --git a/docs/kubernetes.core.k8s_info_module.rst b/docs/kubernetes.core.k8s_info_module.rst index e4d248af9a..af5f4656d8 100644 --- a/docs/kubernetes.core.k8s_info_module.rst +++ b/docs/kubernetes.core.k8s_info_module.rst @@ -28,8 +28,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 3.6 -- kubernetes >= 12.0.0 +- python >= 3.9 +- kubernetes >= 24.2.0 - PyYAML >= 3.11 @@ -153,11 +153,31 @@ Parameters + + + + + @@ -254,6 +275,7 @@ Parameters + + + + + @@ -256,6 +257,25 @@ Parameters
Use in conjunction with api_version, kind, and name to identify a specific object.
+ + + + + + + + + + @@ -240,6 +262,7 @@ Parameters @@ -254,6 +277,7 @@ Parameters + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterParameter Choices/Defaults Comments
+
binary_path @@ -48,7 +48,7 @@ Parameters
+
chart_ref @@ -67,7 +67,7 @@ Parameters
+
chart_repo_url @@ -82,7 +82,7 @@ Parameters
+
chart_version @@ -97,13 +97,14 @@ Parameters
+
dependency_update
boolean
+
added in 2.4.0
    Choices: @@ -119,7 +120,27 @@ Parameters
+ +
+ disable_hook + +
+ boolean +
+
added in 2.4.0
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Prevent hooks from running during install.
+
include_crds @@ -138,7 +159,7 @@ Parameters
+
output_dir @@ -154,7 +175,40 @@ Parameters
+ +
+ release_name + +
+ string +
+
added in 2.4.0
+
+ +
Release name to use in rendered templates.
+

aliases: name
+
+
+ release_namespace + +
+ string +
+
added in 2.4.0
+
+ +
namespace scope for this request.
+
release_values @@ -171,7 +225,85 @@ Parameters
+
+ set_values + +
+ list + / elements=dictionary +
+
added in 2.4.0
+
+ +
Values to pass to chart configuration.
+
+
+ value + +
+ string + / required +
+
+ +
Value to pass to chart configuration (e.g phase=prod).
+
+
+ value_type + +
+ - +
+
+
    Choices: +
  • raw ←
  • +
  • string
  • +
  • json
  • +
  • file
  • +
+
+
Use raw set individual value.
+
Use string to force a string for an individual value.
+
Use file to set individual values from a file when the value itself is too long for the command line or is dynamically generated.
+
Use json to set json values (scalars/objects/arrays). This feature requires helm>=3.10.0.
+
+
+ show_only + +
+ list + / elements=string +
+
added in 2.4.0
+
+ Default:
[]
+
+
Only show manifests rendered from the given templates.
+
update_repo_cache @@ -190,7 +322,7 @@ Parameters
+
values_files @@ -235,6 +367,24 @@ Examples dest: myfile.yaml content: "{{ result.stdout }}" + - name: Render MutatingWebhooksConfiguration for revision tag "canary", rev "1-13-0" + kubernetes.core.helm_template: + chart_ref: istio/istiod + chart_version: "1.13.0" + release_namespace: "istio-system" + show_only: + - "templates/revision-tags.yaml" + release_values: + revision: "1-13-0" + revisionTags: + - "canary" + register: result + + - name: Write templates to file + copy: + dest: myfile.yaml + content: "{{ result.stdout }}" + Return Values diff --git a/docs/kubernetes.core.k8s_cluster_info_module.rst b/docs/kubernetes.core.k8s_cluster_info_module.rst index 5e42983c5c..a0b621d666 100644 --- a/docs/kubernetes.core.k8s_cluster_info_module.rst +++ b/docs/kubernetes.core.k8s_cluster_info_module.rst @@ -27,8 +27,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 3.6 -- kubernetes >= 12.0.0 +- python >= 3.9 +- kubernetes >= 24.2.0 - PyYAML >= 3.11 @@ -203,9 +203,29 @@ Parameters
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.
The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.
+
+ no_proxy + +
+ string +
+
added in 2.3.0
+
+ +
The comma separated list of hosts/domains/IP/CIDR that shouldn't go through proxy. Can also be specified via K8S_AUTH_NO_PROXY environment variable.
+
Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).
+
This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.
+
example value is "localhost,.local,.example.com,127.0.0.1,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
+
diff --git a/docs/kubernetes.core.k8s_cp_module.rst b/docs/kubernetes.core.k8s_cp_module.rst index c61e1c1213..21badc81ff 100644 --- a/docs/kubernetes.core.k8s_cp_module.rst +++ b/docs/kubernetes.core.k8s_cp_module.rst @@ -25,8 +25,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 3.6 -- kubernetes >= 12.0.0 +- python >= 3.9 +- kubernetes >= 24.2.0 Parameters @@ -215,6 +215,7 @@ Parameters
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.
The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.
+
+ no_proxy + +
+ string +
+
added in 2.3.0
+
+ +
The comma separated list of hosts/domains/IP/CIDR that shouldn't go through proxy. Can also be specified via K8S_AUTH_NO_PROXY environment variable.
+
Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).
+
This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.
+
example value is "localhost,.local,.example.com,127.0.0.1,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
+
@@ -538,7 +558,7 @@ Examples state: from_pod # copy content into a file in the remote pod - - name: Copy /tmp/foo from a remote pod to /tmp/bar locally + - name: Copy content into a file in the remote pod kubernetes.core.k8s_cp: state: to_pod namespace: some-namespace diff --git a/docs/kubernetes.core.k8s_drain_module.rst b/docs/kubernetes.core.k8s_drain_module.rst index 09de91a8e5..70c2badad6 100644 --- a/docs/kubernetes.core.k8s_drain_module.rst +++ b/docs/kubernetes.core.k8s_drain_module.rst @@ -29,8 +29,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 3.6 -- kubernetes >= 12.0.0 +- python >= 3.9 +- kubernetes >= 24.2.0 Parameters @@ -132,6 +132,7 @@ Parameters
+ Default:
{}
Specify options to delete pods.
@@ -147,6 +148,7 @@ Parameters
boolean
+
added in 2.3.0
    Choices: @@ -155,7 +157,7 @@ Parameters
-
Continue even if there are pods using emptyDir (local data that will be deleted when the node is drained)
+
Continue even if there are pods using emptyDir (local data that will be deleted when the node is drained).
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.
The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.
+
+ no_proxy + +
+ string +
+
added in 2.3.0
+
+ +
The comma separated list of hosts/domains/IP/CIDR that shouldn't go through proxy. Can also be specified via K8S_AUTH_NO_PROXY environment variable.
+
Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).
+
This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.
+
example value is "localhost,.local,.example.com,127.0.0.1,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
+
@@ -392,6 +414,25 @@ Parameters
The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169
+
+ pod_selectors + +
+ list + / elements=string +
+
added in 2.5.0
+
+ +
Label selector to filter pods on the node.
+
This option has effect only when state is set to drain.
+

aliases: label_selectors
+
@@ -554,8 +595,7 @@ Examples kubernetes.core.k8s_drain: state: drain name: foo - delete_options: - force: yes + force: yes - name: Drain node "foo", but abort if there are pods not managed by a ReplicationController, Job, or DaemonSet, and use a grace period of 15 minutes. kubernetes.core.k8s_drain: @@ -574,6 +614,14 @@ Examples state: cordon name: foo + - name: Drain node "foo" using label selector to filter the list of pods to be drained. + kubernetes.core.k8s_drain: + state: drain + name: foo + pod_selectors: + - 'app!=csi-attacher' + - 'app!=csi-provisioner' + Return Values diff --git a/docs/kubernetes.core.k8s_exec_module.rst b/docs/kubernetes.core.k8s_exec_module.rst index a928352ee0..49be34212e 100644 --- a/docs/kubernetes.core.k8s_exec_module.rst +++ b/docs/kubernetes.core.k8s_exec_module.rst @@ -25,8 +25,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 3.6 -- kubernetes >= 12.0.0 +- python >= 3.9 +- kubernetes >= 24.2.0 - PyYAML >= 3.11 @@ -117,7 +117,7 @@ Parameters
-
The command to execute
+
The command to execute.
The name of the container in the pod to connect to.
Defaults to only container if there is only one container in the pod.
+
If not specified, will choose the first container from the given pod as kubectl cmdline does.
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.
The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.
-
The pod namespace name
+
The pod namespace name.
+
+
+ no_proxy + +
+ string +
+
added in 2.3.0
+
+ +
The comma separated list of hosts/domains/IP/CIDR that shouldn't go through proxy. Can also be specified via K8S_AUTH_NO_PROXY environment variable.
+
Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).
+
This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.
+
example value is "localhost,.local,.example.com,127.0.0.1,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
-
The pod name
+
The pod name.
The URL of an HTTP proxy to use for the connection.
Can also be specified via K8S_AUTH_PROXY environment variable.
-
Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP_PROXY).
+
Please note that this module does not pick up typical proxy settings from the environment (for example, HTTP_PROXY).
+ Default:
[]
List of field selectors to use to filter results
+
+ hidden_fields + +
+ list + / elements=string +
+
added in 2.5.0
+
+ +
Hide fields matching any of the field definitions in the result
+
An example might be hidden_fields=[metadata.managedFields]
+
Only field definitions that don't reference list items are supported (so V(spec.containers[0]) would not work)
+
@@ -240,6 +260,7 @@ Parameters
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.
The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.
+ Default:
[]
List of label selectors to use to filter results
@@ -295,6 +317,25 @@ Parameters
If resource definition is provided, the metadata.namespace value from the resource_definition will override this option.
+
+ no_proxy + +
+ string +
+
added in 2.3.0
+
+ +
The comma separated list of hosts/domains/IP/CIDR that shouldn't go through proxy. Can also be specified via K8S_AUTH_NO_PROXY environment variable.
+
Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).
+
This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.
+
example value is "localhost,.local,.example.com,127.0.0.1,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
+
diff --git a/docs/kubernetes.core.k8s_inventory.rst b/docs/kubernetes.core.k8s_inventory.rst index 79769c1b45..7a8cfd62a4 100644 --- a/docs/kubernetes.core.k8s_inventory.rst +++ b/docs/kubernetes.core.k8s_inventory.rst @@ -13,6 +13,15 @@ kubernetes.core.k8s :local: :depth: 1 +DEPRECATED +---------- +:Removed in collection release after +:Why: As discussed in https://github.com/ansible-collections/kubernetes.core/issues/31, we decided to +remove the k8s inventory plugin in release 4.0.0. + +:Alternative: Use :ref:`kubernetes.core.k8s_info ` and :ref:`ansible.builtin.add_host ` instead. + + Synopsis -------- @@ -27,8 +36,8 @@ Requirements ------------ The below requirements are needed on the local Ansible controller node that executes this inventory. -- python >= 3.6 -- kubernetes >= 12.0.0 +- python >= 3.9 +- kubernetes >= 24.2.0 - PyYAML >= 3.11 @@ -322,24 +331,24 @@ Examples # File must be named k8s.yaml or k8s.yml - # Authenticate with token, and return all pods and services for all namespaces - plugin: kubernetes.core.k8s - connections: - - host: https://192.168.64.4:8443 - api_key: xxxxxxxxxxxxxxxx - validate_certs: false + - name: Authenticate with token, and return all pods and services for all namespaces + plugin: kubernetes.core.k8s + connections: + - host: https://192.168.64.4:8443 + api_key: xxxxxxxxxxxxxxxx + validate_certs: false - # Use default config (~/.kube/config) file and active context, and return objects for a specific namespace - plugin: kubernetes.core.k8s - connections: - - namespaces: - - testing + - name: Use default config (~/.kube/config) file and active context, and return objects for a specific namespace + plugin: kubernetes.core.k8s + connections: + - namespaces: + - testing - # Use a custom config file, and a specific context. - plugin: kubernetes.core.k8s - connections: - - kubeconfig: /path/to/config - context: 'awx/192-168-64-4:8443/developer' + - name: Use a custom config file, and a specific context. + plugin: kubernetes.core.k8s + connections: + - kubeconfig: /path/to/config + context: 'awx/192-168-64-4:8443/developer' @@ -348,11 +357,15 @@ Status ------ +- This inventory will be removed in version 4.0.0. *[deprecated]* +- For more information see `DEPRECATED`_. + + Authors ~~~~~~~ -- Chris Houseknecht <@chouseknecht> -- Fabian von Feilitzsch <@fabianvf> +- Chris Houseknecht (@chouseknecht) +- Fabian von Feilitzsch (@fabianvf) .. hint:: diff --git a/docs/kubernetes.core.k8s_json_patch_module.rst b/docs/kubernetes.core.k8s_json_patch_module.rst index 926c84104b..3ab82a1b27 100644 --- a/docs/kubernetes.core.k8s_json_patch_module.rst +++ b/docs/kubernetes.core.k8s_json_patch_module.rst @@ -27,8 +27,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 3.6 -- kubernetes >= 12.0.0 +- python >= 3.9 +- kubernetes >= 24.2.0 - PyYAML >= 3.11 - jsonpatch @@ -220,6 +220,7 @@ Parameters
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.
The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.
+
+ no_proxy + +
+ string +
+
added in 2.3.0
+
+ +
The comma separated list of hosts/domains/IP/CIDR that shouldn't go through proxy. Can also be specified via K8S_AUTH_NO_PROXY environment variable.
+
Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).
+
This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.
+
example value is "localhost,.local,.example.com,127.0.0.1,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
+
@@ -594,7 +614,7 @@ Examples path: /metadata/labels/app value: myapp - op: replace - patch: /spec/containers/0/image + path: /spec/containers/0/image value: nginx diff --git a/docs/kubernetes.core.k8s_log_module.rst b/docs/kubernetes.core.k8s_log_module.rst index a639fb7d25..f2cbe671bd 100644 --- a/docs/kubernetes.core.k8s_log_module.rst +++ b/docs/kubernetes.core.k8s_log_module.rst @@ -28,8 +28,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 3.6 -- kubernetes >= 12.0.0 +- python >= 3.9 +- kubernetes >= 24.2.0 - PyYAML >= 3.11 @@ -44,6 +44,27 @@ Parameters
Choices/Defaults Comments
+
+ all_containers + +
+ boolean +
+
added in 2.4.0
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
If set to true, retrieve all containers' logs in the pod(s).
+
mutually exclusive with container.
+
@@ -141,7 +162,8 @@ Parameters
Use to specify the container within a pod to grab the log from.
If there is only one container, this will default to that container.
-
If there is more than one container, this option is required.
+
If there is more than one container, this option is required or set all_containers to true.
+
mutually exclusive with all_containers.
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.
The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.
+ Default:
[]
List of label selectors to use to filter results
@@ -295,6 +319,25 @@ Parameters
If resource definition is provided, the metadata.namespace value from the resource_definition will override this option.
+
+ no_proxy + +
+ string +
+
added in 2.3.0
+
+ +
The comma separated list of hosts/domains/IP/CIDR that shouldn't go through proxy. Can also be specified via K8S_AUTH_NO_PROXY environment variable.
+
Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).
+
This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.
+
example value is "localhost,.local,.example.com,127.0.0.1,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
+
@@ -334,6 +377,26 @@ Parameters
The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169
+
+ previous + +
+ boolean +
+
added in 2.4.0
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
If true, print the logs for the previous instance of the container in a pod if it exists.
+
@@ -435,6 +498,22 @@ Parameters
A relative time in seconds before the current time from which to show logs.
+
+ tail_lines + +
+ integer +
+
added in 2.4.0
+
+ +
A number of lines from the end of the logs to retrieve.
+
@@ -519,8 +598,16 @@ Examples kind: DeploymentConfig namespace: testing name: example + tail_lines: 100 register: log + # This will get the logs from all containers in Pod + - name: Get the logs from all containers in pod + kubernetes.core.k8s_log: + namespace: testing + name: some-pod + all_containers: true + Return Values diff --git a/docs/kubernetes.core.k8s_lookup.rst b/docs/kubernetes.core.k8s_lookup.rst index 9e428c8bea..347a8c055e 100644 --- a/docs/kubernetes.core.k8s_lookup.rst +++ b/docs/kubernetes.core.k8s_lookup.rst @@ -26,8 +26,8 @@ Requirements ------------ The below requirements are needed on the local Ansible controller node that executes this lookup. -- python >= 3.6 -- kubernetes >= 12.0.0 +- python >= 3.9 +- kubernetes >= 24.2.0 - PyYAML >= 3.11 @@ -438,106 +438,28 @@ Common return values are documented `here
KeyKey Returned Description
+
_list
- complex + list + / elements=dictionary
One ore more object definitions returned from the API.

+
Sample:
+
[{'kind': 'ConfigMap', 'apiVersion': 'v1', 'metadata': {'creationTimestamp': '2022-03-04T13:59:49Z', 'name': 'my-config-map', 'namespace': 'default', 'resourceVersion': '418', 'uid': '5714b011-d090-4eac-8272-a0ea82ec0abd'}, 'data': {'key1': 'val1'}}]
  -
- api_version - -
- string -
-
success -
The versioned schema of this representation of an object.
-
-
  -
- kind - -
- string -
-
success -
Represents the REST resource this object represents.
-
-
  -
- metadata - -
- complex -
-
success -
Standard object metadata. Includes name, namespace, annotations, labels, etc.
-
-
  -
- spec - -
- complex -
-
success -
Specific attributes of the object. Will vary based on the api_version and kind.
-
-
  -
- status - -
- complex -
-
success -
Current status details for the object.
-
-


@@ -549,8 +471,8 @@ Status Authors ~~~~~~~ -- Chris Houseknecht <@chouseknecht> -- Fabian von Feilitzsch <@fabianvf> +- Chris Houseknecht (@chouseknecht) +- Fabian von Feilitzsch (@fabianvf) .. hint:: diff --git a/docs/kubernetes.core.k8s_module.rst b/docs/kubernetes.core.k8s_module.rst index 9db23e054b..c847d61047 100644 --- a/docs/kubernetes.core.k8s_module.rst +++ b/docs/kubernetes.core.k8s_module.rst @@ -29,8 +29,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 3.6 -- kubernetes >= 12.0.0 +- python >= 3.9 +- kubernetes >= 24.2.0 - PyYAML >= 3.11 - jsonpatch @@ -208,6 +208,30 @@ Parameters
This has no effect on the validation step which is controlled by the validate.fail_on_error parameter.
+ + +
+ delete_all + +
+ boolean +
+
added in 2.5.0
+ + + + + +
When this option is set to true and state=absent, module will delete all resources of the specified resource type in the requested namespace.
+
Ignored when state is not set to absent or when one of (src), name or resource_definition is provided.
+
Parameter kind is required to use this option.
+
This parameter can be used with label_selectors to restrict the resources to be deleted.
+

aliases: all
+ +
@@ -336,6 +360,45 @@ Parameters
If set to yes, and state is present, an existing object will be replaced.
+ + +
+ generate_name + +
+ string +
+
added in 2.3.0
+ + + + +
Use to specify the basis of an object name and random characters will be added automatically on server to generate a unique name.
+
This option is ignored when state is not set to present or when apply is set to yes.
+
If resource definition is provided, the metadata.generateName value from the resource_definition will override this option.
+
If resource definition is provided, and contains metadata.name, this option is ignored.
+
mutually exclusive with name.
+ + + + +
+ hidden_fields + +
+ list + / elements=string +
+
added in 2.5.0
+ + + + +
Hide fields matching this option in the result
+
An example might be hidden_fields=[metadata.managedFields]
+
Only field definitions that don't reference list items are supported (so V(spec.containers[0]) would not work)
+ +
@@ -417,6 +480,7 @@ Parameters
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.
The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.
@@ -499,6 +563,25 @@ Parameters
If resource definition is provided, the metadata.namespace value from the resource_definition will override this option.
+ + +
+ no_proxy + +
+ string +
+
added in 2.3.0
+ + + + +
The comma separated list of hosts/domains/IP/CIDR that shouldn't go through proxy. Can also be specified via K8S_AUTH_NO_PROXY environment variable.
+
Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).
+
This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.
+
example value is "localhost,.local,.example.com,127.0.0.1,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
+ +
@@ -640,6 +723,63 @@ Parameters

aliases: definition, inline
+ + +
+ server_side_apply + +
+ dictionary +
+
added in 2.3.0
+ + + + +
When this option is set, apply runs in the server instead of the client.
+
Ignored if apply is not set or is set to False.
+
This option requires "kubernetes >= 19.15.0".
+ + + + + +
+ field_manager + +
+ string + / required +
+ + + + +
Name of the manager used to track field ownership.
+ + + + + +
+ force_conflicts + +
+ boolean +
+ + + + + +
A conflict is a special status error that occurs when an Server Side Apply operation tries to change a field, which another user also claims to manage.
+
When set to True, server-side apply will force the changes against conflicts.
+ + +
@@ -654,7 +794,8 @@ Parameters
Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with resource_definition. NOTE: kind, api_version, name, and namespace will be overwritten by corresponding values found in the configuration read in from the src file.
Reads from the local file system. To read from the Ansible controller's file system, including vaulted files, use the file lookup plugin or template lookup plugin, combined with the from_yaml filter, and pass the result to resource_definition. See Examples below.
-
Mutually exclusive with template in case of k8s module.
+
The URL to manifest files that can be used to create the resource. Added in version 2.4.0.
+
Mutually exclusive with template in case of kubernetes.core.k8s module.
@@ -1016,6 +1157,14 @@ Examples state: present definition: "{{ lookup('file', '/testing/deployment.yml') | from_yaml }}" + - name: >- + (Alternative) Read definition file from the Ansible controller file system. + In this case, the definition file contains multiple YAML documents, separated by ---. + If the definition file has been encrypted with Ansible Vault it will automatically be decrypted. + kubernetes.core.k8s: + state: present + definition: "{{ lookup('file', '/testing/deployment.yml') | from_yaml_all }}" + - name: Read definition template file from the Ansible controller file system kubernetes.core.k8s: state: present @@ -1033,10 +1182,10 @@ Examples kubernetes.core.k8s: state: present template: - - path: '/testing/deployment_one.j2' - - path: '/testing/deployment_two.j2' - variable_start_string: '[[' - variable_end_string: ']]' + - path: '/testing/deployment_one.j2' + - path: '/testing/deployment_two.j2' + variable_start_string: '[[' + variable_end_string: ']]' - name: fail on validation errors kubernetes.core.k8s: @@ -1093,6 +1242,41 @@ Examples labels: support: patch + # Create object using generateName + - name: create resource using name generated by the server + kubernetes.core.k8s: + state: present + generate_name: pod- + definition: + apiVersion: v1 + kind: Pod + spec: + containers: + - name: py + image: python:3.7-alpine + imagePullPolicy: IfNotPresent + + # Server side apply + - name: Create configmap using server side apply + kubernetes.core.k8s: + namespace: testing + definition: + apiVersion: v1 + kind: ConfigMap + metadata: + name: my-configmap + apply: yes + server_side_apply: + field_manager: ansible + + # Delete all Deployment from specified namespace + - name: Delete all Deployment from specified namespace + kubernetes.core.k8s: + api_version: apps/v1 + namespace: testing + kind: Deployment + delete_all: true + Return Values diff --git a/docs/kubernetes.core.k8s_rollback_module.rst b/docs/kubernetes.core.k8s_rollback_module.rst index 99ff84b97f..f5f29aa50f 100644 --- a/docs/kubernetes.core.k8s_rollback_module.rst +++ b/docs/kubernetes.core.k8s_rollback_module.rst @@ -27,8 +27,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 3.6 -- kubernetes >= 12.0.0 +- python >= 3.9 +- kubernetes >= 24.2.0 - PyYAML >= 3.11 @@ -152,6 +152,7 @@ Parameters + Default:
[]
List of field selectors to use to filter results.
@@ -238,6 +239,7 @@ Parameters
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.
The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.
@@ -252,6 +254,7 @@ Parameters + Default:
[]
List of label selectors to use to filter results.
@@ -293,6 +296,25 @@ Parameters
If resource definition is provided, the metadata.namespace value from the resource_definition will override this option.
+ + +
+ no_proxy + +
+ string +
+
added in 2.3.0
+ + + + +
The comma separated list of hosts/domains/IP/CIDR that shouldn't go through proxy. Can also be specified via K8S_AUTH_NO_PROXY environment variable.
+
Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).
+
This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.
+
example value is "localhost,.local,.example.com,127.0.0.1,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
+ +
diff --git a/docs/kubernetes.core.k8s_scale_module.rst b/docs/kubernetes.core.k8s_scale_module.rst index c1f56a0898..101eee8162 100644 --- a/docs/kubernetes.core.k8s_scale_module.rst +++ b/docs/kubernetes.core.k8s_scale_module.rst @@ -25,8 +25,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 3.6 -- kubernetes >= 12.0.0 +- python >= 3.9 +- kubernetes >= 24.2.0 - PyYAML >= 3.11 @@ -255,6 +255,7 @@ Parameters
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.
The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.
@@ -270,6 +271,7 @@ Parameters
added in 2.0.0
+ Default:
[]
List of label selectors to use to filter results.
@@ -311,6 +313,25 @@ Parameters
If resource definition is provided, the metadata.namespace value from the resource_definition will override this option.
+ + +
+ no_proxy + +
+ string +
+
added in 2.3.0
+ + + + +
The comma separated list of hosts/domains/IP/CIDR that shouldn't go through proxy. Can also be specified via K8S_AUTH_NO_PROXY environment variable.
+
Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).
+
This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.
+
example value is "localhost,.local,.example.com,127.0.0.1,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
+ +
@@ -497,7 +518,8 @@ Parameters
Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with resource_definition. NOTE: kind, api_version, name, and namespace will be overwritten by corresponding values found in the configuration read in from the src file.
Reads from the local file system. To read from the Ansible controller's file system, including vaulted files, use the file lookup plugin or template lookup plugin, combined with the from_yaml filter, and pass the result to resource_definition. See Examples below.
-
Mutually exclusive with template in case of k8s module.
+
The URL to manifest files that can be used to create the resource. Added in version 2.4.0.
+
Mutually exclusive with template in case of kubernetes.core.k8s module.
diff --git a/docs/kubernetes.core.k8s_service_module.rst b/docs/kubernetes.core.k8s_service_module.rst index 2941b91719..57ebe6d122 100644 --- a/docs/kubernetes.core.k8s_service_module.rst +++ b/docs/kubernetes.core.k8s_service_module.rst @@ -24,8 +24,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 3.6 -- kubernetes >= 12.0.0 +- python >= 3.9 +- kubernetes >= 24.2.0 Parameters @@ -220,6 +220,7 @@ Parameters
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.
The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.
@@ -280,6 +281,25 @@ Parameters
Use to specify a Service object namespace.
+ + +
+ no_proxy + +
+ string +
+
added in 2.3.0
+ + + + +
The comma separated list of hosts/domains/IP/CIDR that shouldn't go through proxy. Can also be specified via K8S_AUTH_NO_PROXY environment variable.
+
Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).
+
This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.
+
example value is "localhost,.local,.example.com,127.0.0.1,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
+ +
@@ -468,7 +488,8 @@ Parameters
Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with resource_definition. NOTE: kind, api_version, name, and namespace will be overwritten by corresponding values found in the configuration read in from the src file.
Reads from the local file system. To read from the Ansible controller's file system, including vaulted files, use the file lookup plugin or template lookup plugin, combined with the from_yaml filter, and pass the result to resource_definition. See Examples below.
-
Mutually exclusive with template in case of k8s module.
+
The URL to manifest files that can be used to create the resource. Added in version 2.4.0.
+
Mutually exclusive with template in case of kubernetes.core.k8s module.
diff --git a/docs/kubernetes.core.k8s_taint_module.rst b/docs/kubernetes.core.k8s_taint_module.rst index 4c342a2074..b3a089740e 100644 --- a/docs/kubernetes.core.k8s_taint_module.rst +++ b/docs/kubernetes.core.k8s_taint_module.rst @@ -26,8 +26,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 3.6 -- kubernetes >= 12.0.0 +- python >= 3.9 +- kubernetes >= 24.2.0 Parameters @@ -182,6 +182,7 @@ Parameters
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.
The kubernetes configuration can be provided as dictionary. This feature requires a python kubernetes client version >= 17.17.0. Added in version 2.2.0.
diff --git a/docs/kubernetes.core.kubectl_connection.rst b/docs/kubernetes.core.kubectl_connection.rst index 4acce17cb5..0bb06eb1c1 100644 --- a/docs/kubernetes.core.kubectl_connection.rst +++ b/docs/kubernetes.core.kubectl_connection.rst @@ -8,7 +8,6 @@ kubernetes.core.kubectl **Execute tasks in pods running on Kubernetes.** -Version added: 1.2.1 .. contents:: :local: @@ -209,6 +208,7 @@ Parameters
Path to a kubectl config file. Defaults to ~/.kube/config
+
The configuration can be provided as dictionary. Added in version 2.4.0.
@@ -355,7 +355,7 @@ Status Authors ~~~~~~~ -- xuxinkun +- xuxinkun (@xuxinkun) .. hint:: diff --git a/docs/kubernetes.core.kustomize_lookup.rst b/docs/kubernetes.core.kustomize_lookup.rst index 38d328ed7b..5c368d14d6 100644 --- a/docs/kubernetes.core.kustomize_lookup.rst +++ b/docs/kubernetes.core.kustomize_lookup.rst @@ -133,106 +133,27 @@ Common return values are documented `here - Key + Key Returned Description - -
- _list - -
- complex -
- - - -
One ore more object definitions returned from the tool execution.
-
- - - -   - -
- api_version - -
- string -
- - success - -
The versioned schema of this representation of an object.
-
- - - -  
- kind + _list
string
- success - -
Represents the REST resource this object represents.
-
- - - -   - -
- metadata - -
- complex -
- - success - -
Standard object metadata. Includes name, namespace, annotations, labels, etc.
-
- - - -   - -
- spec - -
- complex -
- - success - -
Specific attributes of the object. Will vary based on the api_version and kind.
-
- - - -   - -
- status - -
- complex -
- - success + -
Current status details for the object.
+
YAML string for the object definitions returned from the tool execution.

+
Sample:
+
{'kind': 'ConfigMap', 'apiVersion': 'v1', 'metadata': {'name': 'my-config-map', 'namespace': 'default'}, 'data': {'key1': 'val1'}}
-

@@ -244,7 +165,7 @@ Status Authors ~~~~~~~ -- Aubin Bikouo <@abikouo> +- Aubin Bikouo (@abikouo) .. hint:: diff --git a/galaxy.yml b/galaxy.yml index dc52ea7883..1a334f097d 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -25,7 +25,7 @@ tags: - openshift - okd - cluster -version: 2.4.0 +version: 3.0.0 build_ignore: - .DS_Store - "*.tar.gz" diff --git a/plugins/module_utils/common.py b/plugins/module_utils/common.py index 9c98b9da0e..f92c8fade9 100644 --- a/plugins/module_utils/common.py +++ b/plugins/module_utils/common.py @@ -1435,7 +1435,7 @@ def patch_resource( if merge_type == "json": self.module.deprecate( msg="json as a merge_type value is deprecated. Please use the k8s_json_patch module instead.", - version="3.0.0", + version="4.0.0", collection_name="kubernetes.core", ) try: diff --git a/plugins/module_utils/k8s/service.py b/plugins/module_utils/k8s/service.py index dc91bc0c6c..a1d3f7bfe4 100644 --- a/plugins/module_utils/k8s/service.py +++ b/plugins/module_utils/k8s/service.py @@ -146,7 +146,7 @@ def patch_resource( if merge_type == "json": self.module.deprecate( msg="json as a merge_type value is deprecated. Please use the k8s_json_patch module instead.", - version="3.0.0", + version="4.0.0", collection_name="kubernetes.core", ) try: