mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-11 20:12:18 +00:00
Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd0a376451 | ||
|
|
f22ffcab18 | ||
|
|
072a08091b | ||
|
|
cbadbe32f9 | ||
|
|
966fa7e906 | ||
|
|
485eae3b10 | ||
|
|
a4c1bd8541 | ||
|
|
8858b19121 | ||
|
|
6360763098 | ||
|
|
ac943e9890 | ||
|
|
0408aa9328 | ||
|
|
874fbfedd5 | ||
|
|
d8d9133912 | ||
|
|
86d9a3f45f | ||
|
|
fb25ff44f1 | ||
|
|
600c10dffb | ||
|
|
9f7c865c9c | ||
|
|
23e94b60c1 | ||
|
|
1955989278 | ||
|
|
7c4ec3b982 | ||
|
|
8d15489ec2 | ||
|
|
3dcdcbc85d | ||
|
|
fe9c12326d | ||
|
|
1a601213eb | ||
|
|
abb9e0b6d5 | ||
|
|
bdd429981c | ||
|
|
6956a77f8c | ||
|
|
1670e35cd8 | ||
|
|
b44fdd3f05 | ||
|
|
b066a2dda3 | ||
|
|
9e9962bc6c | ||
|
|
9ca13c3799 | ||
|
|
318529abaa | ||
|
|
6d0a3af311 | ||
|
|
54d8193972 | ||
|
|
a624251bba | ||
|
|
869f06f1e4 | ||
|
|
7919231df1 | ||
|
|
ea28cbaa59 | ||
|
|
560e0e3d40 | ||
|
|
ed09047699 | ||
|
|
2d1ec22405 | ||
|
|
71599e2fde | ||
|
|
8687994e9f | ||
|
|
8640c16cd4 | ||
|
|
deb4859f19 | ||
|
|
fb2af07583 | ||
|
|
151ed8245f | ||
|
|
09a3c837c3 | ||
|
|
31c1ccf962 | ||
|
|
031cc7c40d | ||
|
|
22764492d2 | ||
|
|
3d313cf837 | ||
|
|
deaf8ee4f3 | ||
|
|
0f7963beb9 |
@@ -1,7 +1,6 @@
|
|||||||
---
|
---
|
||||||
profile: production
|
profile: production
|
||||||
skip_list:
|
|
||||||
- meta-runtime[unsupported-version]
|
|
||||||
exclude_paths:
|
exclude_paths:
|
||||||
- tests/integration
|
- tests/integration
|
||||||
- tests/sanity
|
- tests/sanity
|
||||||
|
|||||||
1
.github/stale.yml
vendored
1
.github/stale.yml
vendored
@@ -12,6 +12,7 @@ daysUntilClose: 30
|
|||||||
# Only issues or pull requests with all of these labels are check if stale.
|
# Only issues or pull requests with all of these labels are check if stale.
|
||||||
# Defaults to `[]` (disabled)
|
# Defaults to `[]` (disabled)
|
||||||
onlyLabels: []
|
onlyLabels: []
|
||||||
|
|
||||||
# Issues or Pull Requests with these labels will never be considered stale. Set
|
# Issues or Pull Requests with these labels will never be considered stale. Set
|
||||||
# to `[]` to disable
|
# to `[]` to disable
|
||||||
exemptLabels:
|
exemptLabels:
|
||||||
|
|||||||
127
.github/workflows/integration-tests-kubevirt.yaml
vendored
Normal file
127
.github/workflows/integration-tests-kubevirt.yaml
vendored
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
name: Integration tests Kubevirt
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
- synchronize
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- stable-*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
splitter:
|
||||||
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
kubernetes: "./kubernetes"
|
||||||
|
kubevirt: "./kubevirt"
|
||||||
|
py_version: 3.9
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
test_targets: ${{ steps.splitter.outputs.kubevirt_targets }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout kubernetes.core repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
path: ${{ env.kubernetes }}
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
|
- name: Checkout the kubevirt.core collection
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
repository: kubevirt/kubevirt.core
|
||||||
|
path: ${{ env.kubevirt }}
|
||||||
|
|
||||||
|
- name: "Set up Python ${{ env.py_version }}"
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: "${{ env.py_version }}"
|
||||||
|
|
||||||
|
- name: List targets from kubevirt.core collection
|
||||||
|
id: splitter
|
||||||
|
run: python ${{ env.kubernetes }}/tools/kubevirt_list_targets.py ${{ env.kubevirt }}
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
integration:
|
||||||
|
if: ${{ needs.splitter.outputs.test_targets != '' }}
|
||||||
|
name: "integration-kubevirt-${{ matrix.test-target }}"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
needs:
|
||||||
|
- splitter
|
||||||
|
env:
|
||||||
|
kubernetes: "./kubernetes"
|
||||||
|
kubevirt: "./kubevirt"
|
||||||
|
ansible_version: milestone
|
||||||
|
python_version: 3.12
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
test-target: ${{ fromJson(needs.splitter.outputs.test_targets) }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout kubernetes.core repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
path: ${{ env.kubernetes }}
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
|
- name: Checkout kubevirt.core repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: kubevirt/kubevirt.core
|
||||||
|
path: ${{ env.kubevirt }}
|
||||||
|
ref: main
|
||||||
|
|
||||||
|
# Install ansible
|
||||||
|
- name: Install ansible-core (${{ env.ansible_version }})
|
||||||
|
run: >-
|
||||||
|
python3 -m pip install
|
||||||
|
https://github.com/ansible/ansible/archive/${{ env.ansible_version }}.tar.gz
|
||||||
|
--disable-pip-version-check
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Build and install kubevirt.core collection
|
||||||
|
id: install-kubevirt
|
||||||
|
uses: ansible-network/github_actions/.github/actions/build_install_collection@main
|
||||||
|
with:
|
||||||
|
install_python_dependencies: true
|
||||||
|
source_path: ${{ env.kubevirt }}
|
||||||
|
|
||||||
|
- name: Build and install kubernetes.core collection
|
||||||
|
id: install-kubernetes
|
||||||
|
uses: ansible-network/github_actions/.github/actions/build_install_collection@main
|
||||||
|
with:
|
||||||
|
install_python_dependencies: true
|
||||||
|
source_path: ${{ env.kubernetes }}
|
||||||
|
|
||||||
|
- name: Install kind / kubectl
|
||||||
|
uses: helm/kind-action@v1.9.0
|
||||||
|
with:
|
||||||
|
version: v0.22.0
|
||||||
|
install_only: true
|
||||||
|
|
||||||
|
- name: Deploy kubevirt
|
||||||
|
run: >-
|
||||||
|
${{ env.kubevirt }}/hack/e2e-setup.sh \
|
||||||
|
-v \
|
||||||
|
--configure-inotify-limits \
|
||||||
|
--configure-secondary-network \
|
||||||
|
--deploy-kubevirt \
|
||||||
|
--deploy-kubevirt-cdi \
|
||||||
|
--deploy-kubevirt-common-instancetypes \
|
||||||
|
--deploy-cnao \
|
||||||
|
--create-cluster \
|
||||||
|
--create-nad
|
||||||
|
env:
|
||||||
|
KIND: kind
|
||||||
|
KUBECTL: kubectl
|
||||||
|
|
||||||
|
- name: Run integration tests
|
||||||
|
uses: ansible-network/github_actions/.github/actions/ansible_test_integration@main
|
||||||
|
with:
|
||||||
|
collection_path: ${{ steps.install-kubevirt.outputs.collection_path }}
|
||||||
|
python_version: ${{ env.python_version }}
|
||||||
|
ansible_version: ${{ env.ansible_version }}
|
||||||
|
ansible_test_targets: ${{ matrix.test-target }}
|
||||||
|
env:
|
||||||
|
ANSIBLE_COLLECTIONS_PATHS: /home/runner/collections
|
||||||
2
.github/workflows/integration-tests.yaml
vendored
2
.github/workflows/integration-tests.yaml
vendored
@@ -132,6 +132,8 @@ jobs:
|
|||||||
|
|
||||||
- name: create kubernetes cluster
|
- name: create kubernetes cluster
|
||||||
uses: helm/kind-action@v1.8.0
|
uses: helm/kind-action@v1.8.0
|
||||||
|
with:
|
||||||
|
node_image: "kindest/node:v1.29.2"
|
||||||
|
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
uses: ansible-network/github_actions/.github/actions/ansible_test_integration@main
|
uses: ansible-network/github_actions/.github/actions/ansible_test_integration@main
|
||||||
|
|||||||
4
.github/workflows/linters.yaml
vendored
4
.github/workflows/linters.yaml
vendored
@@ -10,7 +10,7 @@ on:
|
|||||||
- main
|
- main
|
||||||
- stable-*
|
- stable-*
|
||||||
tags:
|
tags:
|
||||||
- "*"
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
linters:
|
linters:
|
||||||
@@ -21,4 +21,4 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run ansible-lint
|
- name: Run ansible-lint
|
||||||
uses: ansible/ansible-lint@v6.21.0
|
uses: ansible/ansible-lint@v24.2.3
|
||||||
|
|||||||
1
.github/workflows/unit-tests.yaml
vendored
1
.github/workflows/unit-tests.yaml
vendored
@@ -1,4 +1,3 @@
|
|||||||
---
|
|
||||||
name: Unit tests
|
name: Unit tests
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
|||||||
106
CHANGELOG.rst
106
CHANGELOG.rst
@@ -4,14 +4,112 @@ Kubernetes Collection Release Notes
|
|||||||
|
|
||||||
.. contents:: Topics
|
.. contents:: Topics
|
||||||
|
|
||||||
|
v4.0.0
|
||||||
v2.4.1
|
|
||||||
======
|
======
|
||||||
|
|
||||||
Release Summary
|
Release Summary
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
The kubernetes.core 2.4.1 release includes several trivial bug fixes related to code sanity.
|
This major release brings several bug fixes. We have also removed support for ``ansible-core<2.15`` and deprecated functions and class from ``module_utils/common.py``.
|
||||||
|
|
||||||
|
Minor Changes
|
||||||
|
-------------
|
||||||
|
|
||||||
|
- inventory/k8s.py - Defer removal of k8s inventory plugin to version 5.0 (https://github.com/ansible-collections/kubernetes.core/pull/723).
|
||||||
|
- k8s - The module and K8sService were changed so warnings returned by the K8S API are now displayed to the user.
|
||||||
|
|
||||||
|
Removed Features (previously deprecated)
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
- k8s - Support for ``merge_type=json`` has been removed in version 4.0.0. Please use ``kubernetes.core.k8s_json_patch`` instead (https://github.com/ansible-collections/kubernetes.core/pull/722).
|
||||||
|
- k8s_exec - the previously deprecated ``result.return_code`` return value has been removed, consider using ``result.rc`` instead (https://github.com/ansible-collections/kubernetes.core/pull/726).
|
||||||
|
- module_utils/common.py - the previously deprecated ``K8sAnsibleMixin`` class has been removed (https://github.com/ansible-collections/kubernetes.core/pull/726).
|
||||||
|
- module_utils/common.py - the previously deprecated ``configuration_digest()`` function has been removed (https://github.com/ansible-collections/kubernetes.core/pull/726).
|
||||||
|
- module_utils/common.py - the previously deprecated ``get_api_client()`` function has been removed (https://github.com/ansible-collections/kubernetes.core/pull/726).
|
||||||
|
- module_utils/common.py - the previously deprecated ``unique_string()`` function has been removed (https://github.com/ansible-collections/kubernetes.core/pull/726).
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Resolve Collections util resource discovery fails when complex subresources present (https://github.com/ansible-collections/kubernetes.core/pull/676).
|
||||||
|
- align `helmdiff_check()` function commandline rendering with the `deploy()` function (https://github.com/ansible-collections/kubernetes.core/pull/670).
|
||||||
|
- avoid unsafe conditions in integration tests (https://github.com/ansible-collections/kubernetes.core/pull/665).
|
||||||
|
- helm - use ``reuse-values`` when running ``helm diff`` command (https://github.com/ansible-collections/kubernetes.core/issues/680).
|
||||||
|
- integrations test helm_kubeconfig - set helm version to v3.10.3 to avoid incompatability with new bitnami charts (https://github.com/ansible-collections/kubernetes.core/pull/670).
|
||||||
|
|
||||||
|
v3.1.0
|
||||||
|
======
|
||||||
|
|
||||||
|
Release Summary
|
||||||
|
---------------
|
||||||
|
|
||||||
|
This release comes with some bugfixes and documentation updates. It also adds new features to the kubectl connection plugin and the kustomize lookup plugin.
|
||||||
|
|
||||||
|
Minor Changes
|
||||||
|
-------------
|
||||||
|
|
||||||
|
- kubectl - added support of local enviroment variable that will be used for kubectl and may be requried for establishing connections ifself (https://github.com/ansible-collections/kubernetes.core/pull/702)
|
||||||
|
- kustomize - new parameter added to --enable-helm (https://github.com/ansible-collections/kubernetes.core/issues/568)
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- helm - expand kubeconfig path with user's home directory for consistency with k8s
|
||||||
|
- k8s_json_patch - rename action symlink to ensure k8s action plugin is used (https://github.com/ansible-collections/kubernetes.core/pull/652).
|
||||||
|
|
||||||
|
v3.0.1
|
||||||
|
======
|
||||||
|
|
||||||
|
Release Summary
|
||||||
|
---------------
|
||||||
|
|
||||||
|
This release fixes issue with resources discovery when complex subresources are present, and fixes issues with `reuse-values` parameter for helm module.
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Resolve Collections util resource discovery fails when complex subresources present (https://github.com/ansible-collections/kubernetes.core/pull/676).
|
||||||
|
- align `helmdiff_check()` function commandline rendering with the `deploy()` function (https://github.com/ansible-collections/kubernetes.core/pull/670).
|
||||||
|
- helm - use ``reuse-values`` when running ``helm diff`` command (https://github.com/ansible-collections/kubernetes.core/issues/680).
|
||||||
|
- integrations test helm_kubeconfig - set helm version to v3.10.3 to avoid incompatability with new bitnami charts (https://github.com/ansible-collections/kubernetes.core/pull/670).
|
||||||
|
|
||||||
|
v3.0.0
|
||||||
|
======
|
||||||
|
|
||||||
|
Release Summary
|
||||||
|
---------------
|
||||||
|
|
||||||
|
This major release drops support for ansible-core versions lower than 2.14, Python versions lower than 3.9 and updates python kubernetes library to 24.2.0, helm/kind-action to 1.8.0, kubernetes >= 1.24, along with bug fixes and minor changes.
|
||||||
|
|
||||||
|
Minor Changes
|
||||||
|
-------------
|
||||||
|
|
||||||
|
- helm - add ``reuse_values`` and ``reset_values`` support to helm module (https://github.com/ansible-collections/kubernetes.core/issues/394).
|
||||||
|
- 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)
|
||||||
|
- k8s, k8s_info - add a hidden_fields option to allow fields to be hidden in the results of k8s and k8s_info
|
||||||
|
- 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).
|
||||||
|
|
||||||
|
Breaking Changes / Porting Guide
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
- Remove support for ansible-core < 2.14
|
||||||
|
- Update python kubernetes library to 24.2.0, helm/kind-action to 1.8.0, kubernetes >= 1.24.
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
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).
|
||||||
|
- helm - delete temporary file created when deploying chart with option ``release_values`` set (https://github.com/ansible-collections/kubernetes.core/issues/530).
|
||||||
|
- helm - fix issue occurring when uninstalling chart with statues others than ``deployed`` (https://github.com/ansible-collections/kubernetes.core/issues/319).
|
||||||
|
- helm - fix post_renderer argument breaking the helm deploy_command (https://github.com/ansible-collections/kubernetes.core/pull/586).
|
||||||
|
- helm - use post_renderer when checking ``changed`` status for a helm release (https://github.com/ansible-collections/kubernetes.core/pull/588).
|
||||||
|
- k8s_scale - clean handling of ResourceTimeout exception (https://github.com/ansible-collections/kubernetes.core/issues/583).
|
||||||
|
- k8s_scale - fix issue when scaling StatefulSets with ``updateStrategy=OnDelete`` (https://github.com/ansible-collections/kubernetes.core/issues/579).
|
||||||
|
|
||||||
v2.4.0
|
v2.4.0
|
||||||
======
|
======
|
||||||
@@ -104,7 +202,7 @@ v2.3.1
|
|||||||
Bugfixes
|
Bugfixes
|
||||||
--------
|
--------
|
||||||
|
|
||||||
- Catch exception raised when the process is waiting for resources (https://github.com/ansible-collections/kubernetes.core/issues/407).
|
- Catch expectation raised when the process is waiting for resources (https://github.com/ansible-collections/kubernetes.core/issues/407).
|
||||||
- Remove `omit` placeholder when defining resource using template parameter (https://github.com/ansible-collections/kubernetes.core/issues/431).
|
- Remove `omit` placeholder when defining resource using template parameter (https://github.com/ansible-collections/kubernetes.core/issues/431).
|
||||||
- k8s - fix the issue when trying to delete resources using label_selectors options (https://github.com/ansible-collections/kubernetes.core/issues/433).
|
- k8s - fix the issue when trying to delete resources using label_selectors options (https://github.com/ansible-collections/kubernetes.core/issues/433).
|
||||||
- k8s_cp - fix issue when using parameter local_path with file on managed node. (https://github.com/ansible-collections/kubernetes.core/issues/421).
|
- k8s_cp - fix issue when using parameter local_path with file on managed node. (https://github.com/ansible-collections/kubernetes.core/issues/421).
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -1,5 +1,5 @@
|
|||||||
# Also needs to be updated in galaxy.yml
|
# Also needs to be updated in galaxy.yml
|
||||||
VERSION = 2.4.1
|
VERSION = 4.0.0
|
||||||
|
|
||||||
TEST_ARGS ?= ""
|
TEST_ARGS ?= ""
|
||||||
PYTHON_VERSION ?= `python -c 'import platform; print(".".join(platform.python_version_tuple()[0:2]))'`
|
PYTHON_VERSION ?= `python -c 'import platform; print(".".join(platform.python_version_tuple()[0:2]))'`
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ The collection includes a variety of Ansible content to help automate the manage
|
|||||||
<!--start requires_ansible-->
|
<!--start requires_ansible-->
|
||||||
## Ansible version compatibility
|
## Ansible version compatibility
|
||||||
|
|
||||||
This collection has been tested against following Ansible versions: **>=2.9.17**.
|
This collection has been tested against following Ansible versions: **>=2.14.0**.
|
||||||
|
|
||||||
For collections that support Ansible 2.9, please ensure you update your `network_os` to use the
|
For collections that support Ansible 2.9, please ensure you update your `network_os` to use the
|
||||||
fully qualified collection name (for example, `cisco.ios.ios`).
|
fully qualified collection name (for example, `cisco.ios.ios`).
|
||||||
@@ -20,13 +20,13 @@ PEP440 is the schema used to describe the versions of Ansible.
|
|||||||
|
|
||||||
## Python Support
|
## Python Support
|
||||||
|
|
||||||
* Collection supports 3.6+
|
* Collection supports 3.9+
|
||||||
|
|
||||||
Note: Python2 is deprecated from [1st January 2020](https://www.python.org/doc/sunset-python-2/). Please switch to Python3.
|
Note: Python2 is deprecated from [1st January 2020](https://www.python.org/doc/sunset-python-2/). Please switch to Python3.
|
||||||
|
|
||||||
## Kubernetes Version Support
|
## Kubernetes Version Support
|
||||||
|
|
||||||
This collection supports Kubernetes versions >=1.19.
|
This collection supports Kubernetes versions >= 1.24.
|
||||||
|
|
||||||
## Included content
|
## Included content
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ You can also include it in a `requirements.yml` file and install it via `ansible
|
|||||||
---
|
---
|
||||||
collections:
|
collections:
|
||||||
- name: kubernetes.core
|
- name: kubernetes.core
|
||||||
version: 2.4.1
|
version: 4.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
### Installing the Kubernetes Python Library
|
### Installing the Kubernetes Python Library
|
||||||
|
|||||||
@@ -762,9 +762,137 @@ releases:
|
|||||||
name: helm_pull
|
name: helm_pull
|
||||||
namespace: ''
|
namespace: ''
|
||||||
release_date: '2023-01-24'
|
release_date: '2023-01-24'
|
||||||
2.4.1:
|
3.0.0:
|
||||||
changes:
|
changes:
|
||||||
release_summary: The kubernetes.core 2.4.1 release includes several trivial bug fixes related to sanity.
|
breaking_changes:
|
||||||
|
- Remove support for ansible-core < 2.14
|
||||||
|
- Update python kubernetes library to 24.2.0, helm/kind-action to 1.8.0, kubernetes
|
||||||
|
>= 1.24.
|
||||||
|
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).
|
||||||
|
- helm - delete temporary file created when deploying chart with option ``release_values``
|
||||||
|
set (https://github.com/ansible-collections/kubernetes.core/issues/530).
|
||||||
|
- helm - fix issue occurring when uninstalling chart with statues others than
|
||||||
|
``deployed`` (https://github.com/ansible-collections/kubernetes.core/issues/319).
|
||||||
|
- helm - fix post_renderer argument breaking the helm deploy_command (https://github.com/ansible-collections/kubernetes.core/pull/586).
|
||||||
|
- helm - use post_renderer when checking ``changed`` status for a helm release
|
||||||
|
(https://github.com/ansible-collections/kubernetes.core/pull/588).
|
||||||
|
- k8s_scale - clean handling of ResourceTimeout exception (https://github.com/ansible-collections/kubernetes.core/issues/583).
|
||||||
|
- k8s_scale - fix issue when scaling StatefulSets with ``updateStrategy=OnDelete``
|
||||||
|
(https://github.com/ansible-collections/kubernetes.core/issues/579).
|
||||||
|
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).
|
||||||
|
minor_changes:
|
||||||
|
- helm - add ``reuse_values`` and ``reset_values`` support to helm module (https://github.com/ansible-collections/kubernetes.core/issues/394).
|
||||||
|
- 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)
|
||||||
|
- k8s, k8s_info - add a hidden_fields option to allow fields to be hidden in
|
||||||
|
the results of k8s and k8s_info
|
||||||
|
- 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).
|
||||||
|
release_summary: This major release drops support for ansible-core versions
|
||||||
|
lower than 2.14, Python versions lower than 3.9 and updates python kubernetes
|
||||||
|
library to 24.2.0, helm/kind-action to 1.8.0, kubernetes >= 1.24, along with
|
||||||
|
bug fixes and minor changes.
|
||||||
fragments:
|
fragments:
|
||||||
- fix_sanity_errors.yml
|
- 20230206-deprecate-k8s-inventory.yml
|
||||||
release_date: '2024-02-06'
|
- 20231110-helm-quote-ref.yaml
|
||||||
|
- 517-k8s-make-name-optional.yaml
|
||||||
|
- 575-helm-add-support-for-reuse_values-and-reset_values.yml
|
||||||
|
- 579-k8s_scale-fix-issue-with-scaling-statefulsets.yml
|
||||||
|
- 583-k8s_scale-clean-handling-of-ResourceTimeout-exception.yaml
|
||||||
|
- 586-helm-fix-post-renderer-arg.yml
|
||||||
|
- 588-helm-use-post-renderer-for-helmdiff.yml
|
||||||
|
- 589-helm-uninstall-chart-releases-with-statuses-different-than-deployed.yaml
|
||||||
|
- 606-k8s_drain-add-pod_selectors-parameter.yaml
|
||||||
|
- 612-fix-helm-tests.yaml
|
||||||
|
- 629-add-hidden-fields-option.yaml
|
||||||
|
- gha-sanity-fixes.yaml
|
||||||
|
- helm-delete-temporary-file-created-when-using-option-release_values.yaml
|
||||||
|
- remove_ansible_2_13.yaml
|
||||||
|
- update_supported_versions.yaml
|
||||||
|
release_date: '2023-11-17'
|
||||||
|
3.0.1:
|
||||||
|
changes:
|
||||||
|
bugfixes:
|
||||||
|
- Resolve Collections util resource discovery fails when complex subresources
|
||||||
|
present (https://github.com/ansible-collections/kubernetes.core/pull/676).
|
||||||
|
- align `helmdiff_check()` function commandline rendering with the `deploy()`
|
||||||
|
function (https://github.com/ansible-collections/kubernetes.core/pull/670).
|
||||||
|
- helm - use ``reuse-values`` when running ``helm diff`` command (https://github.com/ansible-collections/kubernetes.core/issues/680).
|
||||||
|
- integrations test helm_kubeconfig - set helm version to v3.10.3 to avoid incompatability
|
||||||
|
with new bitnami charts (https://github.com/ansible-collections/kubernetes.core/pull/670).
|
||||||
|
release_summary: This release fixes issue with resources discovery when complex
|
||||||
|
subresources are present, and fixes issues with `reuse-values` parameter for
|
||||||
|
helm module.
|
||||||
|
fragments:
|
||||||
|
- 20240117-fix-helm-diff-cmd-line-rendering.yml
|
||||||
|
- 20240222-Collections-util-resource-discovery-fails-when-complex-subresources-present.yml
|
||||||
|
- 20240228-fix-helm-diff-with-reuse-values.yml
|
||||||
|
- 3.0.1.yml
|
||||||
|
release_date: '2024-03-01'
|
||||||
|
3.1.0:
|
||||||
|
changes:
|
||||||
|
bugfixes:
|
||||||
|
- helm - expand kubeconfig path with user's home directory for consistency with
|
||||||
|
k8s
|
||||||
|
- k8s_json_patch - rename action symlink to ensure k8s action plugin is used
|
||||||
|
(https://github.com/ansible-collections/kubernetes.core/pull/652).
|
||||||
|
minor_changes:
|
||||||
|
- kubectl - added support of local enviroment variable that will be used for
|
||||||
|
kubectl and may be requried for establishing connections ifself (https://github.com/ansible-collections/kubernetes.core/pull/702)
|
||||||
|
- kustomize - new parameter added to --enable-helm (https://github.com/ansible-collections/kubernetes.core/issues/568)
|
||||||
|
release_summary: This release comes with some bugfixes and documentation updates.
|
||||||
|
It also adds new features to the kubectl connection plugin and the kustomize
|
||||||
|
lookup plugin.
|
||||||
|
fragments:
|
||||||
|
- 20240426-add-support-of-kubectl-local-env-vars-for-connection-plugin.yml
|
||||||
|
- 3.1.0.yml
|
||||||
|
- 592-kustomize-helm-support.yml
|
||||||
|
- 652-fix-json-patch-action.yml
|
||||||
|
- 654-helm-expand-user.yml
|
||||||
|
release_date: '2024-05-16'
|
||||||
|
4.0.0:
|
||||||
|
changes:
|
||||||
|
bugfixes:
|
||||||
|
- Resolve Collections util resource discovery fails when complex subresources
|
||||||
|
present (https://github.com/ansible-collections/kubernetes.core/pull/676).
|
||||||
|
- align `helmdiff_check()` function commandline rendering with the `deploy()`
|
||||||
|
function (https://github.com/ansible-collections/kubernetes.core/pull/670).
|
||||||
|
- avoid unsafe conditions in integration tests (https://github.com/ansible-collections/kubernetes.core/pull/665).
|
||||||
|
- helm - use ``reuse-values`` when running ``helm diff`` command (https://github.com/ansible-collections/kubernetes.core/issues/680).
|
||||||
|
- integrations test helm_kubeconfig - set helm version to v3.10.3 to avoid incompatability
|
||||||
|
with new bitnami charts (https://github.com/ansible-collections/kubernetes.core/pull/670).
|
||||||
|
minor_changes:
|
||||||
|
- inventory/k8s.py - Defer removal of k8s inventory plugin to version 5.0 (https://github.com/ansible-collections/kubernetes.core/pull/723).
|
||||||
|
- k8s - The module and K8sService were changed so warnings returned by the K8S
|
||||||
|
API are now displayed to the user.
|
||||||
|
release_summary: This major release brings several bug fixes. We have also removed
|
||||||
|
support for ``ansible-core<2.15`` and deprecated functions and class from
|
||||||
|
``module_utils/common.py``.
|
||||||
|
removed_features:
|
||||||
|
- k8s - Support for ``merge_type=json`` has been removed in version 4.0.0. Please
|
||||||
|
use ``kubernetes.core.k8s_json_patch`` instead (https://github.com/ansible-collections/kubernetes.core/pull/722).
|
||||||
|
- k8s_exec - the previously deprecated ``result.return_code`` return value has
|
||||||
|
been removed, consider using ``result.rc`` instead (https://github.com/ansible-collections/kubernetes.core/pull/726).
|
||||||
|
- module_utils/common.py - the previously deprecated ``K8sAnsibleMixin`` class
|
||||||
|
has been removed (https://github.com/ansible-collections/kubernetes.core/pull/726).
|
||||||
|
- module_utils/common.py - the previously deprecated ``configuration_digest()``
|
||||||
|
function has been removed (https://github.com/ansible-collections/kubernetes.core/pull/726).
|
||||||
|
- module_utils/common.py - the previously deprecated ``get_api_client()`` function
|
||||||
|
has been removed (https://github.com/ansible-collections/kubernetes.core/pull/726).
|
||||||
|
- module_utils/common.py - the previously deprecated ``unique_string()`` function
|
||||||
|
has been removed (https://github.com/ansible-collections/kubernetes.core/pull/726).
|
||||||
|
fragments:
|
||||||
|
- 20231206-fix-unsafe-condition-in-integration.yml
|
||||||
|
- 20240117-fix-helm-diff-cmd-line-rendering.yml
|
||||||
|
- 20240222-Collections-util-resource-discovery-fails-when-complex-subresources-present.yml
|
||||||
|
- 20240228-fix-helm-diff-with-reuse-values.yml
|
||||||
|
- 20240423-k8s-display-warnings-to-users.yml
|
||||||
|
- 4.0.0.yaml
|
||||||
|
- inventory-update_removal_date.yml
|
||||||
|
- k8s-merge_type-removed.yml
|
||||||
|
- module_utils-common-remove-deprecated-functions-and-class.yaml
|
||||||
|
release_date: '2024-05-24'
|
||||||
|
|||||||
@@ -10,21 +10,21 @@ notesdir: fragments
|
|||||||
prelude_section_name: release_summary
|
prelude_section_name: release_summary
|
||||||
prelude_section_title: Release Summary
|
prelude_section_title: Release Summary
|
||||||
sections:
|
sections:
|
||||||
- - major_changes
|
- - major_changes
|
||||||
- Major Changes
|
- Major Changes
|
||||||
- - minor_changes
|
- - minor_changes
|
||||||
- Minor Changes
|
- Minor Changes
|
||||||
- - breaking_changes
|
- - breaking_changes
|
||||||
- Breaking Changes / Porting Guide
|
- Breaking Changes / Porting Guide
|
||||||
- - deprecated_features
|
- - deprecated_features
|
||||||
- Deprecated Features
|
- Deprecated Features
|
||||||
- - removed_features
|
- - removed_features
|
||||||
- Removed Features (previously deprecated)
|
- Removed Features (previously deprecated)
|
||||||
- - security_fixes
|
- - security_fixes
|
||||||
- Security Fixes
|
- Security Fixes
|
||||||
- - bugfixes
|
- - bugfixes
|
||||||
- Bugfixes
|
- Bugfixes
|
||||||
- - known_issues
|
- - known_issues
|
||||||
- Known Issues
|
- Known Issues
|
||||||
title: Kubernetes Collection
|
title: Kubernetes Collection
|
||||||
trivial_section_name: trivial
|
trivial_section_name: trivial
|
||||||
|
|||||||
@@ -105,6 +105,27 @@ Parameters
|
|||||||
<div style="font-size: small; color: darkgreen"><br/>aliases: kube_context</div>
|
<div style="font-size: small; color: darkgreen"><br/>aliases: kube_context</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>get_all_values</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">boolean</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Set to <code>True</code> if you want to get all (computed) values of the release.</div>
|
||||||
|
<div>When <code>False</code> (default), only user supplied values are returned.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="1">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -127,7 +148,7 @@ Parameters
|
|||||||
<b>kubeconfig</b>
|
<b>kubeconfig</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
<div style="font-size: small">
|
<div style="font-size: small">
|
||||||
<span style="color: purple">path</span>
|
<span style="color: purple">raw</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -135,6 +156,7 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
<div>Helm option to specify kubeconfig path to use.</div>
|
<div>Helm option to specify kubeconfig path to use.</div>
|
||||||
<div>If the value is not specified in the task, the value of environment variable <code>K8S_AUTH_KUBECONFIG</code> will be used instead.</div>
|
<div>If the value is not specified in the task, the value of environment variable <code>K8S_AUTH_KUBECONFIG</code> will be used instead.</div>
|
||||||
|
<div>The configuration can be provided as dictionary. Added in version 2.4.0.</div>
|
||||||
<div style="font-size: small; color: darkgreen"><br/>aliases: kubeconfig_path</div>
|
<div style="font-size: small; color: darkgreen"><br/>aliases: kubeconfig_path</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -172,6 +194,32 @@ Parameters
|
|||||||
<div style="font-size: small; color: darkgreen"><br/>aliases: namespace</div>
|
<div style="font-size: small; color: darkgreen"><br/>aliases: namespace</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>release_state</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
/ <span style="color: purple">elements=string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">[]</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Show releases as per their states.</div>
|
||||||
|
<div>Default value is <code>deployed</code> and <code>failed</code>.</div>
|
||||||
|
<div>If set to <code>all</code>, show all releases without any filter applied.</div>
|
||||||
|
<div>If set to <code>deployed</code>, show deployed releases.</div>
|
||||||
|
<div>If set to <code>failed</code>, show failed releases.</div>
|
||||||
|
<div>If set to <code>pending</code>, show pending releases.</div>
|
||||||
|
<div>If set to <code>superseded</code>, show superseded releases.</div>
|
||||||
|
<div>If set to <code>uninstalled</code>, show uninstalled releases, if <code>helm uninstall --keep-history</code> was used.</div>
|
||||||
|
<div>If set to <code>uninstalling</code>, show releases that are currently being uninstalled.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="1">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -204,11 +252,18 @@ Examples
|
|||||||
|
|
||||||
.. code-block:: yaml
|
.. 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:
|
kubernetes.core.helm_info:
|
||||||
name: test
|
name: test
|
||||||
release_namespace: monitoring
|
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
|
Return Values
|
||||||
@@ -270,6 +325,42 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late
|
|||||||
<br/>
|
<br/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>hooks</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
/ <span style="color: purple">elements=dictionary</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>always</td>
|
||||||
|
<td>
|
||||||
|
<div>Hooks of the release</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>manifest</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
/ <span style="color: purple">elements=dictionary</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>always</td>
|
||||||
|
<td>
|
||||||
|
<div>Manifest of the release</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="elbow-placeholder"> </td>
|
<td class="elbow-placeholder"> </td>
|
||||||
<td colspan="1">
|
<td colspan="1">
|
||||||
@@ -302,6 +393,23 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late
|
|||||||
<br/>
|
<br/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"> </td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
|
<b>notes</b>
|
||||||
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>always</td>
|
||||||
|
<td>
|
||||||
|
<div>Notes of the release</div>
|
||||||
|
<br/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="elbow-placeholder"> </td>
|
<td class="elbow-placeholder"> </td>
|
||||||
<td colspan="1">
|
<td colspan="1">
|
||||||
|
|||||||
@@ -36,12 +36,12 @@ Parameters
|
|||||||
|
|
||||||
<table border=0 cellpadding=0 class="documentation-table">
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="1">Parameter</th>
|
<th colspan="2">Parameter</th>
|
||||||
<th>Choices/<font color="blue">Defaults</font></th>
|
<th>Choices/<font color="blue">Defaults</font></th>
|
||||||
<th width="100%">Comments</th>
|
<th width="100%">Comments</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>api_key</b>
|
<b>api_key</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -57,7 +57,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>atomic</b>
|
<b>atomic</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -76,7 +76,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>binary_path</b>
|
<b>binary_path</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -91,7 +91,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>ca_cert</b>
|
<b>ca_cert</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -108,7 +108,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>chart_ref</b>
|
<b>chart_ref</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -127,7 +127,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>chart_repo_url</b>
|
<b>chart_repo_url</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -142,7 +142,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>chart_version</b>
|
<b>chart_version</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -157,7 +157,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>context</b>
|
<b>context</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -174,7 +174,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>create_namespace</b>
|
<b>create_namespace</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -194,13 +194,14 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>dependency_update</b>
|
<b>dependency_update</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
<div style="font-size: small">
|
<div style="font-size: small">
|
||||||
<span style="color: purple">boolean</span>
|
<span style="color: purple">boolean</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
@@ -209,7 +210,7 @@ Parameters
|
|||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>Run standelone <code>helm dependency update CHART</code> before the operation.</div>
|
<div>Run standalone <code>helm dependency update CHART</code> before the operation.</div>
|
||||||
<div>Run inline <code>--dependency-update</code> with <code>helm install</code> command. This feature is not supported yet with the <code>helm upgrade</code> command.</div>
|
<div>Run inline <code>--dependency-update</code> with <code>helm install</code> command. This feature is not supported yet with the <code>helm upgrade</code> command.</div>
|
||||||
<div>So we should consider to use <em>dependency_update</em> options with <em>replace</em> option enabled when specifying <em>chart_repo_url</em>.</div>
|
<div>So we should consider to use <em>dependency_update</em> options with <em>replace</em> option enabled when specifying <em>chart_repo_url</em>.</div>
|
||||||
<div>The <em>dependency_update</em> option require the add of <code>dependencies</code> block in <code>Chart.yaml/requirements.yaml</code> file.</div>
|
<div>The <em>dependency_update</em> option require the add of <code>dependencies</code> block in <code>Chart.yaml/requirements.yaml</code> file.</div>
|
||||||
@@ -218,7 +219,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>disable_hook</b>
|
<b>disable_hook</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -237,7 +238,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>force</b>
|
<b>force</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -256,7 +257,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>history_max</b>
|
<b>history_max</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -273,7 +274,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>host</b>
|
<b>host</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -289,12 +290,12 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>kubeconfig</b>
|
<b>kubeconfig</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
<div style="font-size: small">
|
<div style="font-size: small">
|
||||||
<span style="color: purple">path</span>
|
<span style="color: purple">raw</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -302,11 +303,28 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
<div>Helm option to specify kubeconfig path to use.</div>
|
<div>Helm option to specify kubeconfig path to use.</div>
|
||||||
<div>If the value is not specified in the task, the value of environment variable <code>K8S_AUTH_KUBECONFIG</code> will be used instead.</div>
|
<div>If the value is not specified in the task, the value of environment variable <code>K8S_AUTH_KUBECONFIG</code> will be used instead.</div>
|
||||||
|
<div>The configuration can be provided as dictionary. Added in version 2.4.0.</div>
|
||||||
<div style="font-size: small; color: darkgreen"><br/>aliases: kubeconfig_path</div>
|
<div style="font-size: small; color: darkgreen"><br/>aliases: kubeconfig_path</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>post_renderer</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Path to an executable to be used for post rendering.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>purge</b>
|
<b>purge</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -325,7 +343,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>release_name</b>
|
<b>release_name</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -342,7 +360,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>release_namespace</b>
|
<b>release_namespace</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -359,7 +377,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>release_state</b>
|
<b>release_state</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -379,7 +397,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>release_values</b>
|
<b>release_values</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -396,7 +414,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>replace</b>
|
<b>replace</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -418,7 +436,108 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>reset_values</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">boolean</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.5.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>When upgrading package, reset the values to the ones built into the chart.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>reuse_values</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">boolean</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.5.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>When upgrading package, specifies wether to reuse the last release's values and merge in any overrides from parameters <em>release_values</em>, <em>values_files</em> or <em>set_values</em>.</div>
|
||||||
|
<div>If <em>reset_values</em> is set to <code>True</code>, this is ignored.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>set_values</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
/ <span style="color: purple">elements=dictionary</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Values to pass to chart configuration</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
<td colspan="1">
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>value</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
/ <span style="color: red">required</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Value to pass to chart configuration (e.g phase=prod).</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>value_type</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">-</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>raw</b> ←</div></li>
|
||||||
|
<li>string</li>
|
||||||
|
<li>json</li>
|
||||||
|
<li>file</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Use <code>raw</code> set individual value.</div>
|
||||||
|
<div>Use <code>string</code> to force a string for an individual value.</div>
|
||||||
|
<div>Use <code>file</code> to set individual values from a file when the value itself is too long for the command line or is dynamically generated.</div>
|
||||||
|
<div>Use <code>json</code> to set json values (scalars/objects/arrays). This feature requires helm>=3.10.0.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>skip_crds</b>
|
<b>skip_crds</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -438,7 +557,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>timeout</b>
|
<b>timeout</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -456,7 +575,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>update_repo_cache</b>
|
<b>update_repo_cache</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -475,7 +594,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>validate_certs</b>
|
<b>validate_certs</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -496,7 +615,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>values_files</b>
|
<b>values_files</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -517,7 +636,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>wait</b>
|
<b>wait</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -537,7 +656,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>wait_timeout</b>
|
<b>wait_timeout</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -556,6 +675,12 @@ Parameters
|
|||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
|
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
|
Examples
|
||||||
@@ -612,6 +737,15 @@ Examples
|
|||||||
state: absent
|
state: absent
|
||||||
update_repo_cache: true
|
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
|
# From git
|
||||||
- name: Git clone stable repo on HEAD
|
- name: Git clone stable repo on HEAD
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
@@ -657,6 +791,17 @@ Examples
|
|||||||
logging:
|
logging:
|
||||||
enabled: True
|
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
|
Return Values
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ Parameters
|
|||||||
<b>kubeconfig</b>
|
<b>kubeconfig</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
<div style="font-size: small">
|
<div style="font-size: small">
|
||||||
<span style="color: purple">path</span>
|
<span style="color: purple">raw</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -134,6 +134,7 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
<div>Helm option to specify kubeconfig path to use.</div>
|
<div>Helm option to specify kubeconfig path to use.</div>
|
||||||
<div>If the value is not specified in the task, the value of environment variable <code>K8S_AUTH_KUBECONFIG</code> will be used instead.</div>
|
<div>If the value is not specified in the task, the value of environment variable <code>K8S_AUTH_KUBECONFIG</code> will be used instead.</div>
|
||||||
|
<div>The configuration can be provided as dictionary. Added in version 2.4.0.</div>
|
||||||
<div style="font-size: small; color: darkgreen"><br/>aliases: kubeconfig_path</div>
|
<div style="font-size: small; color: darkgreen"><br/>aliases: kubeconfig_path</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ Parameters
|
|||||||
<b>kubeconfig</b>
|
<b>kubeconfig</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
<div style="font-size: small">
|
<div style="font-size: small">
|
||||||
<span style="color: purple">path</span>
|
<span style="color: purple">raw</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -134,6 +134,7 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
<div>Helm option to specify kubeconfig path to use.</div>
|
<div>Helm option to specify kubeconfig path to use.</div>
|
||||||
<div>If the value is not specified in the task, the value of environment variable <code>K8S_AUTH_KUBECONFIG</code> will be used instead.</div>
|
<div>If the value is not specified in the task, the value of environment variable <code>K8S_AUTH_KUBECONFIG</code> will be used instead.</div>
|
||||||
|
<div>The configuration can be provided as dictionary. Added in version 2.4.0.</div>
|
||||||
<div style="font-size: small; color: darkgreen"><br/>aliases: kubeconfig_path</div>
|
<div style="font-size: small; color: darkgreen"><br/>aliases: kubeconfig_path</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -150,7 +151,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>Name of Helm plugin.</div>
|
<div>Name of Helm plugin.</div>
|
||||||
<div>Required only if <code>state=absent</code>.</div>
|
<div>Required only if <code>state=absent</code> or <code>state=latest</code>.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -170,6 +171,23 @@ Parameters
|
|||||||
<div>Required only if <code>state=present</code>.</div>
|
<div>Required only if <code>state=present</code>.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>plugin_version</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Plugin version to install. If this is not specified, the latest version is installed.</div>
|
||||||
|
<div>Ignored when <code>state=absent</code> or <code>state=latest</code>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="1">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -183,10 +201,12 @@ Parameters
|
|||||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
<li>absent</li>
|
<li>absent</li>
|
||||||
<li><div style="color: blue"><b>present</b> ←</div></li>
|
<li><div style="color: blue"><b>present</b> ←</div></li>
|
||||||
|
<li>latest</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>If <code>state=present</code> the Helm plugin will be installed.</div>
|
<div>If <code>state=present</code> the Helm plugin will be installed.</div>
|
||||||
|
<div>If <code>state=latest</code> the Helm plugin will be updated. Added in version 2.3.0.</div>
|
||||||
<div>If <code>state=absent</code> the Helm plugin will be removed.</div>
|
<div>If <code>state=absent</code> the Helm plugin will be removed.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -237,6 +257,17 @@ Examples
|
|||||||
plugin_name: env
|
plugin_name: env
|
||||||
state: absent
|
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
|
Return Values
|
||||||
|
|||||||
@@ -40,6 +40,22 @@ Parameters
|
|||||||
<th>Choices/<font color="blue">Defaults</font></th>
|
<th>Choices/<font color="blue">Defaults</font></th>
|
||||||
<th width="100%">Comments</th>
|
<th width="100%">Comments</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>api_key</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Token used to authenticate with the API. Can also be specified via <code>K8S_AUTH_API_KEY</code> environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="1">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -55,6 +71,117 @@ Parameters
|
|||||||
<div>The path of a helm binary to use.</div>
|
<div>The path of a helm binary to use.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>ca_cert</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">path</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>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 <code>K8S_AUTH_SSL_CA_CERT</code> environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: ssl_ca_cert</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>context</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Helm option to specify which kubeconfig context to use.</div>
|
||||||
|
<div>If the value is not specified in the task, the value of environment variable <code>K8S_AUTH_CONTEXT</code> will be used instead.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: kube_context</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>force_update</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">boolean</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to replace (overwrite) the repo if it already exists.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: force</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>host</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Provide a URL for accessing the API. Can also be specified via <code>K8S_AUTH_HOST</code> environment variable.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>kubeconfig</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">raw</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Helm option to specify kubeconfig path to use.</div>
|
||||||
|
<div>If the value is not specified in the task, the value of environment variable <code>K8S_AUTH_KUBECONFIG</code> will be used instead.</div>
|
||||||
|
<div>The configuration can be provided as dictionary.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: kubeconfig_path</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>pass_credentials</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">boolean</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Pass credentials to all domains.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="1">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -142,6 +269,27 @@ Parameters
|
|||||||
<div style="font-size: small; color: darkgreen"><br/>aliases: username</div>
|
<div style="font-size: small; color: darkgreen"><br/>aliases: username</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>validate_certs</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">boolean</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Whether or not to verify the API server's SSL certificates. Can also be specified via <code>K8S_AUTH_VERIFY_SSL</code> environment variable.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: verify_ssl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ Parameters
|
|||||||
|
|
||||||
<table border=0 cellpadding=0 class="documentation-table">
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="1">Parameter</th>
|
<th colspan="2">Parameter</th>
|
||||||
<th>Choices/<font color="blue">Defaults</font></th>
|
<th>Choices/<font color="blue">Defaults</font></th>
|
||||||
<th width="100%">Comments</th>
|
<th width="100%">Comments</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>binary_path</b>
|
<b>binary_path</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -48,7 +48,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>chart_ref</b>
|
<b>chart_ref</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -67,7 +67,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>chart_repo_url</b>
|
<b>chart_repo_url</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -82,7 +82,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>chart_version</b>
|
<b>chart_version</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -97,13 +97,14 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>dependency_update</b>
|
<b>dependency_update</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
<div style="font-size: small">
|
<div style="font-size: small">
|
||||||
<span style="color: purple">boolean</span>
|
<span style="color: purple">boolean</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
@@ -119,7 +120,27 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>disable_hook</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">boolean</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Prevent hooks from running during install.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>include_crds</b>
|
<b>include_crds</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -138,7 +159,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>output_dir</b>
|
<b>output_dir</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -154,7 +175,40 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>release_name</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Release name to use in rendered templates.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: name</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>release_namespace</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>namespace scope for this request.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>release_values</b>
|
<b>release_values</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -171,7 +225,85 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>set_values</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
/ <span style="color: purple">elements=dictionary</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Values to pass to chart configuration.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
<td colspan="1">
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>value</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
/ <span style="color: red">required</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Value to pass to chart configuration (e.g phase=prod).</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>value_type</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">-</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>raw</b> ←</div></li>
|
||||||
|
<li>string</li>
|
||||||
|
<li>json</li>
|
||||||
|
<li>file</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Use <code>raw</code> set individual value.</div>
|
||||||
|
<div>Use <code>string</code> to force a string for an individual value.</div>
|
||||||
|
<div>Use <code>file</code> to set individual values from a file when the value itself is too long for the command line or is dynamically generated.</div>
|
||||||
|
<div>Use <code>json</code> to set json values (scalars/objects/arrays). This feature requires helm>=3.10.0.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>show_only</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
/ <span style="color: purple">elements=string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">[]</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Only show manifests rendered from the given templates.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>update_repo_cache</b>
|
<b>update_repo_cache</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -190,7 +322,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
<b>values_files</b>
|
<b>values_files</b>
|
||||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
@@ -235,6 +367,24 @@ Examples
|
|||||||
dest: myfile.yaml
|
dest: myfile.yaml
|
||||||
content: "{{ result.stdout }}"
|
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
|
Return Values
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ Requirements
|
|||||||
------------
|
------------
|
||||||
The below requirements are needed on the host that executes this module.
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
- PyYAML >= 3.11
|
- PyYAML >= 3.11
|
||||||
|
|
||||||
|
|
||||||
@@ -203,9 +203,29 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
||||||
|
<div>Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.</div>
|
||||||
<div>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.</div>
|
<div>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.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>no_proxy</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>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.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).</div>
|
||||||
|
<div>This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.</div>
|
||||||
|
<div>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"</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ Requirements
|
|||||||
------------
|
------------
|
||||||
The below requirements are needed on the host that executes this module.
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
|
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
@@ -215,6 +215,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
||||||
|
<div>Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.</div>
|
||||||
<div>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.</div>
|
<div>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.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -271,6 +272,25 @@ Parameters
|
|||||||
<div>This option is ignored when <em>content</em> is set or when <em>state</em> is set to <code>from_pod</code>.</div>
|
<div>This option is ignored when <em>content</em> is set or when <em>state</em> is set to <code>from_pod</code>.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>no_proxy</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>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.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).</div>
|
||||||
|
<div>This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.</div>
|
||||||
|
<div>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"</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -538,7 +558,7 @@ Examples
|
|||||||
state: from_pod
|
state: from_pod
|
||||||
|
|
||||||
# copy content into a file in the remote 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:
|
kubernetes.core.k8s_cp:
|
||||||
state: to_pod
|
state: to_pod
|
||||||
namespace: some-namespace
|
namespace: some-namespace
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ Requirements
|
|||||||
------------
|
------------
|
||||||
The below requirements are needed on the host that executes this module.
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
|
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
@@ -132,6 +132,7 @@ Parameters
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">{}</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>Specify options to delete pods.</div>
|
<div>Specify options to delete pods.</div>
|
||||||
@@ -147,6 +148,7 @@ Parameters
|
|||||||
<div style="font-size: small">
|
<div style="font-size: small">
|
||||||
<span style="color: purple">boolean</span>
|
<span style="color: purple">boolean</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
@@ -155,7 +157,7 @@ Parameters
|
|||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>Continue even if there are pods using emptyDir (local data that will be deleted when the node is drained)</div>
|
<div>Continue even if there are pods using emptyDir (local data that will be deleted when the node is drained).</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -334,6 +336,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
||||||
|
<div>Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.</div>
|
||||||
<div>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.</div>
|
<div>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.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -353,6 +356,25 @@ Parameters
|
|||||||
<div>The name of the node.</div>
|
<div>The name of the node.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>no_proxy</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>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.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).</div>
|
||||||
|
<div>This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.</div>
|
||||||
|
<div>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"</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -392,6 +414,25 @@ Parameters
|
|||||||
<div>The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169</div>
|
<div>The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>pod_selectors</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
/ <span style="color: purple">elements=string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.5.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Label selector to filter pods on the node.</div>
|
||||||
|
<div>This option has effect only when <code>state</code> is set to <em>drain</em>.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: label_selectors</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -561,7 +602,7 @@ Examples
|
|||||||
state: drain
|
state: drain
|
||||||
name: foo
|
name: foo
|
||||||
delete_options:
|
delete_options:
|
||||||
terminate_grace_period: 900
|
terminate_grace_period: 900
|
||||||
|
|
||||||
- name: Mark node "foo" as schedulable.
|
- name: Mark node "foo" as schedulable.
|
||||||
kubernetes.core.k8s_drain:
|
kubernetes.core.k8s_drain:
|
||||||
@@ -573,6 +614,14 @@ Examples
|
|||||||
state: cordon
|
state: cordon
|
||||||
name: foo
|
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
|
Return Values
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ Requirements
|
|||||||
------------
|
------------
|
||||||
The below requirements are needed on the host that executes this module.
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
- PyYAML >= 3.11
|
- PyYAML >= 3.11
|
||||||
|
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>The command to execute</div>
|
<div>The command to execute.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -134,6 +134,7 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
<div>The name of the container in the pod to connect to.</div>
|
<div>The name of the container in the pod to connect to.</div>
|
||||||
<div>Defaults to only container if there is only one container in the pod.</div>
|
<div>Defaults to only container if there is only one container in the pod.</div>
|
||||||
|
<div>If not specified, will choose the first container from the given pod as kubectl cmdline does.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -214,6 +215,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
||||||
|
<div>Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.</div>
|
||||||
<div>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.</div>
|
<div>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.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -230,7 +232,26 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>The pod namespace name</div>
|
<div>The pod namespace name.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>no_proxy</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>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.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).</div>
|
||||||
|
<div>This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.</div>
|
||||||
|
<div>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"</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -285,7 +306,7 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>The pod name</div>
|
<div>The pod name.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -302,7 +323,7 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
<div>The URL of an HTTP proxy to use for the connection.</div>
|
<div>The URL of an HTTP proxy to use for the connection.</div>
|
||||||
<div>Can also be specified via <em>K8S_AUTH_PROXY</em> environment variable.</div>
|
<div>Can also be specified via <em>K8S_AUTH_PROXY</em> environment variable.</div>
|
||||||
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP_PROXY).</div>
|
<div>Please note that this module does not pick up typical proxy settings from the environment (for example, HTTP_PROXY).</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -449,6 +470,13 @@ Examples
|
|||||||
msg: "cmd failed"
|
msg: "cmd failed"
|
||||||
when: command_status.rc != 0
|
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
|
Return Values
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ Requirements
|
|||||||
------------
|
------------
|
||||||
The below requirements are needed on the host that executes this module.
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
- PyYAML >= 3.11
|
- PyYAML >= 3.11
|
||||||
|
|
||||||
|
|
||||||
@@ -153,11 +153,31 @@ Parameters
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">[]</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>List of field selectors to use to filter results</div>
|
<div>List of field selectors to use to filter results</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>hidden_fields</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
/ <span style="color: purple">elements=string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.5.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Hide fields matching any of the field definitions in the result</div>
|
||||||
|
<div>An example might be <code>hidden_fields=[metadata.managedFields]</code></div>
|
||||||
|
<div>Only field definitions that don't reference list items are supported (so V(spec.containers[0]) would not work)</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -240,6 +260,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
||||||
|
<div>Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.</div>
|
||||||
<div>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.</div>
|
<div>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.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -254,6 +275,7 @@ Parameters
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">[]</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>List of label selectors to use to filter results</div>
|
<div>List of label selectors to use to filter results</div>
|
||||||
@@ -295,6 +317,25 @@ Parameters
|
|||||||
<div>If <em>resource definition</em> is provided, the <em>metadata.namespace</em> value from the <em>resource_definition</em> will override this option.</div>
|
<div>If <em>resource definition</em> is provided, the <em>metadata.namespace</em> value from the <em>resource_definition</em> will override this option.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>no_proxy</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>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.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).</div>
|
||||||
|
<div>This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.</div>
|
||||||
|
<div>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"</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
|||||||
@@ -13,6 +13,15 @@ kubernetes.core.k8s
|
|||||||
:local:
|
:local:
|
||||||
:depth: 1
|
: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 5.0.0.
|
||||||
|
|
||||||
|
:Alternative: Use :ref:`kubernetes.core.k8s_info <kubernetes.core.k8s_info_module>` and :ref:`ansible.builtin.add_host <ansible.builtin.add_host_module>` instead.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Synopsis
|
Synopsis
|
||||||
--------
|
--------
|
||||||
@@ -27,8 +36,8 @@ Requirements
|
|||||||
------------
|
------------
|
||||||
The below requirements are needed on the local Ansible controller node that executes this inventory.
|
The below requirements are needed on the local Ansible controller node that executes this inventory.
|
||||||
|
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
- PyYAML >= 3.11
|
- PyYAML >= 3.11
|
||||||
|
|
||||||
|
|
||||||
@@ -322,24 +331,24 @@ Examples
|
|||||||
|
|
||||||
# File must be named k8s.yaml or k8s.yml
|
# File must be named k8s.yaml or k8s.yml
|
||||||
|
|
||||||
# Authenticate with token, and return all pods and services for all namespaces
|
- name: Authenticate with token, and return all pods and services for all namespaces
|
||||||
plugin: kubernetes.core.k8s
|
plugin: kubernetes.core.k8s
|
||||||
connections:
|
connections:
|
||||||
- host: https://192.168.64.4:8443
|
- host: https://192.168.64.4:8443
|
||||||
api_key: xxxxxxxxxxxxxxxx
|
api_key: xxxxxxxxxxxxxxxx
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
|
|
||||||
# Use default config (~/.kube/config) file and active context, and return objects for a specific namespace
|
- name: Use default config (~/.kube/config) file and active context, and return objects for a specific namespace
|
||||||
plugin: kubernetes.core.k8s
|
plugin: kubernetes.core.k8s
|
||||||
connections:
|
connections:
|
||||||
- namespaces:
|
- namespaces:
|
||||||
- testing
|
- testing
|
||||||
|
|
||||||
# Use a custom config file, and a specific context.
|
- name: Use a custom config file, and a specific context.
|
||||||
plugin: kubernetes.core.k8s
|
plugin: kubernetes.core.k8s
|
||||||
connections:
|
connections:
|
||||||
- kubeconfig: /path/to/config
|
- kubeconfig: /path/to/config
|
||||||
context: 'awx/192-168-64-4:8443/developer'
|
context: 'awx/192-168-64-4:8443/developer'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -348,11 +357,15 @@ Status
|
|||||||
------
|
------
|
||||||
|
|
||||||
|
|
||||||
|
- This inventory will be removed in version 5.0.0. *[deprecated]*
|
||||||
|
- For more information see `DEPRECATED`_.
|
||||||
|
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
- Chris Houseknecht <@chouseknecht>
|
- Chris Houseknecht (@chouseknecht)
|
||||||
- Fabian von Feilitzsch <@fabianvf>
|
- Fabian von Feilitzsch (@fabianvf)
|
||||||
|
|
||||||
|
|
||||||
.. hint::
|
.. hint::
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ Requirements
|
|||||||
------------
|
------------
|
||||||
The below requirements are needed on the host that executes this module.
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
- PyYAML >= 3.11
|
- PyYAML >= 3.11
|
||||||
- jsonpatch
|
- jsonpatch
|
||||||
|
|
||||||
@@ -220,6 +220,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
||||||
|
<div>Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.</div>
|
||||||
<div>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.</div>
|
<div>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.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -256,6 +257,25 @@ Parameters
|
|||||||
<div>Use in conjunction with <em>api_version</em>, <em>kind</em>, and <em>name</em> to identify a specific object.</div>
|
<div>Use in conjunction with <em>api_version</em>, <em>kind</em>, and <em>name</em> to identify a specific object.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>no_proxy</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>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.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).</div>
|
||||||
|
<div>This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.</div>
|
||||||
|
<div>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"</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -594,7 +614,7 @@ Examples
|
|||||||
path: /metadata/labels/app
|
path: /metadata/labels/app
|
||||||
value: myapp
|
value: myapp
|
||||||
- op: replace
|
- op: replace
|
||||||
patch: /spec/containers/0/image
|
path: /spec/containers/0/image
|
||||||
value: nginx
|
value: nginx
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ Requirements
|
|||||||
------------
|
------------
|
||||||
The below requirements are needed on the host that executes this module.
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
- PyYAML >= 3.11
|
- PyYAML >= 3.11
|
||||||
|
|
||||||
|
|
||||||
@@ -44,6 +44,27 @@ Parameters
|
|||||||
<th>Choices/<font color="blue">Defaults</font></th>
|
<th>Choices/<font color="blue">Defaults</font></th>
|
||||||
<th width="100%">Comments</th>
|
<th width="100%">Comments</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>all_containers</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">boolean</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li>no</li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>If set to <code>true</code>, retrieve all containers' logs in the pod(s).</div>
|
||||||
|
<div>mutually exclusive with <code>container</code>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -141,7 +162,8 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
<div>Use to specify the container within a pod to grab the log from.</div>
|
<div>Use to specify the container within a pod to grab the log from.</div>
|
||||||
<div>If there is only one container, this will default to that container.</div>
|
<div>If there is only one container, this will default to that container.</div>
|
||||||
<div>If there is more than one container, this option is required.</div>
|
<div>If there is more than one container, this option is required or set <em>all_containers</em> to <code>true</code>.</div>
|
||||||
|
<div>mutually exclusive with <code>all_containers</code>.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -240,6 +262,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
||||||
|
<div>Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.</div>
|
||||||
<div>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.</div>
|
<div>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.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -254,6 +277,7 @@ Parameters
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">[]</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>List of label selectors to use to filter results</div>
|
<div>List of label selectors to use to filter results</div>
|
||||||
@@ -295,6 +319,25 @@ Parameters
|
|||||||
<div>If <em>resource definition</em> is provided, the <em>metadata.namespace</em> value from the <em>resource_definition</em> will override this option.</div>
|
<div>If <em>resource definition</em> is provided, the <em>metadata.namespace</em> value from the <em>resource_definition</em> will override this option.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>no_proxy</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>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.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).</div>
|
||||||
|
<div>This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.</div>
|
||||||
|
<div>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"</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -334,6 +377,26 @@ Parameters
|
|||||||
<div>The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169</div>
|
<div>The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>previous</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">boolean</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>If <code>true</code>, print the logs for the previous instance of the container in a pod if it exists.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -435,6 +498,22 @@ Parameters
|
|||||||
<div>A relative time in seconds before the current time from which to show logs.</div>
|
<div>A relative time in seconds before the current time from which to show logs.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>tail_lines</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">integer</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.4.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>A number of lines from the end of the logs to retrieve.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -519,8 +598,16 @@ Examples
|
|||||||
kind: DeploymentConfig
|
kind: DeploymentConfig
|
||||||
namespace: testing
|
namespace: testing
|
||||||
name: example
|
name: example
|
||||||
|
tail_lines: 100
|
||||||
register: log
|
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
|
Return Values
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ Requirements
|
|||||||
------------
|
------------
|
||||||
The below requirements are needed on the local Ansible controller node that executes this lookup.
|
The below requirements are needed on the local Ansible controller node that executes this lookup.
|
||||||
|
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
- PyYAML >= 3.11
|
- PyYAML >= 3.11
|
||||||
|
|
||||||
|
|
||||||
@@ -438,106 +438,28 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late
|
|||||||
|
|
||||||
<table border=0 cellpadding=0 class="documentation-table">
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2">Key</th>
|
<th colspan="1">Key</th>
|
||||||
<th>Returned</th>
|
<th>Returned</th>
|
||||||
<th width="100%">Description</th>
|
<th width="100%">Description</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="1">
|
||||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
<b>_list</b>
|
<b>_list</b>
|
||||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
<div style="font-size: small">
|
<div style="font-size: small">
|
||||||
<span style="color: purple">complex</span>
|
<span style="color: purple">list</span>
|
||||||
|
/ <span style="color: purple">elements=dictionary</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
<div>One ore more object definitions returned from the API.</div>
|
<div>One ore more object definitions returned from the API.</div>
|
||||||
<br/>
|
<br/>
|
||||||
|
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||||
|
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[{'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'}}]</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td class="elbow-placeholder"> </td>
|
|
||||||
<td colspan="1">
|
|
||||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
|
||||||
<b>api_version</b>
|
|
||||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
|
||||||
<div style="font-size: small">
|
|
||||||
<span style="color: purple">string</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>success</td>
|
|
||||||
<td>
|
|
||||||
<div>The versioned schema of this representation of an object.</div>
|
|
||||||
<br/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="elbow-placeholder"> </td>
|
|
||||||
<td colspan="1">
|
|
||||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
|
||||||
<b>kind</b>
|
|
||||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
|
||||||
<div style="font-size: small">
|
|
||||||
<span style="color: purple">string</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>success</td>
|
|
||||||
<td>
|
|
||||||
<div>Represents the REST resource this object represents.</div>
|
|
||||||
<br/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="elbow-placeholder"> </td>
|
|
||||||
<td colspan="1">
|
|
||||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
|
||||||
<b>metadata</b>
|
|
||||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
|
||||||
<div style="font-size: small">
|
|
||||||
<span style="color: purple">complex</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>success</td>
|
|
||||||
<td>
|
|
||||||
<div>Standard object metadata. Includes name, namespace, annotations, labels, etc.</div>
|
|
||||||
<br/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="elbow-placeholder"> </td>
|
|
||||||
<td colspan="1">
|
|
||||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
|
||||||
<b>spec</b>
|
|
||||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
|
||||||
<div style="font-size: small">
|
|
||||||
<span style="color: purple">complex</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>success</td>
|
|
||||||
<td>
|
|
||||||
<div>Specific attributes of the object. Will vary based on the <em>api_version</em> and <em>kind</em>.</div>
|
|
||||||
<br/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="elbow-placeholder"> </td>
|
|
||||||
<td colspan="1">
|
|
||||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
|
||||||
<b>status</b>
|
|
||||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
|
||||||
<div style="font-size: small">
|
|
||||||
<span style="color: purple">complex</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>success</td>
|
|
||||||
<td>
|
|
||||||
<div>Current status details for the object.</div>
|
|
||||||
<br/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|
||||||
@@ -549,8 +471,8 @@ Status
|
|||||||
Authors
|
Authors
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
- Chris Houseknecht <@chouseknecht>
|
- Chris Houseknecht (@chouseknecht)
|
||||||
- Fabian von Feilitzsch <@fabianvf>
|
- Fabian von Feilitzsch (@fabianvf)
|
||||||
|
|
||||||
|
|
||||||
.. hint::
|
.. hint::
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ Requirements
|
|||||||
------------
|
------------
|
||||||
The below requirements are needed on the host that executes this module.
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
- PyYAML >= 3.11
|
- PyYAML >= 3.11
|
||||||
- jsonpatch
|
- jsonpatch
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
<div><code>apply</code> compares the desired resource definition with the previously supplied resource definition, ignoring properties that are automatically generated</div>
|
<div><code>apply</code> compares the desired resource definition with the previously supplied resource definition, ignoring properties that are automatically generated</div>
|
||||||
<div><code>apply</code> works better with Services than 'force=yes'</div>
|
<div><code>apply</code> works better with Services than 'force=yes'</div>
|
||||||
<div>mutually exclusive with <code>merge_type</code></div>
|
<div>Mutually exclusive with <code>merge_type</code>.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -208,6 +208,30 @@ Parameters
|
|||||||
<div>This has no effect on the validation step which is controlled by the <code>validate.fail_on_error</code> parameter.</div>
|
<div>This has no effect on the validation step which is controlled by the <code>validate.fail_on_error</code> parameter.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>delete_all</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">boolean</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.5.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>When this option is set to <em>true</em> and <em>state=absent</em>, module will delete all resources of the specified resource type in the requested namespace.</div>
|
||||||
|
<div>Ignored when <code>state</code> is not set to <em>absent</em> or when one of (src), <code>name</code> or <code>resource_definition</code> is provided.</div>
|
||||||
|
<div>Parameter <code>kind</code> is required to use this option.</div>
|
||||||
|
<div>This parameter can be used with <code>label_selectors</code> to restrict the resources to be deleted.</div>
|
||||||
|
<div style="font-size: small; color: darkgreen"><br/>aliases: all</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -336,6 +360,45 @@ Parameters
|
|||||||
<div>If set to <code>yes</code>, and <em>state</em> is <code>present</code>, an existing object will be replaced.</div>
|
<div>If set to <code>yes</code>, and <em>state</em> is <code>present</code>, an existing object will be replaced.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>generate_name</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Use to specify the basis of an object name and random characters will be added automatically on server to generate a unique name.</div>
|
||||||
|
<div>This option is ignored when <em>state</em> is not set to <code>present</code> or when <em>apply</em> is set to <code>yes</code>.</div>
|
||||||
|
<div>If <em>resource definition</em> is provided, the <em>metadata.generateName</em> value from the <em>resource_definition</em> will override this option.</div>
|
||||||
|
<div>If <em>resource definition</em> is provided, and contains <em>metadata.name</em>, this option is ignored.</div>
|
||||||
|
<div>mutually exclusive with <code>name</code>.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>hidden_fields</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">list</span>
|
||||||
|
/ <span style="color: purple">elements=string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.5.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Hide fields matching this option in the result</div>
|
||||||
|
<div>An example might be <code>hidden_fields=[metadata.managedFields]</code></div>
|
||||||
|
<div>Only field definitions that don't reference list items are supported (so V(spec.containers[0]) would not work)</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -417,6 +480,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
||||||
|
<div>Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.</div>
|
||||||
<div>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.</div>
|
<div>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.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -449,18 +513,17 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
<li>json</li>
|
|
||||||
<li>merge</li>
|
<li>merge</li>
|
||||||
<li>strategic-merge</li>
|
<li>strategic-merge</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>Whether to override the default patch merge approach with a specific type. By default, the strategic merge will typically be used.</div>
|
<div>Whether to override the default patch merge approach with a specific type. By default, the strategic merge will typically be used.</div>
|
||||||
<div>For example, Custom Resource Definitions typically aren't updatable by the usual strategic merge. You may want to use <code>merge</code> if you see "strategic merge patch format is not supported"</div>
|
<div>For example, Custom Resource Definitions typically aren't updatable by the usual strategic merge. You may want to use <code>merge</code> if you see "strategic merge patch format is not supported".</div>
|
||||||
<div>See <a href='https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment'>https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment</a></div>
|
<div>See <a href='https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment'>https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment</a></div>
|
||||||
<div>If more than one <code>merge_type</code> is given, the merge_types will be tried in order. This defaults to <code>['strategic-merge', 'merge']</code>, which is ideal for using the same parameters on resource kinds that combine Custom Resources and built-in resources.</div>
|
<div>If more than one <code>merge_type</code> is given, the merge_types will be tried in order. This defaults to <code>['strategic-merge', 'merge']</code>, which is ideal for using the same parameters on resource kinds that combine Custom Resources and built-in resources.</div>
|
||||||
<div>mutually exclusive with <code>apply</code></div>
|
<div>Mutually exclusive with <code>apply</code>.</div>
|
||||||
<div><em>merge_type=json</em> is deprecated and will be removed in version 3.0.0. Please use <span class='module'>kubernetes.core.k8s_json_patch</span> instead.</div>
|
<div><em>merge_type=json</em> has been removed in version 4.0.0. Please use <span class='module'>kubernetes.core.k8s_json_patch</span> instead.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -499,6 +562,25 @@ Parameters
|
|||||||
<div>If <em>resource definition</em> is provided, the <em>metadata.namespace</em> value from the <em>resource_definition</em> will override this option.</div>
|
<div>If <em>resource definition</em> is provided, the <em>metadata.namespace</em> value from the <em>resource_definition</em> will override this option.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>no_proxy</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>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.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).</div>
|
||||||
|
<div>This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.</div>
|
||||||
|
<div>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"</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -640,6 +722,63 @@ Parameters
|
|||||||
<div style="font-size: small; color: darkgreen"><br/>aliases: definition, inline</div>
|
<div style="font-size: small; color: darkgreen"><br/>aliases: definition, inline</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>server_side_apply</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>When this option is set, apply runs in the server instead of the client.</div>
|
||||||
|
<div>Ignored if <code>apply</code> is not set or is set to False.</div>
|
||||||
|
<div>This option requires "kubernetes >= 19.15.0".</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>field_manager</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
/ <span style="color: red">required</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Name of the manager used to track field ownership.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="elbow-placeholder"></td>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>force_conflicts</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">boolean</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||||
|
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||||
|
<li>yes</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>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.</div>
|
||||||
|
<div>When set to True, server-side apply will force the changes against conflicts.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -654,7 +793,8 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
<div>Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with <em>resource_definition</em>. NOTE: <em>kind</em>, <em>api_version</em>, <em>name</em>, and <em>namespace</em> will be overwritten by corresponding values found in the configuration read in from the <em>src</em> file.</div>
|
<div>Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with <em>resource_definition</em>. NOTE: <em>kind</em>, <em>api_version</em>, <em>name</em>, and <em>namespace</em> will be overwritten by corresponding values found in the configuration read in from the <em>src</em> file.</div>
|
||||||
<div>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 <em>resource_definition</em>. See Examples below.</div>
|
<div>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 <em>resource_definition</em>. See Examples below.</div>
|
||||||
<div>Mutually exclusive with <em>template</em> in case of <span class='module'>k8s</span> module.</div>
|
<div>The URL to manifest files that can be used to create the resource. Added in version 2.4.0.</div>
|
||||||
|
<div>Mutually exclusive with <em>template</em> in case of <span class='module'>kubernetes.core.k8s</span> module.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -1016,6 +1156,14 @@ Examples
|
|||||||
state: present
|
state: present
|
||||||
definition: "{{ lookup('file', '/testing/deployment.yml') | from_yaml }}"
|
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
|
- name: Read definition template file from the Ansible controller file system
|
||||||
kubernetes.core.k8s:
|
kubernetes.core.k8s:
|
||||||
state: present
|
state: present
|
||||||
@@ -1033,10 +1181,10 @@ Examples
|
|||||||
kubernetes.core.k8s:
|
kubernetes.core.k8s:
|
||||||
state: present
|
state: present
|
||||||
template:
|
template:
|
||||||
- path: '/testing/deployment_one.j2'
|
- path: '/testing/deployment_one.j2'
|
||||||
- path: '/testing/deployment_two.j2'
|
- path: '/testing/deployment_two.j2'
|
||||||
variable_start_string: '[['
|
variable_start_string: '[['
|
||||||
variable_end_string: ']]'
|
variable_end_string: ']]'
|
||||||
|
|
||||||
- name: fail on validation errors
|
- name: fail on validation errors
|
||||||
kubernetes.core.k8s:
|
kubernetes.core.k8s:
|
||||||
@@ -1093,6 +1241,41 @@ Examples
|
|||||||
labels:
|
labels:
|
||||||
support: patch
|
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
|
Return Values
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ Requirements
|
|||||||
------------
|
------------
|
||||||
The below requirements are needed on the host that executes this module.
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
- PyYAML >= 3.11
|
- PyYAML >= 3.11
|
||||||
|
|
||||||
|
|
||||||
@@ -152,6 +152,7 @@ Parameters
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">[]</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>List of field selectors to use to filter results.</div>
|
<div>List of field selectors to use to filter results.</div>
|
||||||
@@ -238,6 +239,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
||||||
|
<div>Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.</div>
|
||||||
<div>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.</div>
|
<div>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.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -252,6 +254,7 @@ Parameters
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">[]</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>List of label selectors to use to filter results.</div>
|
<div>List of label selectors to use to filter results.</div>
|
||||||
@@ -293,6 +296,25 @@ Parameters
|
|||||||
<div>If <em>resource definition</em> is provided, the <em>metadata.namespace</em> value from the <em>resource_definition</em> will override this option.</div>
|
<div>If <em>resource definition</em> is provided, the <em>metadata.namespace</em> value from the <em>resource_definition</em> will override this option.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>no_proxy</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>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.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).</div>
|
||||||
|
<div>This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.</div>
|
||||||
|
<div>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"</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ Requirements
|
|||||||
------------
|
------------
|
||||||
The below requirements are needed on the host that executes this module.
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
- PyYAML >= 3.11
|
- PyYAML >= 3.11
|
||||||
|
|
||||||
|
|
||||||
@@ -255,6 +255,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
||||||
|
<div>Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.</div>
|
||||||
<div>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.</div>
|
<div>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.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -270,6 +271,7 @@ Parameters
|
|||||||
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.0.0</div>
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.0.0</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">[]</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>List of label selectors to use to filter results.</div>
|
<div>List of label selectors to use to filter results.</div>
|
||||||
@@ -311,6 +313,25 @@ Parameters
|
|||||||
<div>If <em>resource definition</em> is provided, the <em>metadata.namespace</em> value from the <em>resource_definition</em> will override this option.</div>
|
<div>If <em>resource definition</em> is provided, the <em>metadata.namespace</em> value from the <em>resource_definition</em> will override this option.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>no_proxy</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>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.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).</div>
|
||||||
|
<div>This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.</div>
|
||||||
|
<div>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"</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -497,7 +518,8 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
<div>Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with <em>resource_definition</em>. NOTE: <em>kind</em>, <em>api_version</em>, <em>name</em>, and <em>namespace</em> will be overwritten by corresponding values found in the configuration read in from the <em>src</em> file.</div>
|
<div>Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with <em>resource_definition</em>. NOTE: <em>kind</em>, <em>api_version</em>, <em>name</em>, and <em>namespace</em> will be overwritten by corresponding values found in the configuration read in from the <em>src</em> file.</div>
|
||||||
<div>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 <em>resource_definition</em>. See Examples below.</div>
|
<div>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 <em>resource_definition</em>. See Examples below.</div>
|
||||||
<div>Mutually exclusive with <em>template</em> in case of <span class='module'>k8s</span> module.</div>
|
<div>The URL to manifest files that can be used to create the resource. Added in version 2.4.0.</div>
|
||||||
|
<div>Mutually exclusive with <em>template</em> in case of <span class='module'>kubernetes.core.k8s</span> module.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ Requirements
|
|||||||
------------
|
------------
|
||||||
The below requirements are needed on the host that executes this module.
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
|
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
@@ -220,6 +220,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
||||||
|
<div>Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.</div>
|
||||||
<div>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.</div>
|
<div>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.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -280,6 +281,25 @@ Parameters
|
|||||||
<div>Use to specify a Service object namespace.</div>
|
<div>Use to specify a Service object namespace.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>no_proxy</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">string</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 2.3.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>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.</div>
|
||||||
|
<div>Please note that this module does not pick up typical proxy settings from the environment (e.g. NO_PROXY).</div>
|
||||||
|
<div>This feature requires kubernetes>=19.15.0. When kubernetes library is less than 19.15.0, it fails even no_proxy set in correct.</div>
|
||||||
|
<div>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"</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -468,7 +488,8 @@ Parameters
|
|||||||
<td>
|
<td>
|
||||||
<div>Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with <em>resource_definition</em>. NOTE: <em>kind</em>, <em>api_version</em>, <em>name</em>, and <em>namespace</em> will be overwritten by corresponding values found in the configuration read in from the <em>src</em> file.</div>
|
<div>Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with <em>resource_definition</em>. NOTE: <em>kind</em>, <em>api_version</em>, <em>name</em>, and <em>namespace</em> will be overwritten by corresponding values found in the configuration read in from the <em>src</em> file.</div>
|
||||||
<div>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 <em>resource_definition</em>. See Examples below.</div>
|
<div>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 <em>resource_definition</em>. See Examples below.</div>
|
||||||
<div>Mutually exclusive with <em>template</em> in case of <span class='module'>k8s</span> module.</div>
|
<div>The URL to manifest files that can be used to create the resource. Added in version 2.4.0.</div>
|
||||||
|
<div>Mutually exclusive with <em>template</em> in case of <span class='module'>kubernetes.core.k8s</span> module.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ Requirements
|
|||||||
------------
|
------------
|
||||||
The below requirements are needed on the host that executes this module.
|
The below requirements are needed on the host that executes this module.
|
||||||
|
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
|
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
@@ -182,6 +182,7 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
<div>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 <em>~/.kube/config</em>. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.</div>
|
||||||
|
<div>Multiple Kubernetes config file can be provided using separator ';' for Windows platform or ':' for others platforms.</div>
|
||||||
<div>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.</div>
|
<div>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.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -208,6 +208,28 @@ Parameters
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>Path to a kubectl config file. Defaults to <em>~/.kube/config</em></div>
|
<div>Path to a kubectl config file. Defaults to <em>~/.kube/config</em></div>
|
||||||
|
<div>The configuration can be provided as dictionary. Added in version 2.4.0.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>kubectl_local_env_vars</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">dictionary</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic; font-size: small; color: darkgreen">added in 3.1.0</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">{}</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>var: ansible_kubectl_local_env_vars</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Local enviromantal variable to be passed locally to the kubectl command line.</div>
|
||||||
|
<div>Please be aware that this passes information directly on the command line and it could expose sensitive data.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -354,7 +376,7 @@ Status
|
|||||||
Authors
|
Authors
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
- xuxinkun
|
- xuxinkun (@xuxinkun)
|
||||||
|
|
||||||
|
|
||||||
.. hint::
|
.. hint::
|
||||||
|
|||||||
@@ -77,6 +77,24 @@ Parameters
|
|||||||
<div>If omitted, '.' is assumed.</div>
|
<div>If omitted, '.' is assumed.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>enable_helm</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">-</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">"False"</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Enable the helm chart inflation generator</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="1">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -112,17 +130,21 @@ Examples
|
|||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
- name: Run lookup using kustomize
|
- name: Run lookup using kustomize
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kustomize') }}"
|
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kustomize') }}"
|
||||||
|
|
||||||
- name: Run lookup using kubectl kustomize
|
- name: Run lookup using kubectl kustomize
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kubectl') }}"
|
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kubectl') }}"
|
||||||
|
|
||||||
- name: Create kubernetes resources for lookup output
|
- name: Create kubernetes resources for lookup output
|
||||||
k8s:
|
kubernetes.core.k8s:
|
||||||
definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization') }}"
|
definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization') }}"
|
||||||
|
|
||||||
|
- name: Create kubernetes resources for lookup output with `--enable-helm` set
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization', enable_helm=True) }}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Return Values
|
Return Values
|
||||||
@@ -133,106 +155,27 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late
|
|||||||
|
|
||||||
<table border=0 cellpadding=0 class="documentation-table">
|
<table border=0 cellpadding=0 class="documentation-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2">Key</th>
|
<th colspan="1">Key</th>
|
||||||
<th>Returned</th>
|
<th>Returned</th>
|
||||||
<th width="100%">Description</th>
|
<th width="100%">Description</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="1">
|
||||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||||
<b>_list</b>
|
<b>_list</b>
|
||||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||||
<div style="font-size: small">
|
<div style="font-size: small">
|
||||||
<span style="color: purple">complex</span>
|
<span style="color: purple">string</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
<div>One ore more object definitions returned from the tool execution.</div>
|
<div>YAML string for the object definitions returned from the tool execution.</div>
|
||||||
<br/>
|
<br/>
|
||||||
|
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||||
|
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">{'kind': 'ConfigMap', 'apiVersion': 'v1', 'metadata': {'name': 'my-config-map', 'namespace': 'default'}, 'data': {'key1': 'val1'}}</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td class="elbow-placeholder"> </td>
|
|
||||||
<td colspan="1">
|
|
||||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
|
||||||
<b>api_version</b>
|
|
||||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
|
||||||
<div style="font-size: small">
|
|
||||||
<span style="color: purple">string</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>success</td>
|
|
||||||
<td>
|
|
||||||
<div>The versioned schema of this representation of an object.</div>
|
|
||||||
<br/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="elbow-placeholder"> </td>
|
|
||||||
<td colspan="1">
|
|
||||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
|
||||||
<b>kind</b>
|
|
||||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
|
||||||
<div style="font-size: small">
|
|
||||||
<span style="color: purple">string</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>success</td>
|
|
||||||
<td>
|
|
||||||
<div>Represents the REST resource this object represents.</div>
|
|
||||||
<br/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="elbow-placeholder"> </td>
|
|
||||||
<td colspan="1">
|
|
||||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
|
||||||
<b>metadata</b>
|
|
||||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
|
||||||
<div style="font-size: small">
|
|
||||||
<span style="color: purple">complex</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>success</td>
|
|
||||||
<td>
|
|
||||||
<div>Standard object metadata. Includes name, namespace, annotations, labels, etc.</div>
|
|
||||||
<br/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="elbow-placeholder"> </td>
|
|
||||||
<td colspan="1">
|
|
||||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
|
||||||
<b>spec</b>
|
|
||||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
|
||||||
<div style="font-size: small">
|
|
||||||
<span style="color: purple">complex</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>success</td>
|
|
||||||
<td>
|
|
||||||
<div>Specific attributes of the object. Will vary based on the <em>api_version</em> and <em>kind</em>.</div>
|
|
||||||
<br/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="elbow-placeholder"> </td>
|
|
||||||
<td colspan="1">
|
|
||||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
|
||||||
<b>status</b>
|
|
||||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
|
||||||
<div style="font-size: small">
|
|
||||||
<span style="color: purple">complex</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>success</td>
|
|
||||||
<td>
|
|
||||||
<div>Current status details for the object.</div>
|
|
||||||
<br/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|
||||||
@@ -244,7 +187,7 @@ Status
|
|||||||
Authors
|
Authors
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
- Aubin Bikouo <@abikouo>
|
- Aubin Bikouo (@abikouo)
|
||||||
|
|
||||||
|
|
||||||
.. hint::
|
.. hint::
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ tags:
|
|||||||
- openshift
|
- openshift
|
||||||
- okd
|
- okd
|
||||||
- cluster
|
- cluster
|
||||||
version: 2.4.1
|
version: 4.0.0
|
||||||
build_ignore:
|
build_ignore:
|
||||||
- .DS_Store
|
- .DS_Store
|
||||||
- "*.tar.gz"
|
- "*.tar.gz"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
requires_ansible: ">=2.9.17"
|
requires_ansible: '>=2.14.0'
|
||||||
|
|
||||||
action_groups:
|
action_groups:
|
||||||
helm:
|
helm:
|
||||||
@@ -20,6 +20,12 @@ plugin_routing:
|
|||||||
inventory:
|
inventory:
|
||||||
openshift:
|
openshift:
|
||||||
redirect: community.okd.openshift
|
redirect: community.okd.openshift
|
||||||
|
k8s:
|
||||||
|
deprecation:
|
||||||
|
removal_version: 5.0.0
|
||||||
|
warning_text: >-
|
||||||
|
The k8s inventory plugin has been deprecated and
|
||||||
|
will be removed in release 5.0.0.
|
||||||
modules:
|
modules:
|
||||||
k8s_auth:
|
k8s_auth:
|
||||||
redirect: community.okd.k8s_auth
|
redirect: community.okd.k8s_auth
|
||||||
@@ -29,18 +35,18 @@ plugin_routing:
|
|||||||
warning_text: Use kubernetes.core.k8s_info instead.
|
warning_text: Use kubernetes.core.k8s_info instead.
|
||||||
k8s_raw:
|
k8s_raw:
|
||||||
tombstone:
|
tombstone:
|
||||||
removal_version: "0.1.0"
|
removal_version: 0.1.0
|
||||||
warning_text: The k8s_raw module was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s instead.
|
warning_text: The k8s_raw module was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s instead.
|
||||||
openshift_raw:
|
openshift_raw:
|
||||||
tombstone:
|
tombstone:
|
||||||
removal_version: "0.1.0"
|
removal_version: 0.1.0
|
||||||
warning_text: The openshift_raw module was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s instead.
|
warning_text: The openshift_raw module was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s instead.
|
||||||
openshift_scale:
|
openshift_scale:
|
||||||
tombstone:
|
tombstone:
|
||||||
removal_version: "0.1.0"
|
removal_version: 0.1.0
|
||||||
warning_text: The openshift_scale module was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s_scale instead.
|
warning_text: The openshift_scale module was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s_scale instead.
|
||||||
lookup:
|
lookup:
|
||||||
openshift:
|
openshift:
|
||||||
tombstone:
|
tombstone:
|
||||||
removal_version: "0.1.0"
|
removal_version: 0.1.0
|
||||||
warning_text: The openshift lookup plugin was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s instead.
|
warning_text: The openshift lookup plugin was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s instead.
|
||||||
|
|||||||
@@ -8,21 +8,21 @@ from __future__ import absolute_import, division, print_function
|
|||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import traceback
|
|
||||||
import os
|
import os
|
||||||
from contextlib import contextmanager
|
|
||||||
import platform
|
import platform
|
||||||
|
import traceback
|
||||||
|
from contextlib import contextmanager
|
||||||
|
|
||||||
from ansible.config.manager import ensure_type
|
from ansible.config.manager import ensure_type
|
||||||
from ansible.errors import (
|
from ansible.errors import (
|
||||||
AnsibleError,
|
|
||||||
AnsibleFileNotFound,
|
|
||||||
AnsibleAction,
|
AnsibleAction,
|
||||||
AnsibleActionFail,
|
AnsibleActionFail,
|
||||||
|
AnsibleError,
|
||||||
|
AnsibleFileNotFound,
|
||||||
)
|
)
|
||||||
|
from ansible.module_utils._text import to_bytes, to_native, to_text
|
||||||
from ansible.module_utils.parsing.convert_bool import boolean
|
from ansible.module_utils.parsing.convert_bool import boolean
|
||||||
from ansible.module_utils.six import string_types, iteritems
|
from ansible.module_utils.six import iteritems, string_types
|
||||||
from ansible.module_utils._text import to_text, to_bytes, to_native
|
|
||||||
from ansible.plugins.action import ActionBase
|
from ansible.plugins.action import ActionBase
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +55,6 @@ ENV_KUBECONFIG_PATH_SEPARATOR = ";" if platform.system() == "Windows" else ":"
|
|||||||
|
|
||||||
|
|
||||||
class ActionModule(ActionBase):
|
class ActionModule(ActionBase):
|
||||||
|
|
||||||
TRANSFERS_FILES = True
|
TRANSFERS_FILES = True
|
||||||
DEFAULT_NEWLINE_SEQUENCE = "\n"
|
DEFAULT_NEWLINE_SEQUENCE = "\n"
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,15 @@ DOCUMENTATION = r"""
|
|||||||
- name: ansible_kubectl_extra_args
|
- name: ansible_kubectl_extra_args
|
||||||
env:
|
env:
|
||||||
- name: K8S_AUTH_EXTRA_ARGS
|
- name: K8S_AUTH_EXTRA_ARGS
|
||||||
|
kubectl_local_env_vars:
|
||||||
|
description:
|
||||||
|
- Local enviromantal variable to be passed locally to the kubectl command line.
|
||||||
|
- Please be aware that this passes information directly on the command line and it could expose sensitive data.
|
||||||
|
default: {}
|
||||||
|
type: dict
|
||||||
|
version_added: 3.1.0
|
||||||
|
vars:
|
||||||
|
- name: ansible_kubectl_local_env_vars
|
||||||
kubectl_kubeconfig:
|
kubectl_kubeconfig:
|
||||||
description:
|
description:
|
||||||
- Path to a kubectl config file. Defaults to I(~/.kube/config)
|
- Path to a kubectl config file. Defaults to I(~/.kube/config)
|
||||||
@@ -172,18 +181,18 @@ DOCUMENTATION = r"""
|
|||||||
aliases: [ kubectl_verify_ssl ]
|
aliases: [ kubectl_verify_ssl ]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
import json
|
|
||||||
|
|
||||||
from ansible.parsing.yaml.loader import AnsibleLoader
|
|
||||||
from ansible.errors import AnsibleError, AnsibleFileNotFound
|
from ansible.errors import AnsibleError, AnsibleFileNotFound
|
||||||
from ansible.module_utils.six.moves import shlex_quote
|
|
||||||
from ansible.module_utils._text import to_bytes
|
from ansible.module_utils._text import to_bytes
|
||||||
from ansible.plugins.connection import ConnectionBase, BUFSIZE
|
from ansible.module_utils.six.moves import shlex_quote
|
||||||
|
from ansible.parsing.yaml.loader import AnsibleLoader
|
||||||
|
from ansible.plugins.connection import BUFSIZE, ConnectionBase
|
||||||
from ansible.utils.display import Display
|
from ansible.utils.display import Display
|
||||||
|
|
||||||
display = Display()
|
display = Display()
|
||||||
@@ -301,6 +310,19 @@ class Connection(ConnectionBase):
|
|||||||
|
|
||||||
return local_cmd, censored_local_cmd
|
return local_cmd, censored_local_cmd
|
||||||
|
|
||||||
|
def _local_env(self):
|
||||||
|
"""Return a dict of local environment variables to pass to the kubectl command"""
|
||||||
|
local_env = {}
|
||||||
|
local_local_env_vars_name = "{0}_local_env_vars".format(self.transport)
|
||||||
|
local_env_vars = self.get_option(local_local_env_vars_name)
|
||||||
|
if local_env_vars:
|
||||||
|
if isinstance(local_env_vars, dict):
|
||||||
|
local_env_vars = json.dumps(local_env_vars)
|
||||||
|
local_env = os.environ.copy()
|
||||||
|
local_env.update(json.loads(local_env_vars))
|
||||||
|
return local_env
|
||||||
|
return None
|
||||||
|
|
||||||
def _connect(self, port=None):
|
def _connect(self, port=None):
|
||||||
"""Connect to the container. Nothing to do"""
|
"""Connect to the container. Nothing to do"""
|
||||||
super(Connection, self)._connect()
|
super(Connection, self)._connect()
|
||||||
@@ -329,6 +351,7 @@ class Connection(ConnectionBase):
|
|||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
|
env=self._local_env(),
|
||||||
)
|
)
|
||||||
|
|
||||||
stdout, stderr = p.communicate(in_data)
|
stdout, stderr = p.communicate(in_data)
|
||||||
@@ -378,7 +401,11 @@ class Connection(ConnectionBase):
|
|||||||
args = [to_bytes(i, errors="surrogate_or_strict") for i in args]
|
args = [to_bytes(i, errors="surrogate_or_strict") for i in args]
|
||||||
try:
|
try:
|
||||||
p = subprocess.Popen(
|
p = subprocess.Popen(
|
||||||
args, stdin=in_file, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
args,
|
||||||
|
stdin=in_file,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
env=self._local_env(),
|
||||||
)
|
)
|
||||||
except OSError:
|
except OSError:
|
||||||
raise AnsibleError(
|
raise AnsibleError(
|
||||||
@@ -415,7 +442,11 @@ class Connection(ConnectionBase):
|
|||||||
) as out_file:
|
) as out_file:
|
||||||
try:
|
try:
|
||||||
p = subprocess.Popen(
|
p = subprocess.Popen(
|
||||||
args, stdin=subprocess.PIPE, stdout=out_file, stderr=subprocess.PIPE
|
args,
|
||||||
|
stdin=subprocess.PIPE,
|
||||||
|
stdout=out_file,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
env=self._local_env(),
|
||||||
)
|
)
|
||||||
except OSError:
|
except OSError:
|
||||||
raise AnsibleError(
|
raise AnsibleError(
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ __metaclass__ = type
|
|||||||
|
|
||||||
|
|
||||||
class ModuleDocFragment(object):
|
class ModuleDocFragment(object):
|
||||||
|
|
||||||
DOCUMENTATION = r"""
|
DOCUMENTATION = r"""
|
||||||
options:
|
options:
|
||||||
binary_path:
|
binary_path:
|
||||||
@@ -37,12 +36,12 @@ options:
|
|||||||
description:
|
description:
|
||||||
- Provide a URL for accessing the API. Can also be specified via C(K8S_AUTH_HOST) environment variable.
|
- Provide a URL for accessing the API. Can also be specified via C(K8S_AUTH_HOST) environment variable.
|
||||||
type: str
|
type: str
|
||||||
version_added: "1.2.0"
|
version_added: 1.2.0
|
||||||
api_key:
|
api_key:
|
||||||
description:
|
description:
|
||||||
- Token used to authenticate with the API. Can also be specified via C(K8S_AUTH_API_KEY) environment variable.
|
- Token used to authenticate with the API. Can also be specified via C(K8S_AUTH_API_KEY) environment variable.
|
||||||
type: str
|
type: str
|
||||||
version_added: "1.2.0"
|
version_added: 1.2.0
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- Whether or not to verify the API server's SSL certificates. Can also be specified via C(K8S_AUTH_VERIFY_SSL)
|
- Whether or not to verify the API server's SSL certificates. Can also be specified via C(K8S_AUTH_VERIFY_SSL)
|
||||||
@@ -50,12 +49,12 @@ options:
|
|||||||
type: bool
|
type: bool
|
||||||
aliases: [ verify_ssl ]
|
aliases: [ verify_ssl ]
|
||||||
default: True
|
default: True
|
||||||
version_added: "1.2.0"
|
version_added: 1.2.0
|
||||||
ca_cert:
|
ca_cert:
|
||||||
description:
|
description:
|
||||||
- Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to
|
- 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 C(K8S_AUTH_SSL_CA_CERT) environment variable.
|
avoid certificate validation errors. Can also be specified via C(K8S_AUTH_SSL_CA_CERT) environment variable.
|
||||||
type: path
|
type: path
|
||||||
aliases: [ ssl_ca_cert ]
|
aliases: [ ssl_ca_cert ]
|
||||||
version_added: "1.2.0"
|
version_added: 1.2.0
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ __metaclass__ = type
|
|||||||
|
|
||||||
|
|
||||||
class ModuleDocFragment(object):
|
class ModuleDocFragment(object):
|
||||||
|
|
||||||
DOCUMENTATION = r"""
|
DOCUMENTATION = r"""
|
||||||
options:
|
options:
|
||||||
host:
|
host:
|
||||||
|
|||||||
@@ -11,12 +11,11 @@ __metaclass__ = type
|
|||||||
|
|
||||||
|
|
||||||
class ModuleDocFragment(object):
|
class ModuleDocFragment(object):
|
||||||
|
|
||||||
DOCUMENTATION = r"""
|
DOCUMENTATION = r"""
|
||||||
options:
|
options:
|
||||||
delete_options:
|
delete_options:
|
||||||
type: dict
|
type: dict
|
||||||
version_added: '1.2.0'
|
version_added: 1.2.0
|
||||||
description:
|
description:
|
||||||
- Configure behavior when deleting an object.
|
- Configure behavior when deleting an object.
|
||||||
- Only used when I(state=absent).
|
- Only used when I(state=absent).
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ __metaclass__ = type
|
|||||||
|
|
||||||
|
|
||||||
class ModuleDocFragment(object):
|
class ModuleDocFragment(object):
|
||||||
|
|
||||||
DOCUMENTATION = r"""
|
DOCUMENTATION = r"""
|
||||||
options:
|
options:
|
||||||
api_version:
|
api_version:
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ __metaclass__ = type
|
|||||||
|
|
||||||
|
|
||||||
class ModuleDocFragment(object):
|
class ModuleDocFragment(object):
|
||||||
|
|
||||||
DOCUMENTATION = r"""
|
DOCUMENTATION = r"""
|
||||||
options:
|
options:
|
||||||
resource_definition:
|
resource_definition:
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ __metaclass__ = type
|
|||||||
|
|
||||||
|
|
||||||
class ModuleDocFragment(object):
|
class ModuleDocFragment(object):
|
||||||
|
|
||||||
DOCUMENTATION = r"""
|
DOCUMENTATION = r"""
|
||||||
options:
|
options:
|
||||||
replicas:
|
replicas:
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ __metaclass__ = type
|
|||||||
|
|
||||||
|
|
||||||
class ModuleDocFragment(object):
|
class ModuleDocFragment(object):
|
||||||
|
|
||||||
DOCUMENTATION = r"""
|
DOCUMENTATION = r"""
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ __metaclass__ = type
|
|||||||
|
|
||||||
|
|
||||||
class ModuleDocFragment(object):
|
class ModuleDocFragment(object):
|
||||||
|
|
||||||
DOCUMENTATION = r"""
|
DOCUMENTATION = r"""
|
||||||
options:
|
options:
|
||||||
wait:
|
wait:
|
||||||
|
|||||||
@@ -1,50 +1,12 @@
|
|||||||
# Copyright (c) 2017 Ansible Project
|
# Copyright (c) 2017 Ansible Project
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = r"""
|
|
||||||
|
|
||||||
name: k8s_config_resource_name
|
|
||||||
short_description: Generate resource name for the given resource of type ConfigMap, Secret
|
|
||||||
description:
|
|
||||||
- Generate resource name for the given resource of type ConfigMap, Secret.
|
|
||||||
- Resource must have a C(metadata.name) key to generate a resource name
|
|
||||||
options:
|
|
||||||
_input:
|
|
||||||
description:
|
|
||||||
- A valid YAML definition for a ConfigMap or a Secret.
|
|
||||||
type: dict
|
|
||||||
required: true
|
|
||||||
author:
|
|
||||||
- ansible cloud team
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
EXAMPLES = r"""
|
|
||||||
# Dump generated name for a configmap into a variable
|
|
||||||
- set_fact:
|
|
||||||
generated_name: '{{ definition | kubernetes.core.k8s_config_resource_name }}'
|
|
||||||
vars:
|
|
||||||
definition:
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: myconfigmap
|
|
||||||
namespace: mynamespace
|
|
||||||
"""
|
|
||||||
|
|
||||||
RETURN = r"""
|
|
||||||
_value:
|
|
||||||
description: Generated resource name.
|
|
||||||
type: str
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from ansible.errors import AnsibleFilterError
|
from ansible.errors import AnsibleFilterError
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.hashes import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.hashes import (
|
||||||
generate_hash,
|
generate_hash,
|
||||||
|
|||||||
@@ -19,6 +19,13 @@ DOCUMENTATION = """
|
|||||||
- Uses the kubectl connection plugin to access the Kubernetes cluster.
|
- Uses the kubectl connection plugin to access the Kubernetes cluster.
|
||||||
- Uses k8s.(yml|yaml) YAML configuration file to set parameter values.
|
- Uses k8s.(yml|yaml) YAML configuration file to set parameter values.
|
||||||
|
|
||||||
|
deprecated:
|
||||||
|
removed_in: 5.0.0
|
||||||
|
why: |
|
||||||
|
As discussed in U(https://github.com/ansible-collections/kubernetes.core/issues/31), we decided to
|
||||||
|
remove the k8s inventory plugin in release 5.0.0.
|
||||||
|
alternative: "Use M(kubernetes.core.k8s_info) and M(ansible.builtin.add_host) instead."
|
||||||
|
|
||||||
options:
|
options:
|
||||||
plugin:
|
plugin:
|
||||||
description: token that ensures this is a source file for the 'k8s' plugin.
|
description: token that ensures this is a source file for the 'k8s' plugin.
|
||||||
@@ -27,7 +34,7 @@ DOCUMENTATION = """
|
|||||||
connections:
|
connections:
|
||||||
description:
|
description:
|
||||||
- Optional list of cluster connection settings. If no connections are provided, the default
|
- Optional list of cluster connection settings. If no connections are provided, the default
|
||||||
'~/.kube/config' and active context will be used, and objects will be returned for all namespaces
|
I(~/.kube/config) and active context will be used, and objects will be returned for all namespaces
|
||||||
the active user is authorized to access.
|
the active user is authorized to access.
|
||||||
suboptions:
|
suboptions:
|
||||||
name:
|
name:
|
||||||
@@ -38,7 +45,7 @@ DOCUMENTATION = """
|
|||||||
description:
|
description:
|
||||||
- Path to an existing Kubernetes config file. If not provided, and no other connection
|
- 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
|
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
|
configuration file from I(~/.kube/config). Can also be specified via K8S_AUTH_KUBECONFIG
|
||||||
environment variable.
|
environment variable.
|
||||||
context:
|
context:
|
||||||
description:
|
description:
|
||||||
@@ -86,12 +93,12 @@ DOCUMENTATION = """
|
|||||||
to access.
|
to access.
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 3.6"
|
- "python >= 3.9"
|
||||||
- "kubernetes >= 12.0.0"
|
- "kubernetes >= 24.2.0"
|
||||||
- "PyYAML >= 3.11"
|
- "PyYAML >= 3.11"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = r"""
|
||||||
# File must be named k8s.yaml or k8s.yml
|
# File must be named k8s.yaml or k8s.yml
|
||||||
|
|
||||||
- name: Authenticate with token, and return all pods and services for all namespaces
|
- name: Authenticate with token, and return all pods and services for all namespaces
|
||||||
@@ -117,19 +124,19 @@ EXAMPLES = """
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
|
from ansible.plugins.inventory import BaseInventoryPlugin, Cacheable, Constructable
|
||||||
HAS_K8S_MODULE_HELPER,
|
|
||||||
k8s_import_exception,
|
|
||||||
)
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
|
||||||
get_api_client,
|
|
||||||
)
|
|
||||||
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from kubernetes.dynamic.exceptions import DynamicApiError
|
from kubernetes.dynamic.exceptions import DynamicApiError
|
||||||
except ImportError:
|
|
||||||
pass
|
HAS_K8S_MODULE_HELPER = True
|
||||||
|
k8s_import_exception = None
|
||||||
|
except ImportError as e:
|
||||||
|
HAS_K8S_MODULE_HELPER = False
|
||||||
|
k8s_import_exception = e
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
||||||
|
get_api_client,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def format_dynamic_api_exc(exc):
|
def format_dynamic_api_exc(exc):
|
||||||
@@ -155,6 +162,12 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||||||
|
|
||||||
def parse(self, inventory, loader, path, cache=True):
|
def parse(self, inventory, loader, path, cache=True):
|
||||||
super(InventoryModule, self).parse(inventory, loader, path)
|
super(InventoryModule, self).parse(inventory, loader, path)
|
||||||
|
|
||||||
|
self.display.deprecated(
|
||||||
|
"The 'k8s' inventory plugin has been deprecated and will be removed in release 5.0.0",
|
||||||
|
version="5.0.0",
|
||||||
|
collection_name="kubernetes.core",
|
||||||
|
)
|
||||||
cache_key = self._get_cache_prefix(path)
|
cache_key = self._get_cache_prefix(path)
|
||||||
config_data = self._read_config_data(path)
|
config_data = self._read_config_data(path)
|
||||||
self.setup(config_data, cache, cache_key)
|
self.setup(config_data, cache, cache_key)
|
||||||
@@ -180,7 +193,6 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||||||
self.fetch_objects(connections)
|
self.fetch_objects(connections)
|
||||||
|
|
||||||
def fetch_objects(self, connections):
|
def fetch_objects(self, connections):
|
||||||
|
|
||||||
if connections:
|
if connections:
|
||||||
if not isinstance(connections, list):
|
if not isinstance(connections, list):
|
||||||
raise K8sInventoryException("Expecting connections to be a list.")
|
raise K8sInventoryException("Expecting connections to be a list.")
|
||||||
|
|||||||
@@ -114,8 +114,8 @@ DOCUMENTATION = """
|
|||||||
aliases: [ verify_ssl ]
|
aliases: [ verify_ssl ]
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 3.6"
|
- "python >= 3.9"
|
||||||
- "kubernetes >= 12.0.0"
|
- "kubernetes >= 24.2.0"
|
||||||
- "PyYAML >= 3.11"
|
- "PyYAML >= 3.11"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -179,7 +179,6 @@ import os
|
|||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from ansible.module_utils.common._collections_compat import KeysView
|
from ansible.module_utils.common._collections_compat import KeysView
|
||||||
from ansible.module_utils.common.validation import check_type_bool
|
from ansible.module_utils.common.validation import check_type_bool
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
||||||
get_api_client,
|
get_api_client,
|
||||||
)
|
)
|
||||||
@@ -214,7 +213,6 @@ except ImportError as e:
|
|||||||
|
|
||||||
class KubernetesLookup(object):
|
class KubernetesLookup(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
if not HAS_K8S_MODULE_HELPER:
|
if not HAS_K8S_MODULE_HELPER:
|
||||||
raise Exception(
|
raise Exception(
|
||||||
"Requires the Kubernetes Python client. Try `pip install kubernetes`. Detail: {0}".format(
|
"Requires the Kubernetes Python client. Try `pip install kubernetes`. Detail: {0}".format(
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ DOCUMENTATION = """
|
|||||||
|
|
||||||
short_description: Build a set of kubernetes resources using a 'kustomization.yaml' file.
|
short_description: Build a set of kubernetes resources using a 'kustomization.yaml' file.
|
||||||
|
|
||||||
version_added: "2.2.0"
|
version_added: 2.2.0
|
||||||
|
|
||||||
author:
|
author:
|
||||||
- Aubin Bikouo (@abikouo)
|
- Aubin Bikouo (@abikouo)
|
||||||
@@ -30,6 +30,10 @@ DOCUMENTATION = """
|
|||||||
opt_dirs:
|
opt_dirs:
|
||||||
description:
|
description:
|
||||||
- An optional list of directories to search for the executable in addition to PATH.
|
- An optional list of directories to search for the executable in addition to PATH.
|
||||||
|
enable_helm:
|
||||||
|
description:
|
||||||
|
- Enable the helm chart inflation generator
|
||||||
|
default: "False"
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 3.6"
|
- "python >= 3.6"
|
||||||
@@ -37,16 +41,20 @@ DOCUMENTATION = """
|
|||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- name: Run lookup using kustomize
|
- name: Run lookup using kustomize
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kustomize') }}"
|
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kustomize') }}"
|
||||||
|
|
||||||
- name: Run lookup using kubectl kustomize
|
- name: Run lookup using kubectl kustomize
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kubectl') }}"
|
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kubectl') }}"
|
||||||
|
|
||||||
- name: Create kubernetes resources for lookup output
|
- name: Create kubernetes resources for lookup output
|
||||||
k8s:
|
kubernetes.core.k8s:
|
||||||
definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization') }}"
|
definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization') }}"
|
||||||
|
|
||||||
|
- name: Create kubernetes resources for lookup output with `--enable-helm` set
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization', enable_helm=True) }}"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN = """
|
RETURN = """
|
||||||
@@ -64,13 +72,12 @@ RETURN = """
|
|||||||
key1: val1
|
key1: val1
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible.errors import AnsibleLookupError
|
|
||||||
from ansible.plugins.lookup import LookupBase
|
|
||||||
from ansible.module_utils.common.process import get_bin_path
|
|
||||||
|
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
from ansible.errors import AnsibleLookupError
|
||||||
|
from ansible.module_utils.common.process import get_bin_path
|
||||||
|
from ansible.plugins.lookup import LookupBase
|
||||||
|
|
||||||
|
|
||||||
def get_binary_from_path(name, opt_dirs=None):
|
def get_binary_from_path(name, opt_dirs=None):
|
||||||
opt_arg = {}
|
opt_arg = {}
|
||||||
@@ -92,7 +99,14 @@ def run_command(command):
|
|||||||
|
|
||||||
class LookupModule(LookupBase):
|
class LookupModule(LookupBase):
|
||||||
def run(
|
def run(
|
||||||
self, terms, variables=None, dir=".", binary_path=None, opt_dirs=None, **kwargs
|
self,
|
||||||
|
terms,
|
||||||
|
variables=None,
|
||||||
|
dir=".",
|
||||||
|
binary_path=None,
|
||||||
|
opt_dirs=None,
|
||||||
|
enable_helm=False,
|
||||||
|
**kwargs
|
||||||
):
|
):
|
||||||
executable_path = binary_path
|
executable_path = binary_path
|
||||||
if executable_path is None:
|
if executable_path is None:
|
||||||
@@ -123,6 +137,9 @@ class LookupModule(LookupBase):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if enable_helm:
|
||||||
|
command += ["--enable-helm"]
|
||||||
|
|
||||||
(out, err) = run_command(command)
|
(out, err) = run_command(command)
|
||||||
if err:
|
if err:
|
||||||
raise AnsibleLookupError(
|
raise AnsibleLookupError(
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ except TypeError:
|
|||||||
|
|
||||||
if enable_turbo_mode:
|
if enable_turbo_mode:
|
||||||
try:
|
try:
|
||||||
from ansible_collections.cloud.common.plugins.module_utils.turbo.module import (
|
from ansible_collections.cloud.common.plugins.module_utils.turbo.module import ( # noqa: F401
|
||||||
AnsibleTurboModule as AnsibleModule,
|
AnsibleTurboModule as AnsibleModule,
|
||||||
) # noqa: F401
|
)
|
||||||
|
|
||||||
AnsibleModule.collection_name = "kubernetes.core"
|
AnsibleModule.collection_name = "kubernetes.core"
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ from __future__ import absolute_import, division, print_function
|
|||||||
|
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from collections import OrderedDict
|
|
||||||
import json
|
import json
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
from ansible.module_utils.common.dict_transformations import dict_merge
|
from ansible.module_utils.common.dict_transformations import dict_merge
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.exceptions import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.exceptions import (
|
||||||
@@ -31,7 +31,6 @@ from ansible_collections.kubernetes.core.plugins.module_utils.version import (
|
|||||||
LooseVersion,
|
LooseVersion,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from kubernetes.dynamic.exceptions import NotFoundError
|
from kubernetes.dynamic.exceptions import NotFoundError
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@@ -150,6 +149,7 @@ def k8s_apply(resource, definition, **kwargs):
|
|||||||
force_conflicts=kwargs.get("force_conflicts"),
|
force_conflicts=kwargs.get("force_conflicts"),
|
||||||
field_manager=kwargs.get("field_manager"),
|
field_manager=kwargs.get("field_manager"),
|
||||||
dry_run=kwargs.get("dry_run"),
|
dry_run=kwargs.get("dry_run"),
|
||||||
|
serialize=kwargs.get("serialize"),
|
||||||
)
|
)
|
||||||
if not existing:
|
if not existing:
|
||||||
return resource.create(
|
return resource.create(
|
||||||
@@ -159,6 +159,7 @@ def k8s_apply(resource, definition, **kwargs):
|
|||||||
return resource.get(
|
return resource.get(
|
||||||
name=definition["metadata"]["name"],
|
name=definition["metadata"]["name"],
|
||||||
namespace=definition["metadata"].get("namespace"),
|
namespace=definition["metadata"].get("namespace"),
|
||||||
|
**kwargs
|
||||||
)
|
)
|
||||||
return resource.patch(
|
return resource.patch(
|
||||||
body=desired,
|
body=desired,
|
||||||
|
|||||||
@@ -13,15 +13,18 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from collections import defaultdict
|
|
||||||
import hashlib
|
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from collections import defaultdict
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
import kubernetes.dynamic
|
import kubernetes.dynamic
|
||||||
import kubernetes.dynamic.discovery
|
import kubernetes.dynamic.discovery
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.client.resource import (
|
||||||
|
ResourceList,
|
||||||
|
)
|
||||||
from kubernetes import __version__
|
from kubernetes import __version__
|
||||||
from kubernetes.dynamic.exceptions import (
|
from kubernetes.dynamic.exceptions import (
|
||||||
ResourceNotFoundError,
|
ResourceNotFoundError,
|
||||||
@@ -29,10 +32,6 @@ from kubernetes.dynamic.exceptions import (
|
|||||||
ServiceUnavailableError,
|
ServiceUnavailableError,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.client.resource import (
|
|
||||||
ResourceList,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Discoverer(kubernetes.dynamic.discovery.Discoverer):
|
class Discoverer(kubernetes.dynamic.discovery.Discoverer):
|
||||||
def __init__(self, client, cache_file):
|
def __init__(self, client, cache_file):
|
||||||
@@ -114,7 +113,7 @@ class Discoverer(kubernetes.dynamic.discovery.Discoverer):
|
|||||||
filter(lambda resource: "/" in resource["name"], resources_response)
|
filter(lambda resource: "/" in resource["name"], resources_response)
|
||||||
)
|
)
|
||||||
for subresource in subresources_raw:
|
for subresource in subresources_raw:
|
||||||
resource, name = subresource["name"].split("/")
|
resource, name = subresource["name"].split("/", 1)
|
||||||
subresources[resource][name] = subresource
|
subresources[resource][name] = subresource
|
||||||
|
|
||||||
for resource in resources_raw:
|
for resource in resources_raw:
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -18,25 +18,26 @@ from __future__ import absolute_import, division, print_function
|
|||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from tempfile import TemporaryFile, NamedTemporaryFile
|
|
||||||
from select import select
|
|
||||||
from abc import ABCMeta, abstractmethod
|
|
||||||
import tarfile
|
import tarfile
|
||||||
|
from abc import ABCMeta, abstractmethod
|
||||||
|
from select import select
|
||||||
|
from tempfile import NamedTemporaryFile, TemporaryFile
|
||||||
|
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
# from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import AnsibleModule
|
# from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import AnsibleModule
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
||||||
CoreException,
|
CoreException,
|
||||||
)
|
)
|
||||||
from ansible.module_utils._text import to_native
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from kubernetes.client.api import core_v1_api
|
from kubernetes.client.api import core_v1_api
|
||||||
from kubernetes.stream import stream
|
from kubernetes.stream import stream
|
||||||
from kubernetes.stream.ws_client import (
|
from kubernetes.stream.ws_client import (
|
||||||
STDOUT_CHANNEL,
|
|
||||||
STDERR_CHANNEL,
|
|
||||||
ERROR_CHANNEL,
|
|
||||||
ABNF,
|
ABNF,
|
||||||
|
ERROR_CHANNEL,
|
||||||
|
STDERR_CHANNEL,
|
||||||
|
STDOUT_CHANNEL,
|
||||||
)
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ from __future__ import absolute_import, division, print_function
|
|||||||
|
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
import json
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import json
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import string
|
import string
|
||||||
@@ -37,7 +37,7 @@ except ImportError:
|
|||||||
|
|
||||||
def sorted_dict(unsorted_dict):
|
def sorted_dict(unsorted_dict):
|
||||||
result = OrderedDict()
|
result = OrderedDict()
|
||||||
for (k, v) in sorted(unsorted_dict.items()):
|
for k, v in sorted(unsorted_dict.items()):
|
||||||
if isinstance(v, dict):
|
if isinstance(v, dict):
|
||||||
v = sorted_dict(v)
|
v = sorted_dict(v)
|
||||||
result[k] = v
|
result[k] = v
|
||||||
|
|||||||
@@ -7,19 +7,18 @@ from __future__ import absolute_import, division, print_function
|
|||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
|
import copy
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import tempfile
|
import tempfile
|
||||||
import traceback
|
import traceback
|
||||||
import re
|
|
||||||
import json
|
|
||||||
import copy
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
from ansible.module_utils.six import string_types
|
from ansible.module_utils.six import string_types
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.version import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.version import (
|
||||||
LooseVersion,
|
LooseVersion,
|
||||||
)
|
)
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import yaml
|
import yaml
|
||||||
@@ -84,7 +83,6 @@ class AnsibleHelmModule(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
|
||||||
self._module = None
|
self._module = None
|
||||||
if "module" in kwargs:
|
if "module" in kwargs:
|
||||||
self._module = kwargs.get("module")
|
self._module = kwargs.get("module")
|
||||||
@@ -117,7 +115,7 @@ class AnsibleHelmModule(object):
|
|||||||
kubeconfig = self.params.get("kubeconfig")
|
kubeconfig = self.params.get("kubeconfig")
|
||||||
if kubeconfig:
|
if kubeconfig:
|
||||||
if isinstance(kubeconfig, string_types):
|
if isinstance(kubeconfig, string_types):
|
||||||
with open(kubeconfig) as fd:
|
with open(os.path.expanduser(kubeconfig)) as fd:
|
||||||
kubeconfig_content = yaml.safe_load(fd)
|
kubeconfig_content = yaml.safe_load(fd)
|
||||||
elif isinstance(kubeconfig, dict):
|
elif isinstance(kubeconfig, dict):
|
||||||
kubeconfig_content = kubeconfig
|
kubeconfig_content = kubeconfig
|
||||||
@@ -184,7 +182,6 @@ class AnsibleHelmModule(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def get_helm_version(self):
|
def get_helm_version(self):
|
||||||
|
|
||||||
command = self.get_helm_binary() + " version"
|
command = self.get_helm_binary() + " version"
|
||||||
rc, out, err = self.run_command(command)
|
rc, out, err = self.run_command(command)
|
||||||
m = re.match(r'version.BuildInfo{Version:"v([0-9\.]*)",', out)
|
m = re.match(r'version.BuildInfo{Version:"v([0-9\.]*)",', out)
|
||||||
@@ -216,7 +213,6 @@ class AnsibleHelmModule(object):
|
|||||||
return yaml.safe_load(out)
|
return yaml.safe_load(out)
|
||||||
|
|
||||||
def parse_yaml_content(self, content):
|
def parse_yaml_content(self, content):
|
||||||
|
|
||||||
if not HAS_YAML:
|
if not HAS_YAML:
|
||||||
self.fail_json(msg=missing_required_lib("yaml"), exception=HAS_YAML)
|
self.fail_json(msg=missing_required_lib("yaml"), exception=HAS_YAML)
|
||||||
|
|
||||||
@@ -228,7 +224,6 @@ class AnsibleHelmModule(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def get_manifest(self, release_name):
|
def get_manifest(self, release_name):
|
||||||
|
|
||||||
command = [
|
command = [
|
||||||
self.get_helm_binary(),
|
self.get_helm_binary(),
|
||||||
"get",
|
"get",
|
||||||
@@ -241,7 +236,6 @@ class AnsibleHelmModule(object):
|
|||||||
return self.parse_yaml_content(out)
|
return self.parse_yaml_content(out)
|
||||||
|
|
||||||
def get_notes(self, release_name):
|
def get_notes(self, release_name):
|
||||||
|
|
||||||
command = [
|
command = [
|
||||||
self.get_helm_binary(),
|
self.get_helm_binary(),
|
||||||
"get",
|
"get",
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
# Copyright: (c) 2021, Red Hat | Ansible
|
# Copyright: (c) 2021, Red Hat | Ansible
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
import os
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import os
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from ansible.module_utils.six import iteritems, string_types
|
from ansible.module_utils.six import iteritems, string_types
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
||||||
AUTH_ARG_MAP,
|
AUTH_ARG_MAP,
|
||||||
AUTH_ARG_SPEC,
|
AUTH_ARG_SPEC,
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
|
from ansible.module_utils.common.text.converters import to_text
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.version import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.version import (
|
||||||
LooseVersion,
|
LooseVersion,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible.module_utils.basic import missing_required_lib
|
|
||||||
from ansible.module_utils.common.text.converters import to_text
|
|
||||||
|
|
||||||
|
|
||||||
class AnsibleK8SModule:
|
class AnsibleK8SModule:
|
||||||
"""A base module class for K8S modules.
|
"""A base module class for K8S modules.
|
||||||
@@ -38,7 +35,7 @@ class AnsibleK8SModule:
|
|||||||
|
|
||||||
if self.settings["check_k8s"]:
|
if self.settings["check_k8s"]:
|
||||||
self.requires("kubernetes")
|
self.requires("kubernetes")
|
||||||
self.has_at_least("kubernetes", "12.0.0", warn=True)
|
self.has_at_least("kubernetes", "24.2.0", warn=True)
|
||||||
|
|
||||||
if self.settings["check_pyyaml"]:
|
if self.settings["check_pyyaml"]:
|
||||||
self.requires("pyyaml")
|
self.requires("pyyaml")
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from typing import cast, Dict, Iterable, List, Optional, Union
|
from typing import Dict, Iterable, List, Optional, Union, cast
|
||||||
|
|
||||||
from ansible.module_utils.six import string_types
|
from ansible.module_utils.six import string_types
|
||||||
from ansible.module_utils.urls import Request
|
from ansible.module_utils.urls import Request
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
||||||
get_api_client,
|
get_api_client,
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
||||||
CoreException,
|
CoreException,
|
||||||
|
ResourceTimeout,
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.resource import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.resource import (
|
||||||
create_definitions,
|
create_definitions,
|
||||||
@@ -17,9 +17,7 @@ from ansible_collections.kubernetes.core.plugins.module_utils.k8s.resource impor
|
|||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.service import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.service import (
|
||||||
K8sService,
|
K8sService,
|
||||||
diff_objects,
|
diff_objects,
|
||||||
)
|
hide_fields,
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
|
||||||
ResourceTimeout,
|
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.waiter import exists
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.waiter import exists
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.selector import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.selector import (
|
||||||
@@ -46,16 +44,51 @@ def validate(client, module, resource):
|
|||||||
return [_prepend_resource_info(resource, msg) for msg in warnings + errors]
|
return [_prepend_resource_info(resource, msg) for msg in warnings + errors]
|
||||||
|
|
||||||
|
|
||||||
|
def get_definitions(svc, params):
|
||||||
|
try:
|
||||||
|
definitions = create_definitions(params)
|
||||||
|
except Exception as e:
|
||||||
|
msg = "Failed to load resource definition: {0}".format(e)
|
||||||
|
raise CoreException(msg) from e
|
||||||
|
|
||||||
|
delete_all = params.get("delete_all")
|
||||||
|
src = params.get("src")
|
||||||
|
resource_definition = params.get("resource_definition")
|
||||||
|
name = params.get("name")
|
||||||
|
state = params.get("state")
|
||||||
|
|
||||||
|
if (
|
||||||
|
delete_all
|
||||||
|
and state == "absent"
|
||||||
|
and name is None
|
||||||
|
and resource_definition is None
|
||||||
|
and src is None
|
||||||
|
):
|
||||||
|
# Delete all resources in the namespace for the specified resource type
|
||||||
|
if params.get("kind") is None:
|
||||||
|
raise CoreException(
|
||||||
|
"'kind' option is required to specify the resource type."
|
||||||
|
)
|
||||||
|
|
||||||
|
resource = svc.find_resource(
|
||||||
|
params.get("kind"), params.get("api_version"), fail=True
|
||||||
|
)
|
||||||
|
definitions = svc.retrieve_all(
|
||||||
|
resource,
|
||||||
|
params.get("namespace"),
|
||||||
|
params.get("label_selectors"),
|
||||||
|
)
|
||||||
|
|
||||||
|
return definitions
|
||||||
|
|
||||||
|
|
||||||
def run_module(module) -> None:
|
def run_module(module) -> None:
|
||||||
results = []
|
results = []
|
||||||
changed = False
|
changed = False
|
||||||
client = get_api_client(module)
|
client = get_api_client(module)
|
||||||
svc = K8sService(client, module)
|
svc = K8sService(client, module)
|
||||||
try:
|
|
||||||
definitions = create_definitions(module.params)
|
definitions = get_definitions(svc, module.params)
|
||||||
except Exception as e:
|
|
||||||
msg = "Failed to load resource definition: {0}".format(e)
|
|
||||||
raise CoreException(msg) from e
|
|
||||||
|
|
||||||
for definition in definitions:
|
for definition in definitions:
|
||||||
result = {"changed": False, "result": {}}
|
result = {"changed": False, "result": {}}
|
||||||
@@ -102,9 +135,11 @@ def perform_action(svc, definition: Dict, params: Dict) -> Dict:
|
|||||||
state = params.get("state", None)
|
state = params.get("state", None)
|
||||||
kind = definition.get("kind")
|
kind = definition.get("kind")
|
||||||
api_version = definition.get("apiVersion")
|
api_version = definition.get("apiVersion")
|
||||||
|
hidden_fields = params.get("hidden_fields")
|
||||||
|
|
||||||
result = {"changed": False, "result": {}}
|
result = {"changed": False, "result": {}}
|
||||||
instance = {}
|
instance = {}
|
||||||
|
warnings = []
|
||||||
|
|
||||||
resource = svc.find_resource(kind, api_version, fail=True)
|
resource = svc.find_resource(kind, api_version, fail=True)
|
||||||
definition["kind"] = resource.kind
|
definition["kind"] = resource.kind
|
||||||
@@ -138,7 +173,7 @@ def perform_action(svc, definition: Dict, params: Dict) -> Dict:
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
if params.get("apply"):
|
if params.get("apply"):
|
||||||
instance = svc.apply(resource, definition, existing)
|
instance, warnings = svc.apply(resource, definition, existing)
|
||||||
result["method"] = "apply"
|
result["method"] = "apply"
|
||||||
elif not existing:
|
elif not existing:
|
||||||
if state == "patched":
|
if state == "patched":
|
||||||
@@ -149,16 +184,19 @@ def perform_action(svc, definition: Dict, params: Dict) -> Dict:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
instance = svc.create(resource, definition)
|
instance, warnings = svc.create(resource, definition)
|
||||||
result["method"] = "create"
|
result["method"] = "create"
|
||||||
result["changed"] = True
|
result["changed"] = True
|
||||||
elif params.get("force", False):
|
elif params.get("force", False):
|
||||||
instance = svc.replace(resource, definition, existing)
|
instance, warnings = svc.replace(resource, definition, existing)
|
||||||
result["method"] = "replace"
|
result["method"] = "replace"
|
||||||
else:
|
else:
|
||||||
instance = svc.update(resource, definition, existing)
|
instance, warnings = svc.update(resource, definition, existing)
|
||||||
result["method"] = "update"
|
result["method"] = "update"
|
||||||
|
|
||||||
|
if warnings:
|
||||||
|
result["warnings"] = warnings
|
||||||
|
|
||||||
# If needed, wait and/or create diff
|
# If needed, wait and/or create diff
|
||||||
success = True
|
success = True
|
||||||
|
|
||||||
@@ -177,7 +215,7 @@ def perform_action(svc, definition: Dict, params: Dict) -> Dict:
|
|||||||
existing = existing.to_dict()
|
existing = existing.to_dict()
|
||||||
else:
|
else:
|
||||||
existing = {}
|
existing = {}
|
||||||
match, diffs = diff_objects(existing, instance)
|
match, diffs = diff_objects(existing, instance, hidden_fields)
|
||||||
if match and diffs:
|
if match and diffs:
|
||||||
result.setdefault("warnings", []).append(
|
result.setdefault("warnings", []).append(
|
||||||
"No meaningful diff was generated, but the API may not be idempotent "
|
"No meaningful diff was generated, but the API may not be idempotent "
|
||||||
@@ -187,7 +225,7 @@ def perform_action(svc, definition: Dict, params: Dict) -> Dict:
|
|||||||
if svc.module._diff:
|
if svc.module._diff:
|
||||||
result["diff"] = diffs
|
result["diff"] = diffs
|
||||||
|
|
||||||
result["result"] = instance
|
result["result"] = hide_fields(instance, hidden_fields)
|
||||||
if not success:
|
if not success:
|
||||||
raise ResourceTimeout(
|
raise ResourceTimeout(
|
||||||
'"{0}" "{1}": Timed out waiting on resource'.format(
|
'"{0}" "{1}": Timed out waiting on resource'.format(
|
||||||
|
|||||||
@@ -1,38 +1,35 @@
|
|||||||
# Copyright: (c) 2021, Red Hat | Ansible
|
# Copyright: (c) 2021, Red Hat | Ansible
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
import copy
|
||||||
|
from json import loads
|
||||||
|
from re import compile
|
||||||
from typing import Any, Dict, List, Optional, Tuple
|
from typing import Any, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
|
from ansible.module_utils.common.dict_transformations import dict_merge
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.hashes import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.hashes import (
|
||||||
generate_hash,
|
generate_hash,
|
||||||
)
|
)
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import requires
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.waiter import (
|
|
||||||
Waiter,
|
|
||||||
exists,
|
|
||||||
resource_absent,
|
|
||||||
get_waiter,
|
|
||||||
)
|
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import (
|
|
||||||
requires,
|
|
||||||
)
|
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
||||||
CoreException,
|
CoreException,
|
||||||
)
|
)
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.waiter import (
|
||||||
from ansible.module_utils.common.dict_transformations import dict_merge
|
Waiter,
|
||||||
|
exists,
|
||||||
|
get_waiter,
|
||||||
|
resource_absent,
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from kubernetes.dynamic.exceptions import (
|
from kubernetes.dynamic.exceptions import (
|
||||||
NotFoundError,
|
BadRequestError,
|
||||||
ResourceNotFoundError,
|
|
||||||
ResourceNotUniqueError,
|
|
||||||
ConflictError,
|
ConflictError,
|
||||||
ForbiddenError,
|
ForbiddenError,
|
||||||
MethodNotAllowedError,
|
MethodNotAllowedError,
|
||||||
BadRequestError,
|
NotFoundError,
|
||||||
|
ResourceNotFoundError,
|
||||||
|
ResourceNotUniqueError,
|
||||||
)
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# Handled in module setup
|
# Handled in module setup
|
||||||
@@ -147,18 +144,12 @@ class K8sService:
|
|||||||
name: str,
|
name: str,
|
||||||
namespace: str,
|
namespace: str,
|
||||||
merge_type: str = None,
|
merge_type: str = None,
|
||||||
) -> Dict:
|
) -> Tuple[Dict, List[str]]:
|
||||||
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",
|
|
||||||
collection_name="kubernetes.core",
|
|
||||||
)
|
|
||||||
try:
|
try:
|
||||||
params = dict(name=name, namespace=namespace)
|
params = dict(name=name, namespace=namespace, serialize=False)
|
||||||
if merge_type:
|
if merge_type:
|
||||||
params["content_type"] = "application/{0}-patch+json".format(merge_type)
|
params["content_type"] = "application/{0}-patch+json".format(merge_type)
|
||||||
return self.client.patch(resource, definition, **params).to_dict()
|
return decode_response(self.client.patch(resource, definition, **params))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
reason = e.body if hasattr(e, "body") else e
|
reason = e.body if hasattr(e, "body") else e
|
||||||
msg = "Failed to patch object: {0}".format(reason)
|
msg = "Failed to patch object: {0}".format(reason)
|
||||||
@@ -211,6 +202,30 @@ class K8sService:
|
|||||||
|
|
||||||
return existing
|
return existing
|
||||||
|
|
||||||
|
def retrieve_all(
|
||||||
|
self, resource: Resource, namespace: str, label_selectors: List[str] = None
|
||||||
|
) -> List[Dict]:
|
||||||
|
definitions: List[ResourceInstance] = []
|
||||||
|
|
||||||
|
try:
|
||||||
|
params = dict(namespace=namespace)
|
||||||
|
if label_selectors:
|
||||||
|
params["label_selector"] = ",".join(label_selectors)
|
||||||
|
resource_list = self.client.get(resource, **params)
|
||||||
|
for item in resource_list.items:
|
||||||
|
existing = self.client.get(
|
||||||
|
resource, name=item.metadata.name, namespace=namespace
|
||||||
|
)
|
||||||
|
definitions.append(existing.to_dict())
|
||||||
|
except (NotFoundError, MethodNotAllowedError):
|
||||||
|
pass
|
||||||
|
except Exception as e:
|
||||||
|
reason = e.body if hasattr(e, "body") else e
|
||||||
|
msg = "Failed to retrieve requested object: {0}".format(reason)
|
||||||
|
raise CoreException(msg) from e
|
||||||
|
|
||||||
|
return definitions
|
||||||
|
|
||||||
def find(
|
def find(
|
||||||
self,
|
self,
|
||||||
kind: str,
|
kind: str,
|
||||||
@@ -224,6 +239,7 @@ class K8sService:
|
|||||||
wait_timeout: Optional[int] = 120,
|
wait_timeout: Optional[int] = 120,
|
||||||
state: Optional[str] = "present",
|
state: Optional[str] = "present",
|
||||||
condition: Optional[Dict] = None,
|
condition: Optional[Dict] = None,
|
||||||
|
hidden_fields: Optional[List] = None,
|
||||||
) -> Dict:
|
) -> Dict:
|
||||||
resource = self.find_resource(kind, api_version)
|
resource = self.find_resource(kind, api_version)
|
||||||
api_found = bool(resource)
|
api_found = bool(resource)
|
||||||
@@ -286,7 +302,9 @@ class K8sService:
|
|||||||
instances = resources.get("items") or [resources]
|
instances = resources.get("items") or [resources]
|
||||||
|
|
||||||
if not wait:
|
if not wait:
|
||||||
result["resources"] = instances
|
result["resources"] = [
|
||||||
|
hide_fields(instance, hidden_fields) for instance in instances
|
||||||
|
]
|
||||||
return result
|
return result
|
||||||
|
|
||||||
# Now wait for the specified state of any resource instances we have found.
|
# Now wait for the specified state of any resource instances we have found.
|
||||||
@@ -305,126 +323,127 @@ class K8sService:
|
|||||||
"Failed to gather information about %s(s) even"
|
"Failed to gather information about %s(s) even"
|
||||||
" after waiting for %s seconds" % (res.get("kind"), duration)
|
" after waiting for %s seconds" % (res.get("kind"), duration)
|
||||||
)
|
)
|
||||||
result["resources"].append(res)
|
result["resources"].append(hide_fields(res, hidden_fields))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def create(self, resource: Resource, definition: Dict) -> Dict:
|
def create(self, resource: Resource, definition: Dict) -> Tuple[Dict, List[str]]:
|
||||||
namespace = definition["metadata"].get("namespace")
|
namespace = definition["metadata"].get("namespace")
|
||||||
name = definition["metadata"].get("name")
|
name = definition["metadata"].get("name")
|
||||||
|
|
||||||
if self._client_side_dry_run:
|
if self._client_side_dry_run:
|
||||||
k8s_obj = _encode_stringdata(definition)
|
return _encode_stringdata(definition), []
|
||||||
else:
|
|
||||||
try:
|
try:
|
||||||
k8s_obj = self.client.create(
|
return decode_response(
|
||||||
resource, definition, namespace=namespace
|
self.client.create(
|
||||||
).to_dict()
|
resource, definition, namespace=namespace, serialize=False
|
||||||
except ConflictError:
|
|
||||||
# Some resources, like ProjectRequests, can't be created multiple times,
|
|
||||||
# because the resources that they create don't match their kind
|
|
||||||
# In this case we'll mark it as unchanged and warn the user
|
|
||||||
self.module.warn(
|
|
||||||
"{0} was not found, but creating it returned a 409 Conflict error. This can happen \
|
|
||||||
if the resource you are creating does not directly create a resource of the same kind.".format(
|
|
||||||
name
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return dict()
|
)
|
||||||
except Exception as e:
|
except ConflictError:
|
||||||
reason = e.body if hasattr(e, "body") else e
|
# Some resources, like ProjectRequests, can't be created multiple times,
|
||||||
msg = "Failed to create object: {0}".format(reason)
|
# because the resources that they create don't match their kind
|
||||||
raise CoreException(msg) from e
|
# In this case we'll mark it as unchanged and warn the user
|
||||||
return k8s_obj
|
self.module.warn(
|
||||||
|
"{0} was not found, but creating it returned a 409 Conflict error. This can happen \
|
||||||
|
if the resource you are creating does not directly create a resource of the same kind.".format(
|
||||||
|
name
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return dict(), []
|
||||||
|
except Exception as e:
|
||||||
|
reason = e.body if hasattr(e, "body") else e
|
||||||
|
msg = "Failed to create object: {0}".format(reason)
|
||||||
|
raise CoreException(msg) from e
|
||||||
|
|
||||||
def apply(
|
def apply(
|
||||||
self,
|
self,
|
||||||
resource: Resource,
|
resource: Resource,
|
||||||
definition: Dict,
|
definition: Dict,
|
||||||
existing: Optional[ResourceInstance] = None,
|
existing: Optional[ResourceInstance] = None,
|
||||||
) -> Dict:
|
) -> Tuple[Dict, List[str]]:
|
||||||
namespace = definition["metadata"].get("namespace")
|
namespace = definition["metadata"].get("namespace")
|
||||||
|
|
||||||
server_side_apply = self.module.params.get("server_side_apply")
|
server_side_apply = self.module.params.get("server_side_apply")
|
||||||
if server_side_apply:
|
if server_side_apply:
|
||||||
requires("kubernetes", "19.15.0", reason="to use server side apply")
|
requires("kubernetes", "19.15.0", reason="to use server side apply")
|
||||||
|
|
||||||
if self._client_side_dry_run:
|
if self._client_side_dry_run:
|
||||||
ignored, patch = apply_object(resource, _encode_stringdata(definition))
|
ignored, patch = apply_object(resource, _encode_stringdata(definition))
|
||||||
if existing:
|
if existing:
|
||||||
k8s_obj = dict_merge(existing.to_dict(), patch)
|
return dict_merge(existing.to_dict(), patch), []
|
||||||
else:
|
else:
|
||||||
k8s_obj = patch
|
return patch, []
|
||||||
else:
|
|
||||||
try:
|
try:
|
||||||
params = {}
|
params = {}
|
||||||
if server_side_apply:
|
if server_side_apply:
|
||||||
params["server_side"] = True
|
params["server_side"] = True
|
||||||
params.update(server_side_apply)
|
params.update(server_side_apply)
|
||||||
k8s_obj = self.client.apply(
|
return decode_response(
|
||||||
resource, definition, namespace=namespace, **params
|
self.client.apply(
|
||||||
).to_dict()
|
resource, definition, namespace=namespace, serialize=False, **params
|
||||||
except Exception as e:
|
)
|
||||||
reason = e.body if hasattr(e, "body") else e
|
)
|
||||||
msg = "Failed to apply object: {0}".format(reason)
|
except Exception as e:
|
||||||
raise CoreException(msg) from e
|
reason = e.body if hasattr(e, "body") else e
|
||||||
return k8s_obj
|
msg = "Failed to apply object: {0}".format(reason)
|
||||||
|
raise CoreException(msg) from e
|
||||||
|
|
||||||
def replace(
|
def replace(
|
||||||
self,
|
self,
|
||||||
resource: Resource,
|
resource: Resource,
|
||||||
definition: Dict,
|
definition: Dict,
|
||||||
existing: ResourceInstance,
|
existing: ResourceInstance,
|
||||||
) -> Dict:
|
) -> Tuple[Dict, List[str]]:
|
||||||
append_hash = self.module.params.get("append_hash", False)
|
append_hash = self.module.params.get("append_hash", False)
|
||||||
name = definition["metadata"].get("name")
|
name = definition["metadata"].get("name")
|
||||||
namespace = definition["metadata"].get("namespace")
|
namespace = definition["metadata"].get("namespace")
|
||||||
|
|
||||||
if self._client_side_dry_run:
|
if self._client_side_dry_run:
|
||||||
k8s_obj = _encode_stringdata(definition)
|
return _encode_stringdata(definition), []
|
||||||
else:
|
|
||||||
try:
|
try:
|
||||||
k8s_obj = self.client.replace(
|
return decode_response(
|
||||||
|
self.client.replace(
|
||||||
resource,
|
resource,
|
||||||
definition,
|
definition,
|
||||||
name=name,
|
name=name,
|
||||||
namespace=namespace,
|
namespace=namespace,
|
||||||
append_hash=append_hash,
|
append_hash=append_hash,
|
||||||
).to_dict()
|
serialize=False,
|
||||||
except Exception as e:
|
)
|
||||||
reason = e.body if hasattr(e, "body") else e
|
)
|
||||||
msg = "Failed to replace object: {0}".format(reason)
|
except Exception as e:
|
||||||
raise CoreException(msg) from e
|
reason = e.body if hasattr(e, "body") else e
|
||||||
return k8s_obj
|
msg = "Failed to replace object: {0}".format(reason)
|
||||||
|
raise CoreException(msg) from e
|
||||||
|
|
||||||
def update(
|
def update(
|
||||||
self, resource: Resource, definition: Dict, existing: ResourceInstance
|
self, resource: Resource, definition: Dict, existing: ResourceInstance
|
||||||
) -> Dict:
|
) -> Tuple[Dict, List[str]]:
|
||||||
name = definition["metadata"].get("name")
|
name = definition["metadata"].get("name")
|
||||||
namespace = definition["metadata"].get("namespace")
|
namespace = definition["metadata"].get("namespace")
|
||||||
|
|
||||||
if self._client_side_dry_run:
|
if self._client_side_dry_run:
|
||||||
k8s_obj = dict_merge(existing.to_dict(), _encode_stringdata(definition))
|
return dict_merge(existing.to_dict(), _encode_stringdata(definition)), []
|
||||||
else:
|
|
||||||
exception = None
|
exception = None
|
||||||
for merge_type in self.module.params.get("merge_type") or [
|
for merge_type in self.module.params.get("merge_type") or [
|
||||||
"strategic-merge",
|
"strategic-merge",
|
||||||
"merge",
|
"merge",
|
||||||
]:
|
]:
|
||||||
try:
|
try:
|
||||||
k8s_obj = self.patch_resource(
|
return self.patch_resource(
|
||||||
resource,
|
resource,
|
||||||
definition,
|
definition,
|
||||||
name,
|
name,
|
||||||
namespace,
|
namespace,
|
||||||
merge_type=merge_type,
|
merge_type=merge_type,
|
||||||
)
|
)
|
||||||
exception = None
|
except CoreException as e:
|
||||||
except CoreException as e:
|
exception = e
|
||||||
exception = e
|
continue
|
||||||
continue
|
raise exception
|
||||||
break
|
|
||||||
if exception:
|
|
||||||
raise exception
|
|
||||||
return k8s_obj
|
|
||||||
|
|
||||||
def delete(
|
def delete(
|
||||||
self,
|
self,
|
||||||
@@ -471,7 +490,9 @@ class K8sService:
|
|||||||
return k8s_obj
|
return k8s_obj
|
||||||
|
|
||||||
|
|
||||||
def diff_objects(existing: Dict, new: Dict) -> Tuple[bool, Dict]:
|
def diff_objects(
|
||||||
|
existing: Dict, new: Dict, hidden_fields: Optional[list] = None
|
||||||
|
) -> Tuple[bool, Dict]:
|
||||||
result = {}
|
result = {}
|
||||||
diff = recursive_diff(existing, new)
|
diff = recursive_diff(existing, new)
|
||||||
if not diff:
|
if not diff:
|
||||||
@@ -493,4 +514,109 @@ def diff_objects(existing: Dict, new: Dict) -> Tuple[bool, Dict]:
|
|||||||
if not set(result["before"]["metadata"].keys()).issubset(ignored_keys):
|
if not set(result["before"]["metadata"].keys()).issubset(ignored_keys):
|
||||||
return False, result
|
return False, result
|
||||||
|
|
||||||
|
result["before"] = hide_fields(result["before"], hidden_fields)
|
||||||
|
result["after"] = hide_fields(result["after"], hidden_fields)
|
||||||
|
|
||||||
return True, result
|
return True, result
|
||||||
|
|
||||||
|
|
||||||
|
def hide_fields(definition: dict, hidden_fields: Optional[list]) -> dict:
|
||||||
|
if not hidden_fields:
|
||||||
|
return definition
|
||||||
|
result = copy.deepcopy(definition)
|
||||||
|
for hidden_field in hidden_fields:
|
||||||
|
result = hide_field(result, hidden_field)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
# hide_field is not hugely sophisticated and designed to cope
|
||||||
|
# with e.g. status or metadata.managedFields rather than e.g.
|
||||||
|
# spec.template.spec.containers[0].env[3].value
|
||||||
|
def hide_field(definition: dict, hidden_field: str) -> dict:
|
||||||
|
split = hidden_field.split(".", 1)
|
||||||
|
if split[0] in definition:
|
||||||
|
if len(split) == 2:
|
||||||
|
definition[split[0]] = hide_field(definition[split[0]], split[1])
|
||||||
|
else:
|
||||||
|
del definition[split[0]]
|
||||||
|
return definition
|
||||||
|
|
||||||
|
|
||||||
|
def decode_response(resp) -> Tuple[Dict, List[str]]:
|
||||||
|
"""
|
||||||
|
This function decodes unserialized responses from the Kubernetes python
|
||||||
|
client and decodes the RFC2616 14.46 warnings found in the response
|
||||||
|
headers.
|
||||||
|
"""
|
||||||
|
obj = ResourceInstance(None, loads(resp.data.decode("utf8"))).to_dict()
|
||||||
|
warnings = []
|
||||||
|
if (
|
||||||
|
resp.headers is not None
|
||||||
|
and "warning" in resp.headers
|
||||||
|
and resp.headers["warning"] is not None
|
||||||
|
):
|
||||||
|
warnings = resp.headers["warning"].split(", ")
|
||||||
|
return obj, decode_warnings(warnings)
|
||||||
|
|
||||||
|
|
||||||
|
def decode_warnings(warnings: str) -> List[str]:
|
||||||
|
"""
|
||||||
|
This function decodes RFC2616 14.46 warnings in a simplified way, where
|
||||||
|
only the warn-texts are returned in a list.
|
||||||
|
"""
|
||||||
|
p = compile('\\d{3} .+ (".+")')
|
||||||
|
|
||||||
|
decoded = []
|
||||||
|
for warning in warnings:
|
||||||
|
m = p.match(warning)
|
||||||
|
if m:
|
||||||
|
try:
|
||||||
|
parsed, unused = parse_quoted_string(m.group(1))
|
||||||
|
decoded.append(parsed)
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
|
|
||||||
|
return decoded
|
||||||
|
|
||||||
|
|
||||||
|
def parse_quoted_string(quoted_string: str) -> Tuple[str, str]:
|
||||||
|
"""
|
||||||
|
This function was adapted from:
|
||||||
|
https://github.com/kubernetes/apimachinery/blob/bb8822152cabfb4f34dbc26270f874ce53db50de/pkg/util/net/http.go#L609
|
||||||
|
"""
|
||||||
|
if len(quoted_string) == 0:
|
||||||
|
raise ValueError("invalid quoted string: 0-length")
|
||||||
|
|
||||||
|
if quoted_string[0] != '"':
|
||||||
|
raise ValueError("invalid quoted string: missing initial quote")
|
||||||
|
|
||||||
|
quoted_string = quoted_string[1:]
|
||||||
|
remainder = ""
|
||||||
|
escaping = False
|
||||||
|
closed_quote = False
|
||||||
|
result = []
|
||||||
|
|
||||||
|
for i, b in enumerate(quoted_string):
|
||||||
|
if b == '"':
|
||||||
|
if escaping:
|
||||||
|
result.append(b)
|
||||||
|
escaping = False
|
||||||
|
else:
|
||||||
|
closed_quote = True
|
||||||
|
remainder_start = i + 1
|
||||||
|
remainder = quoted_string[remainder_start:].strip()
|
||||||
|
break
|
||||||
|
elif b == "\\":
|
||||||
|
if escaping:
|
||||||
|
result.append(b)
|
||||||
|
escaping = False
|
||||||
|
else:
|
||||||
|
escaping = True
|
||||||
|
else:
|
||||||
|
result.append(b)
|
||||||
|
escaping = False
|
||||||
|
|
||||||
|
if not closed_quote:
|
||||||
|
raise ValueError("invalid quoted string: missing closing quote")
|
||||||
|
|
||||||
|
return "".join(result), remainder
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ from functools import partial
|
|||||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
|
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
|
||||||
|
|
||||||
from ansible.module_utils.parsing.convert_bool import boolean
|
from ansible.module_utils.parsing.convert_bool import boolean
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
||||||
CoreException,
|
CoreException,
|
||||||
)
|
)
|
||||||
@@ -61,6 +60,13 @@ def daemonset_ready(daemonset: ResourceInstance) -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def statefulset_ready(statefulset: ResourceInstance) -> bool:
|
def statefulset_ready(statefulset: ResourceInstance) -> bool:
|
||||||
|
if statefulset.spec.updateStrategy.type == "OnDelete":
|
||||||
|
return bool(
|
||||||
|
statefulset.status
|
||||||
|
and statefulset.status.observedGeneration
|
||||||
|
== (statefulset.metadata.generation or 0)
|
||||||
|
and statefulset.status.replicas == statefulset.spec.replicas
|
||||||
|
)
|
||||||
# These may be None
|
# These may be None
|
||||||
updated_replicas = statefulset.status.updatedReplicas or 0
|
updated_replicas = statefulset.status.updatedReplicas or 0
|
||||||
ready_replicas = statefulset.status.readyReplicas or 0
|
ready_replicas = statefulset.status.readyReplicas or 0
|
||||||
|
|||||||
@@ -18,12 +18,11 @@ from __future__ import absolute_import, division, print_function
|
|||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
from kubernetes.dynamic import DynamicClient
|
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.apply import k8s_apply
|
from ansible_collections.kubernetes.core.plugins.module_utils.apply import k8s_apply
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.exceptions import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.exceptions import (
|
||||||
ApplyException,
|
ApplyException,
|
||||||
)
|
)
|
||||||
|
from kubernetes.dynamic import DynamicClient
|
||||||
|
|
||||||
|
|
||||||
class K8SDynamicClient(DynamicClient):
|
class K8SDynamicClient(DynamicClient):
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import re
|
|||||||
|
|
||||||
|
|
||||||
class Selector(object):
|
class Selector(object):
|
||||||
|
|
||||||
equality_based_operators = ("==", "!=", "=")
|
equality_based_operators = ("==", "!=", "=")
|
||||||
|
|
||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module: helm
|
|||||||
|
|
||||||
short_description: Manages Kubernetes packages with the Helm package manager
|
short_description: Manages Kubernetes packages with the Helm package manager
|
||||||
|
|
||||||
version_added: "0.11.0"
|
version_added: 0.11.0
|
||||||
|
|
||||||
author:
|
author:
|
||||||
- Lucas Boisserie (@LucasBoisserie)
|
- Lucas Boisserie (@LucasBoisserie)
|
||||||
@@ -61,7 +61,7 @@ options:
|
|||||||
default: false
|
default: false
|
||||||
type: bool
|
type: bool
|
||||||
aliases: [ dep_up ]
|
aliases: [ dep_up ]
|
||||||
version_added: "2.4.0"
|
version_added: 2.4.0
|
||||||
release_name:
|
release_name:
|
||||||
description:
|
description:
|
||||||
- Release name to manage.
|
- Release name to manage.
|
||||||
@@ -99,7 +99,7 @@ options:
|
|||||||
default: []
|
default: []
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
version_added: '1.1.0'
|
version_added: 1.1.0
|
||||||
update_repo_cache:
|
update_repo_cache:
|
||||||
description:
|
description:
|
||||||
- Run C(helm repo update) before the operation. Can be run as part of the package installation or as a separate step (see Examples).
|
- Run C(helm repo update) before the operation. Can be run as part of the package installation or as a separate step (see Examples).
|
||||||
@@ -129,7 +129,22 @@ options:
|
|||||||
- string
|
- string
|
||||||
- json
|
- json
|
||||||
- file
|
- file
|
||||||
version_added: '2.4.0'
|
version_added: 2.4.0
|
||||||
|
reuse_values:
|
||||||
|
description:
|
||||||
|
- When upgrading package, specifies wether to reuse the last release's values and merge in any overrides from parameters I(release_values),
|
||||||
|
I(values_files) or I(set_values).
|
||||||
|
- If I(reset_values) is set to C(True), this is ignored.
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
|
version_added: 2.5.0
|
||||||
|
reset_values:
|
||||||
|
description:
|
||||||
|
- When upgrading package, reset the values to the ones built into the chart.
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
|
default: True
|
||||||
|
version_added: 2.5.0
|
||||||
|
|
||||||
#Helm options
|
#Helm options
|
||||||
disable_hook:
|
disable_hook:
|
||||||
@@ -166,7 +181,7 @@ options:
|
|||||||
- similar to C(wait_timeout) but does not required C(wait) to be activated.
|
- similar to C(wait_timeout) but does not required C(wait) to be activated.
|
||||||
- Mutually exclusive with C(wait_timeout).
|
- Mutually exclusive with C(wait_timeout).
|
||||||
type: str
|
type: str
|
||||||
version_added: "2.3.0"
|
version_added: 2.3.0
|
||||||
atomic:
|
atomic:
|
||||||
description:
|
description:
|
||||||
- If set, the installation process deletes the installation on failure.
|
- If set, the installation process deletes the installation on failure.
|
||||||
@@ -177,12 +192,12 @@ options:
|
|||||||
- Create the release namespace if not present.
|
- Create the release namespace if not present.
|
||||||
type: bool
|
type: bool
|
||||||
default: False
|
default: False
|
||||||
version_added: "0.11.1"
|
version_added: 0.11.1
|
||||||
post_renderer:
|
post_renderer:
|
||||||
description:
|
description:
|
||||||
- Path to an executable to be used for post rendering.
|
- Path to an executable to be used for post rendering.
|
||||||
type: str
|
type: str
|
||||||
version_added: "2.4.0"
|
version_added: 2.4.0
|
||||||
replace:
|
replace:
|
||||||
description:
|
description:
|
||||||
- Reuse the given name, only if that name is a deleted release which remains in the history.
|
- Reuse the given name, only if that name is a deleted release which remains in the history.
|
||||||
@@ -190,19 +205,19 @@ options:
|
|||||||
- mutually exclusive with with C(history_max).
|
- mutually exclusive with with C(history_max).
|
||||||
type: bool
|
type: bool
|
||||||
default: False
|
default: False
|
||||||
version_added: "1.11.0"
|
version_added: 1.11.0
|
||||||
skip_crds:
|
skip_crds:
|
||||||
description:
|
description:
|
||||||
- Skip custom resource definitions when installing or upgrading.
|
- Skip custom resource definitions when installing or upgrading.
|
||||||
type: bool
|
type: bool
|
||||||
default: False
|
default: False
|
||||||
version_added: "1.2.0"
|
version_added: 1.2.0
|
||||||
history_max:
|
history_max:
|
||||||
description:
|
description:
|
||||||
- Limit the maximum number of revisions saved per release.
|
- Limit the maximum number of revisions saved per release.
|
||||||
- mutually exclusive with with C(replace).
|
- mutually exclusive with with C(replace).
|
||||||
type: int
|
type: int
|
||||||
version_added: "2.2.0"
|
version_added: 2.2.0
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- kubernetes.core.helm_common_options
|
- kubernetes.core.helm_common_options
|
||||||
"""
|
"""
|
||||||
@@ -310,6 +325,17 @@ EXAMPLES = r"""
|
|||||||
enabled: True
|
enabled: True
|
||||||
logging:
|
logging:
|
||||||
enabled: True
|
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 = r"""
|
RETURN = r"""
|
||||||
@@ -367,10 +393,11 @@ command:
|
|||||||
sample: helm upgrade ...
|
sample: helm upgrade ...
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import copy
|
||||||
import re
|
import re
|
||||||
import tempfile
|
import tempfile
|
||||||
import traceback
|
import traceback
|
||||||
import copy
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.version import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.version import (
|
||||||
LooseVersion,
|
LooseVersion,
|
||||||
)
|
)
|
||||||
@@ -406,14 +433,20 @@ def get_release(state, release_name):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_release_status(module, release_name):
|
def get_release_status(module, release_name, all_status=False):
|
||||||
"""
|
"""
|
||||||
Get Release state from deployed release
|
Get Release state from all release status (deployed, failed, pending-install, etc)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
list_command = (
|
list_command = [
|
||||||
module.get_helm_binary() + " list --output=yaml --filter " + release_name
|
module.get_helm_binary(),
|
||||||
)
|
"list",
|
||||||
|
"--output=yaml",
|
||||||
|
"--filter",
|
||||||
|
release_name,
|
||||||
|
]
|
||||||
|
if all_status:
|
||||||
|
list_command.append("--all")
|
||||||
|
|
||||||
rc, out, err = module.run_helm_command(list_command)
|
rc, out, err = module.run_helm_command(list_command)
|
||||||
|
|
||||||
@@ -439,7 +472,7 @@ def run_dep_update(module, chart_ref):
|
|||||||
"""
|
"""
|
||||||
Run dependency update
|
Run dependency update
|
||||||
"""
|
"""
|
||||||
dep_update = module.get_helm_binary() + " dependency update " + chart_ref
|
dep_update = module.get_helm_binary() + f" dependency update '{chart_ref}'"
|
||||||
rc, out, err = module.run_helm_command(dep_update)
|
rc, out, err = module.run_helm_command(dep_update)
|
||||||
|
|
||||||
|
|
||||||
@@ -447,7 +480,7 @@ def fetch_chart_info(module, command, chart_ref):
|
|||||||
"""
|
"""
|
||||||
Get chart info
|
Get chart info
|
||||||
"""
|
"""
|
||||||
inspect_command = command + " show chart " + chart_ref
|
inspect_command = command + f" show chart '{chart_ref}'"
|
||||||
|
|
||||||
rc, out, err = module.run_helm_command(inspect_command)
|
rc, out, err = module.run_helm_command(inspect_command)
|
||||||
|
|
||||||
@@ -455,6 +488,7 @@ def fetch_chart_info(module, command, chart_ref):
|
|||||||
|
|
||||||
|
|
||||||
def deploy(
|
def deploy(
|
||||||
|
module,
|
||||||
command,
|
command,
|
||||||
release_name,
|
release_name,
|
||||||
release_values,
|
release_values,
|
||||||
@@ -473,6 +507,8 @@ def deploy(
|
|||||||
timeout=None,
|
timeout=None,
|
||||||
dependency_update=None,
|
dependency_update=None,
|
||||||
set_value_args=None,
|
set_value_args=None,
|
||||||
|
reuse_values=None,
|
||||||
|
reset_values=True,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Install/upgrade/rollback release chart
|
Install/upgrade/rollback release chart
|
||||||
@@ -484,9 +520,11 @@ def deploy(
|
|||||||
deploy_command += " --dependency-update"
|
deploy_command += " --dependency-update"
|
||||||
else:
|
else:
|
||||||
deploy_command = command + " upgrade -i" # install/upgrade
|
deploy_command = command + " upgrade -i" # install/upgrade
|
||||||
|
if reset_values:
|
||||||
|
deploy_command += " --reset-values"
|
||||||
|
|
||||||
# Always reset values to keep release_values equal to values released
|
if reuse_values is not None:
|
||||||
deploy_command += " --reset-values"
|
deploy_command += " --reuse-values=" + str(reuse_values)
|
||||||
|
|
||||||
if wait:
|
if wait:
|
||||||
deploy_command += " --wait"
|
deploy_command += " --wait"
|
||||||
@@ -520,9 +558,10 @@ def deploy(
|
|||||||
with open(path, "w") as yaml_file:
|
with open(path, "w") as yaml_file:
|
||||||
yaml.dump(release_values, yaml_file, default_flow_style=False)
|
yaml.dump(release_values, yaml_file, default_flow_style=False)
|
||||||
deploy_command += " -f=" + path
|
deploy_command += " -f=" + path
|
||||||
|
module.add_cleanup_file(path)
|
||||||
|
|
||||||
if post_renderer:
|
if post_renderer:
|
||||||
deploy_command = " --post-renderer=" + post_renderer
|
deploy_command += " --post-renderer=" + post_renderer
|
||||||
|
|
||||||
if skip_crds:
|
if skip_crds:
|
||||||
deploy_command += " --skip-crds"
|
deploy_command += " --skip-crds"
|
||||||
@@ -533,7 +572,7 @@ def deploy(
|
|||||||
if set_value_args:
|
if set_value_args:
|
||||||
deploy_command += " " + set_value_args
|
deploy_command += " " + set_value_args
|
||||||
|
|
||||||
deploy_command += " " + release_name + " " + chart_name
|
deploy_command += " " + release_name + f" '{chart_name}'"
|
||||||
return deploy_command
|
return deploy_command
|
||||||
|
|
||||||
|
|
||||||
@@ -599,6 +638,10 @@ def helmdiff_check(
|
|||||||
chart_version=None,
|
chart_version=None,
|
||||||
replace=False,
|
replace=False,
|
||||||
chart_repo_url=None,
|
chart_repo_url=None,
|
||||||
|
post_renderer=False,
|
||||||
|
set_value_args=None,
|
||||||
|
reuse_values=None,
|
||||||
|
reset_values=True,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Use helm diff to determine if a release would change by upgrading a chart.
|
Use helm diff to determine if a release would change by upgrading a chart.
|
||||||
@@ -612,7 +655,13 @@ def helmdiff_check(
|
|||||||
if chart_version is not None:
|
if chart_version is not None:
|
||||||
cmd += " " + "--version=" + chart_version
|
cmd += " " + "--version=" + chart_version
|
||||||
if not replace:
|
if not replace:
|
||||||
cmd += " " + "--reset-values"
|
cmd += " " + "--reset-values=" + str(reset_values)
|
||||||
|
if post_renderer:
|
||||||
|
cmd += " --post-renderer=" + post_renderer
|
||||||
|
|
||||||
|
if values_files:
|
||||||
|
for value_file in values_files:
|
||||||
|
cmd += " --values=" + value_file
|
||||||
|
|
||||||
if release_values != {}:
|
if release_values != {}:
|
||||||
fd, path = tempfile.mkstemp(suffix=".yml")
|
fd, path = tempfile.mkstemp(suffix=".yml")
|
||||||
@@ -621,9 +670,11 @@ def helmdiff_check(
|
|||||||
cmd += " -f=" + path
|
cmd += " -f=" + path
|
||||||
module.add_cleanup_file(path)
|
module.add_cleanup_file(path)
|
||||||
|
|
||||||
if values_files:
|
if set_value_args:
|
||||||
for values_file in values_files:
|
cmd += " " + set_value_args
|
||||||
cmd += " -f=" + values_file
|
|
||||||
|
if reuse_values:
|
||||||
|
cmd += " --reuse-values"
|
||||||
|
|
||||||
rc, out, err = module.run_helm_command(cmd)
|
rc, out, err = module.run_helm_command(cmd)
|
||||||
return (len(out.strip()) > 0, out.strip())
|
return (len(out.strip()) > 0, out.strip())
|
||||||
@@ -682,6 +733,8 @@ def argument_spec():
|
|||||||
skip_crds=dict(type="bool", default=False),
|
skip_crds=dict(type="bool", default=False),
|
||||||
history_max=dict(type="int"),
|
history_max=dict(type="int"),
|
||||||
set_values=dict(type="list", elements="dict"),
|
set_values=dict(type="list", elements="dict"),
|
||||||
|
reuse_values=dict(type="bool"),
|
||||||
|
reset_values=dict(type="bool", default=True),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return arg_spec
|
return arg_spec
|
||||||
@@ -732,34 +785,38 @@ def main():
|
|||||||
history_max = module.params.get("history_max")
|
history_max = module.params.get("history_max")
|
||||||
timeout = module.params.get("timeout")
|
timeout = module.params.get("timeout")
|
||||||
set_values = module.params.get("set_values")
|
set_values = module.params.get("set_values")
|
||||||
|
reuse_values = module.params.get("reuse_values")
|
||||||
|
reset_values = module.params.get("reset_values")
|
||||||
|
|
||||||
if update_repo_cache:
|
if update_repo_cache:
|
||||||
run_repo_update(module)
|
run_repo_update(module)
|
||||||
|
|
||||||
# Get real/deployed release status
|
# Get real/deployed release status
|
||||||
release_status = get_release_status(module, release_name)
|
all_status = release_state == "absent"
|
||||||
|
release_status = get_release_status(module, release_name, all_status=all_status)
|
||||||
|
|
||||||
helm_cmd = module.get_helm_binary()
|
helm_cmd = module.get_helm_binary()
|
||||||
opt_result = {}
|
opt_result = {}
|
||||||
if release_state == "absent" and release_status is not None:
|
if release_state == "absent" and release_status is not None:
|
||||||
if replace:
|
# skip release statuses 'uninstalled' and 'uninstalling'
|
||||||
module.fail_json(msg="replace is not applicable when state is absent")
|
if not release_status["status"].startswith("uninstall"):
|
||||||
|
if replace:
|
||||||
|
module.fail_json(msg="replace is not applicable when state is absent")
|
||||||
|
|
||||||
if wait:
|
if wait:
|
||||||
helm_version = module.get_helm_version()
|
helm_version = module.get_helm_version()
|
||||||
if LooseVersion(helm_version) < LooseVersion("3.7.0"):
|
if LooseVersion(helm_version) < LooseVersion("3.7.0"):
|
||||||
opt_result["warnings"] = []
|
opt_result["warnings"] = []
|
||||||
opt_result["warnings"].append(
|
opt_result["warnings"].append(
|
||||||
"helm uninstall support option --wait for helm release >= 3.7.0"
|
"helm uninstall support option --wait for helm release >= 3.7.0"
|
||||||
)
|
)
|
||||||
wait = False
|
wait = False
|
||||||
|
|
||||||
helm_cmd = delete(
|
helm_cmd = delete(
|
||||||
helm_cmd, release_name, purge, disable_hook, wait, wait_timeout
|
helm_cmd, release_name, purge, disable_hook, wait, wait_timeout
|
||||||
)
|
)
|
||||||
changed = True
|
changed = True
|
||||||
elif release_state == "present":
|
elif release_state == "present":
|
||||||
|
|
||||||
if chart_version is not None:
|
if chart_version is not None:
|
||||||
helm_cmd += " --version=" + chart_version
|
helm_cmd += " --version=" + chart_version
|
||||||
|
|
||||||
@@ -799,12 +856,13 @@ def main():
|
|||||||
"Please consider add dependencies block or disable dependency_update to remove this warning."
|
"Please consider add dependencies block or disable dependency_update to remove this warning."
|
||||||
)
|
)
|
||||||
|
|
||||||
if release_status is None: # Not installed
|
set_value_args = None
|
||||||
set_value_args = None
|
if set_values:
|
||||||
if set_values:
|
set_value_args = module.get_helm_set_values_args(set_values)
|
||||||
set_value_args = module.get_helm_set_values_args(set_values)
|
|
||||||
|
|
||||||
|
if release_status is None: # Not installed
|
||||||
helm_cmd = deploy(
|
helm_cmd = deploy(
|
||||||
|
module,
|
||||||
helm_cmd,
|
helm_cmd,
|
||||||
release_name,
|
release_name,
|
||||||
release_values,
|
release_values,
|
||||||
@@ -823,11 +881,12 @@ def main():
|
|||||||
history_max=history_max,
|
history_max=history_max,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
set_value_args=set_value_args,
|
set_value_args=set_value_args,
|
||||||
|
reuse_values=reuse_values,
|
||||||
|
reset_values=reset_values,
|
||||||
)
|
)
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
helm_diff_version = get_plugin_version("diff")
|
helm_diff_version = get_plugin_version("diff")
|
||||||
if helm_diff_version and (
|
if helm_diff_version and (
|
||||||
not chart_repo_url
|
not chart_repo_url
|
||||||
@@ -845,6 +904,10 @@ def main():
|
|||||||
chart_version,
|
chart_version,
|
||||||
replace,
|
replace,
|
||||||
chart_repo_url,
|
chart_repo_url,
|
||||||
|
post_renderer,
|
||||||
|
set_value_args,
|
||||||
|
reuse_values=reuse_values,
|
||||||
|
reset_values=reset_values,
|
||||||
)
|
)
|
||||||
if would_change and module._diff:
|
if would_change and module._diff:
|
||||||
opt_result["diff"] = {"prepared": prepared}
|
opt_result["diff"] = {"prepared": prepared}
|
||||||
@@ -858,11 +921,8 @@ def main():
|
|||||||
)
|
)
|
||||||
|
|
||||||
if force or would_change:
|
if force or would_change:
|
||||||
set_value_args = None
|
|
||||||
if set_values:
|
|
||||||
set_value_args = module.get_helm_set_values_args(set_values)
|
|
||||||
|
|
||||||
helm_cmd = deploy(
|
helm_cmd = deploy(
|
||||||
|
module,
|
||||||
helm_cmd,
|
helm_cmd,
|
||||||
release_name,
|
release_name,
|
||||||
release_values,
|
release_values,
|
||||||
@@ -881,6 +941,8 @@ def main():
|
|||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
dependency_update=dependency_update,
|
dependency_update=dependency_update,
|
||||||
set_value_args=set_value_args,
|
set_value_args=set_value_args,
|
||||||
|
reuse_values=reuse_values,
|
||||||
|
reset_values=reset_values,
|
||||||
)
|
)
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
@@ -914,7 +976,7 @@ def main():
|
|||||||
changed=changed,
|
changed=changed,
|
||||||
stdout=out,
|
stdout=out,
|
||||||
stderr=err,
|
stderr=err,
|
||||||
status=get_release_status(module, release_name),
|
status=get_release_status(module, release_name, all_status=True),
|
||||||
command=helm_cmd,
|
command=helm_cmd,
|
||||||
**opt_result,
|
**opt_result,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module: helm_info
|
|||||||
|
|
||||||
short_description: Get information from Helm package deployed inside the cluster
|
short_description: Get information from Helm package deployed inside the cluster
|
||||||
|
|
||||||
version_added: "0.11.0"
|
version_added: 0.11.0
|
||||||
|
|
||||||
author:
|
author:
|
||||||
- Lucas Boisserie (@LucasBoisserie)
|
- Lucas Boisserie (@LucasBoisserie)
|
||||||
@@ -53,7 +53,7 @@ options:
|
|||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
default: []
|
default: []
|
||||||
version_added: "2.3.0"
|
version_added: 2.3.0
|
||||||
get_all_values:
|
get_all_values:
|
||||||
description:
|
description:
|
||||||
- Set to C(True) if you want to get all (computed) values of the release.
|
- Set to C(True) if you want to get all (computed) values of the release.
|
||||||
@@ -61,7 +61,7 @@ options:
|
|||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
type: bool
|
type: bool
|
||||||
version_added: "2.4.0"
|
version_added: 2.4.0
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- kubernetes.core.helm_common_options
|
- kubernetes.core.helm_common_options
|
||||||
"""
|
"""
|
||||||
@@ -123,22 +123,22 @@ status:
|
|||||||
elements: dict
|
elements: dict
|
||||||
description: Hooks of the release
|
description: Hooks of the release
|
||||||
returned: always
|
returned: always
|
||||||
version_added: "2.4.0"
|
version_added: 2.4.0
|
||||||
notes:
|
notes:
|
||||||
type: str
|
type: str
|
||||||
description: Notes of the release
|
description: Notes of the release
|
||||||
returned: always
|
returned: always
|
||||||
version_added: "2.4.0"
|
version_added: 2.4.0
|
||||||
manifest:
|
manifest:
|
||||||
type: list
|
type: list
|
||||||
elements: dict
|
elements: dict
|
||||||
description: Manifest of the release
|
description: Manifest of the release
|
||||||
returned: always
|
returned: always
|
||||||
version_added: "2.4.0"
|
version_added: 2.4.0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import traceback
|
|
||||||
import copy
|
import copy
|
||||||
|
import traceback
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import yaml
|
import yaml
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ DOCUMENTATION = r"""
|
|||||||
---
|
---
|
||||||
module: helm_plugin
|
module: helm_plugin
|
||||||
short_description: Manage Helm plugins
|
short_description: Manage Helm plugins
|
||||||
version_added: "1.0.0"
|
version_added: 1.0.0
|
||||||
author:
|
author:
|
||||||
- Abhijeet Kasurde (@Akasurde)
|
- Abhijeet Kasurde (@Akasurde)
|
||||||
requirements:
|
requirements:
|
||||||
@@ -47,7 +47,7 @@ options:
|
|||||||
- Ignored when C(state=absent) or C(state=latest).
|
- Ignored when C(state=absent) or C(state=latest).
|
||||||
required: false
|
required: false
|
||||||
type: str
|
type: str
|
||||||
version_added: "2.3.0"
|
version_added: 2.3.0
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- kubernetes.core.helm_common_options
|
- kubernetes.core.helm_common_options
|
||||||
"""
|
"""
|
||||||
@@ -109,6 +109,7 @@ rc:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.helm import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.helm import (
|
||||||
AnsibleHelmModule,
|
AnsibleHelmModule,
|
||||||
parse_helm_plugin_list,
|
parse_helm_plugin_list,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ DOCUMENTATION = r"""
|
|||||||
---
|
---
|
||||||
module: helm_plugin_info
|
module: helm_plugin_info
|
||||||
short_description: Gather information about Helm plugins
|
short_description: Gather information about Helm plugins
|
||||||
version_added: "1.0.0"
|
version_added: 1.0.0
|
||||||
author:
|
author:
|
||||||
- Abhijeet Kasurde (@Akasurde)
|
- Abhijeet Kasurde (@Akasurde)
|
||||||
requirements:
|
requirements:
|
||||||
@@ -71,9 +71,10 @@ rc:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.helm import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.helm import (
|
||||||
parse_helm_plugin_list,
|
|
||||||
AnsibleHelmModule,
|
AnsibleHelmModule,
|
||||||
|
parse_helm_plugin_list,
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.helm_args_common import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.helm_args_common import (
|
||||||
HELM_AUTH_ARG_SPEC,
|
HELM_AUTH_ARG_SPEC,
|
||||||
@@ -82,7 +83,6 @@ from ansible_collections.kubernetes.core.plugins.module_utils.helm_args_common i
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
argument_spec = copy.deepcopy(HELM_AUTH_ARG_SPEC)
|
argument_spec = copy.deepcopy(HELM_AUTH_ARG_SPEC)
|
||||||
argument_spec.update(
|
argument_spec.update(
|
||||||
dict(
|
dict(
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ DOCUMENTATION = r"""
|
|||||||
---
|
---
|
||||||
module: helm_pull
|
module: helm_pull
|
||||||
short_description: download a chart from a repository and (optionally) unpack it in local directory.
|
short_description: download a chart from a repository and (optionally) unpack it in local directory.
|
||||||
version_added: "2.4.0"
|
version_added: 2.4.0
|
||||||
author:
|
author:
|
||||||
- Aubin Bikouo (@abikouo)
|
- Aubin Bikouo (@abikouo)
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module: helm_repository
|
|||||||
|
|
||||||
short_description: Manage Helm repositories.
|
short_description: Manage Helm repositories.
|
||||||
|
|
||||||
version_added: "0.11.0"
|
version_added: 0.11.0
|
||||||
|
|
||||||
author:
|
author:
|
||||||
- Lucas Boisserie (@LucasBoisserie)
|
- Lucas Boisserie (@LucasBoisserie)
|
||||||
@@ -76,12 +76,12 @@ options:
|
|||||||
description:
|
description:
|
||||||
- Provide a URL for accessing the API. Can also be specified via C(K8S_AUTH_HOST) environment variable.
|
- Provide a URL for accessing the API. Can also be specified via C(K8S_AUTH_HOST) environment variable.
|
||||||
type: str
|
type: str
|
||||||
version_added: "2.3.0"
|
version_added: 2.3.0
|
||||||
api_key:
|
api_key:
|
||||||
description:
|
description:
|
||||||
- Token used to authenticate with the API. Can also be specified via C(K8S_AUTH_API_KEY) environment variable.
|
- Token used to authenticate with the API. Can also be specified via C(K8S_AUTH_API_KEY) environment variable.
|
||||||
type: str
|
type: str
|
||||||
version_added: "2.3.0"
|
version_added: 2.3.0
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- Whether or not to verify the API server's SSL certificates. Can also be specified via C(K8S_AUTH_VERIFY_SSL)
|
- Whether or not to verify the API server's SSL certificates. Can also be specified via C(K8S_AUTH_VERIFY_SSL)
|
||||||
@@ -89,21 +89,21 @@ options:
|
|||||||
type: bool
|
type: bool
|
||||||
aliases: [ verify_ssl ]
|
aliases: [ verify_ssl ]
|
||||||
default: True
|
default: True
|
||||||
version_added: "2.3.0"
|
version_added: 2.3.0
|
||||||
ca_cert:
|
ca_cert:
|
||||||
description:
|
description:
|
||||||
- Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to
|
- 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 C(K8S_AUTH_SSL_CA_CERT) environment variable.
|
avoid certificate validation errors. Can also be specified via C(K8S_AUTH_SSL_CA_CERT) environment variable.
|
||||||
type: path
|
type: path
|
||||||
aliases: [ ssl_ca_cert ]
|
aliases: [ ssl_ca_cert ]
|
||||||
version_added: "2.3.0"
|
version_added: 2.3.0
|
||||||
context:
|
context:
|
||||||
description:
|
description:
|
||||||
- Helm option to specify which kubeconfig context to use.
|
- Helm option to specify which kubeconfig context to use.
|
||||||
- If the value is not specified in the task, the value of environment variable C(K8S_AUTH_CONTEXT) will be used instead.
|
- If the value is not specified in the task, the value of environment variable C(K8S_AUTH_CONTEXT) will be used instead.
|
||||||
type: str
|
type: str
|
||||||
aliases: [ kube_context ]
|
aliases: [ kube_context ]
|
||||||
version_added: "2.4.0"
|
version_added: 2.4.0
|
||||||
kubeconfig:
|
kubeconfig:
|
||||||
description:
|
description:
|
||||||
- Helm option to specify kubeconfig path to use.
|
- Helm option to specify kubeconfig path to use.
|
||||||
@@ -111,14 +111,14 @@ options:
|
|||||||
- The configuration can be provided as dictionary.
|
- The configuration can be provided as dictionary.
|
||||||
type: raw
|
type: raw
|
||||||
aliases: [ kubeconfig_path ]
|
aliases: [ kubeconfig_path ]
|
||||||
version_added: "2.4.0"
|
version_added: 2.4.0
|
||||||
force_update:
|
force_update:
|
||||||
description:
|
description:
|
||||||
- Whether or not to replace (overwrite) the repo if it already exists.
|
- Whether or not to replace (overwrite) the repo if it already exists.
|
||||||
type: bool
|
type: bool
|
||||||
aliases: [ force ]
|
aliases: [ force ]
|
||||||
default: False
|
default: False
|
||||||
version_added: "2.4.0"
|
version_added: 2.4.0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = r"""
|
EXAMPLES = r"""
|
||||||
@@ -166,8 +166,8 @@ msg:
|
|||||||
sample: 'Repository already have a repository named bitnami'
|
sample: 'Repository already have a repository named bitnami'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import traceback
|
|
||||||
import copy
|
import copy
|
||||||
|
import traceback
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import yaml
|
import yaml
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ options:
|
|||||||
default: false
|
default: false
|
||||||
type: bool
|
type: bool
|
||||||
aliases: [ dep_up ]
|
aliases: [ dep_up ]
|
||||||
version_added: "2.4.0"
|
version_added: 2.4.0
|
||||||
disable_hook:
|
disable_hook:
|
||||||
description:
|
description:
|
||||||
- Prevent hooks from running during install.
|
- Prevent hooks from running during install.
|
||||||
@@ -139,7 +139,7 @@ options:
|
|||||||
- string
|
- string
|
||||||
- json
|
- json
|
||||||
- file
|
- file
|
||||||
version_added: '2.4.0'
|
version_added: 2.4.0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = r"""
|
EXAMPLES = r"""
|
||||||
|
|||||||
@@ -57,15 +57,14 @@ options:
|
|||||||
- Whether to override the default patch merge approach with a specific type. By default, the strategic
|
- Whether to override the default patch merge approach with a specific type. By default, the strategic
|
||||||
merge will typically be used.
|
merge will typically be used.
|
||||||
- For example, Custom Resource Definitions typically aren't updatable by the usual strategic merge. You may
|
- For example, Custom Resource Definitions typically aren't updatable by the usual strategic merge. You may
|
||||||
want to use C(merge) if you see "strategic merge patch format is not supported"
|
want to use C(merge) if you see "strategic merge patch format is not supported".
|
||||||
- See U(https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment)
|
- See U(https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment)
|
||||||
- If more than one C(merge_type) is given, the merge_types will be tried in order. This defaults to
|
- If more than one C(merge_type) is given, the merge_types will be tried in order. This defaults to
|
||||||
C(['strategic-merge', 'merge']), which is ideal for using the same parameters on resource kinds that
|
C(['strategic-merge', 'merge']), which is ideal for using the same parameters on resource kinds that
|
||||||
combine Custom Resources and built-in resources.
|
combine Custom Resources and built-in resources.
|
||||||
- mutually exclusive with C(apply)
|
- Mutually exclusive with C(apply).
|
||||||
- I(merge_type=json) is deprecated and will be removed in version 3.0.0. Please use M(kubernetes.core.k8s_json_patch) instead.
|
- I(merge_type=json) has been removed in version 4.0.0. Please use M(kubernetes.core.k8s_json_patch) instead.
|
||||||
choices:
|
choices:
|
||||||
- json
|
|
||||||
- merge
|
- merge
|
||||||
- strategic-merge
|
- strategic-merge
|
||||||
type: list
|
type: list
|
||||||
@@ -101,7 +100,7 @@ options:
|
|||||||
- C(apply) compares the desired resource definition with the previously supplied resource definition,
|
- C(apply) compares the desired resource definition with the previously supplied resource definition,
|
||||||
ignoring properties that are automatically generated
|
ignoring properties that are automatically generated
|
||||||
- C(apply) works better with Services than 'force=yes'
|
- C(apply) works better with Services than 'force=yes'
|
||||||
- mutually exclusive with C(merge_type)
|
- Mutually exclusive with C(merge_type).
|
||||||
default: False
|
default: False
|
||||||
type: bool
|
type: bool
|
||||||
template:
|
template:
|
||||||
@@ -172,10 +171,31 @@ options:
|
|||||||
- When set to True, server-side apply will force the changes against conflicts.
|
- When set to True, server-side apply will force the changes against conflicts.
|
||||||
type: bool
|
type: bool
|
||||||
default: False
|
default: False
|
||||||
|
delete_all:
|
||||||
|
description:
|
||||||
|
- When this option is set to I(true) and I(state=absent),
|
||||||
|
module will delete all resources of the specified resource type in the requested namespace.
|
||||||
|
- Ignored when C(state) is not set to I(absent) or when one of (src),
|
||||||
|
C(name) or C(resource_definition) is provided.
|
||||||
|
- Parameter C(kind) is required to use this option.
|
||||||
|
- This parameter can be used with C(label_selectors) to restrict the resources to be deleted.
|
||||||
|
type: bool
|
||||||
|
default: false
|
||||||
|
version_added: 2.5.0
|
||||||
|
aliases:
|
||||||
|
- all
|
||||||
|
hidden_fields:
|
||||||
|
description:
|
||||||
|
- Hide fields matching this option in the result
|
||||||
|
- An example might be C(hidden_fields=[metadata.managedFields])
|
||||||
|
- Only field definitions that don't reference list items are supported (so V(spec.containers[0]) would not work)
|
||||||
|
type: list
|
||||||
|
elements: str
|
||||||
|
version_added: 2.5.0
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 3.6"
|
- "python >= 3.9"
|
||||||
- "kubernetes >= 12.0.0"
|
- "kubernetes >= 24.2.0"
|
||||||
- "PyYAML >= 3.11"
|
- "PyYAML >= 3.11"
|
||||||
- "jsonpatch"
|
- "jsonpatch"
|
||||||
"""
|
"""
|
||||||
@@ -343,6 +363,14 @@ EXAMPLES = r"""
|
|||||||
apply: yes
|
apply: yes
|
||||||
server_side_apply:
|
server_side_apply:
|
||||||
field_manager: ansible
|
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 = r"""
|
RETURN = r"""
|
||||||
@@ -394,10 +422,10 @@ from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule impo
|
|||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
||||||
AUTH_ARG_SPEC,
|
AUTH_ARG_SPEC,
|
||||||
WAIT_ARG_SPEC,
|
DELETE_OPTS_ARG_SPEC,
|
||||||
NAME_ARG_SPEC,
|
NAME_ARG_SPEC,
|
||||||
RESOURCE_ARG_SPEC,
|
RESOURCE_ARG_SPEC,
|
||||||
DELETE_OPTS_ARG_SPEC,
|
WAIT_ARG_SPEC,
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import (
|
||||||
AnsibleK8SModule,
|
AnsibleK8SModule,
|
||||||
@@ -431,7 +459,7 @@ def argspec():
|
|||||||
argument_spec.update(copy.deepcopy(AUTH_ARG_SPEC))
|
argument_spec.update(copy.deepcopy(AUTH_ARG_SPEC))
|
||||||
argument_spec.update(copy.deepcopy(WAIT_ARG_SPEC))
|
argument_spec.update(copy.deepcopy(WAIT_ARG_SPEC))
|
||||||
argument_spec["merge_type"] = dict(
|
argument_spec["merge_type"] = dict(
|
||||||
type="list", elements="str", choices=["json", "merge", "strategic-merge"]
|
type="list", elements="str", choices=["merge", "strategic-merge"]
|
||||||
)
|
)
|
||||||
argument_spec["validate"] = dict(type="dict", default=None, options=validate_spec())
|
argument_spec["validate"] = dict(type="dict", default=None, options=validate_spec())
|
||||||
argument_spec["append_hash"] = dict(type="bool", default=False)
|
argument_spec["append_hash"] = dict(type="bool", default=False)
|
||||||
@@ -450,6 +478,8 @@ def argspec():
|
|||||||
argument_spec["server_side_apply"] = dict(
|
argument_spec["server_side_apply"] = dict(
|
||||||
type="dict", default=None, options=server_apply_spec()
|
type="dict", default=None, options=server_apply_spec()
|
||||||
)
|
)
|
||||||
|
argument_spec["delete_all"] = dict(type="bool", default=False, aliases=["all"])
|
||||||
|
argument_spec["hidden_fields"] = dict(type="list", elements="str")
|
||||||
|
|
||||||
return argument_spec
|
return argument_spec
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ __metaclass__ = type
|
|||||||
DOCUMENTATION = r"""
|
DOCUMENTATION = r"""
|
||||||
module: k8s_cluster_info
|
module: k8s_cluster_info
|
||||||
|
|
||||||
version_added: "0.11.1"
|
version_added: 0.11.1
|
||||||
|
|
||||||
short_description: Describe Kubernetes (K8s) cluster, APIs available and their respective versions
|
short_description: Describe Kubernetes (K8s) cluster, APIs available and their respective versions
|
||||||
|
|
||||||
@@ -34,8 +34,8 @@ extends_documentation_fragment:
|
|||||||
- kubernetes.core.k8s_auth_options
|
- kubernetes.core.k8s_auth_options
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 3.6"
|
- "python >= 3.9"
|
||||||
- "kubernetes >= 12.0.0"
|
- "kubernetes >= 24.2.0"
|
||||||
- "PyYAML >= 3.11"
|
- "PyYAML >= 3.11"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -154,15 +154,15 @@ except ImportError:
|
|||||||
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
||||||
AnsibleModule,
|
AnsibleModule,
|
||||||
)
|
)
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
||||||
|
AUTH_ARG_SPEC,
|
||||||
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import (
|
||||||
AnsibleK8SModule,
|
AnsibleK8SModule,
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
||||||
CoreException,
|
CoreException,
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
|
||||||
AUTH_ARG_SPEC,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def execute_module(module, client):
|
def execute_module(module, client):
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module: k8s_cp
|
|||||||
|
|
||||||
short_description: Copy files and directories to and from pod.
|
short_description: Copy files and directories to and from pod.
|
||||||
|
|
||||||
version_added: "2.2.0"
|
version_added: 2.2.0
|
||||||
|
|
||||||
author:
|
author:
|
||||||
- Aubin Bikouo (@abikouo)
|
- Aubin Bikouo (@abikouo)
|
||||||
@@ -26,8 +26,8 @@ extends_documentation_fragment:
|
|||||||
- kubernetes.core.k8s_auth_options
|
- kubernetes.core.k8s_auth_options
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 3.6"
|
- "python >= 3.9"
|
||||||
- "kubernetes >= 12.0.0"
|
- "kubernetes >= 24.2.0"
|
||||||
|
|
||||||
options:
|
options:
|
||||||
namespace:
|
namespace:
|
||||||
@@ -139,9 +139,18 @@ result:
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
||||||
AnsibleModule,
|
AnsibleModule,
|
||||||
)
|
)
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
||||||
|
AUTH_ARG_SPEC,
|
||||||
|
)
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.copy import (
|
||||||
|
K8SCopyFromPod,
|
||||||
|
K8SCopyToPod,
|
||||||
|
check_pod,
|
||||||
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
||||||
get_api_client,
|
get_api_client,
|
||||||
)
|
)
|
||||||
@@ -155,16 +164,6 @@ from ansible_collections.kubernetes.core.plugins.module_utils.k8s.service import
|
|||||||
K8sService,
|
K8sService,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
|
||||||
AUTH_ARG_SPEC,
|
|
||||||
)
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.copy import (
|
|
||||||
K8SCopyFromPod,
|
|
||||||
K8SCopyToPod,
|
|
||||||
check_pod,
|
|
||||||
)
|
|
||||||
from ansible.module_utils._text import to_native
|
|
||||||
|
|
||||||
|
|
||||||
def argspec():
|
def argspec():
|
||||||
argument_spec = copy.deepcopy(AUTH_ARG_SPEC)
|
argument_spec = copy.deepcopy(AUTH_ARG_SPEC)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module: k8s_drain
|
|||||||
|
|
||||||
short_description: Drain, Cordon, or Uncordon node in k8s cluster
|
short_description: Drain, Cordon, or Uncordon node in k8s cluster
|
||||||
|
|
||||||
version_added: "2.2.0"
|
version_added: 2.2.0
|
||||||
|
|
||||||
author: Aubin Bikouo (@abikouo)
|
author: Aubin Bikouo (@abikouo)
|
||||||
|
|
||||||
@@ -41,12 +41,21 @@ options:
|
|||||||
- The name of the node.
|
- The name of the node.
|
||||||
required: true
|
required: true
|
||||||
type: str
|
type: str
|
||||||
|
pod_selectors:
|
||||||
|
description:
|
||||||
|
- Label selector to filter pods on the node.
|
||||||
|
- This option has effect only when C(state) is set to I(drain).
|
||||||
|
type: list
|
||||||
|
elements: str
|
||||||
|
version_added: 2.5.0
|
||||||
|
aliases:
|
||||||
|
- label_selectors
|
||||||
delete_options:
|
delete_options:
|
||||||
type: dict
|
type: dict
|
||||||
|
default: {}
|
||||||
description:
|
description:
|
||||||
- Specify options to delete pods.
|
- Specify options to delete pods.
|
||||||
- This option has effect only when C(state) is set to I(drain).
|
- This option has effect only when C(state) is set to I(drain).
|
||||||
default: {}
|
|
||||||
suboptions:
|
suboptions:
|
||||||
terminate_grace_period:
|
terminate_grace_period:
|
||||||
description:
|
description:
|
||||||
@@ -88,8 +97,8 @@ options:
|
|||||||
type: int
|
type: int
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = r"""
|
EXAMPLES = r"""
|
||||||
@@ -115,6 +124,14 @@ EXAMPLES = r"""
|
|||||||
kubernetes.core.k8s_drain:
|
kubernetes.core.k8s_drain:
|
||||||
state: cordon
|
state: cordon
|
||||||
name: foo
|
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 = r"""
|
RETURN = r"""
|
||||||
@@ -128,8 +145,9 @@ result:
|
|||||||
import copy
|
import copy
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
||||||
AnsibleModule,
|
AnsibleModule,
|
||||||
)
|
)
|
||||||
@@ -146,12 +164,10 @@ from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions imp
|
|||||||
CoreException,
|
CoreException,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ansible.module_utils._text import to_native
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from kubernetes.client.api import core_v1_api
|
from kubernetes.client.api import core_v1_api
|
||||||
from kubernetes.client.models import V1DeleteOptions, V1ObjectMeta
|
|
||||||
from kubernetes.client.exceptions import ApiException
|
from kubernetes.client.exceptions import ApiException
|
||||||
|
from kubernetes.client.models import V1DeleteOptions, V1ObjectMeta
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# ImportError are managed by the common module already.
|
# ImportError are managed by the common module already.
|
||||||
pass
|
pass
|
||||||
@@ -328,6 +344,17 @@ class K8sDrainAnsible(object):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def list_pods(self):
|
||||||
|
params = {
|
||||||
|
"field_selector": "spec.nodeName={name}".format(
|
||||||
|
name=self._module.params.get("name")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
pod_selectors = self._module.params.get("pod_selectors")
|
||||||
|
if pod_selectors:
|
||||||
|
params["label_selector"] = ",".join(pod_selectors)
|
||||||
|
return self._api_instance.list_pod_for_all_namespaces(**params)
|
||||||
|
|
||||||
def delete_or_evict_pods(self, node_unschedulable):
|
def delete_or_evict_pods(self, node_unschedulable):
|
||||||
# Mark node as unschedulable
|
# Mark node as unschedulable
|
||||||
result = []
|
result = []
|
||||||
@@ -350,12 +377,7 @@ class K8sDrainAnsible(object):
|
|||||||
self.patch_node(unschedulable=False)
|
self.patch_node(unschedulable=False)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
field_selector = "spec.nodeName={name}".format(
|
pod_list = self.list_pods()
|
||||||
name=self._module.params.get("name")
|
|
||||||
)
|
|
||||||
pod_list = self._api_instance.list_pod_for_all_namespaces(
|
|
||||||
field_selector=field_selector
|
|
||||||
)
|
|
||||||
# Filter pods
|
# Filter pods
|
||||||
force = self._drain_options.get("force", False)
|
force = self._drain_options.get("force", False)
|
||||||
ignore_daemonset = self._drain_options.get("ignore_daemonsets", False)
|
ignore_daemonset = self._drain_options.get("ignore_daemonsets", False)
|
||||||
@@ -406,7 +428,6 @@ class K8sDrainAnsible(object):
|
|||||||
return dict(result=" ".join(result))
|
return dict(result=" ".join(result))
|
||||||
|
|
||||||
def patch_node(self, unschedulable):
|
def patch_node(self, unschedulable):
|
||||||
|
|
||||||
body = {"spec": {"unschedulable": unschedulable}}
|
body = {"spec": {"unschedulable": unschedulable}}
|
||||||
try:
|
try:
|
||||||
self._api_instance.patch_node(
|
self._api_instance.patch_node(
|
||||||
@@ -418,7 +439,6 @@ class K8sDrainAnsible(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def execute_module(self):
|
def execute_module(self):
|
||||||
|
|
||||||
state = self._module.params.get("state")
|
state = self._module.params.get("state")
|
||||||
name = self._module.params.get("name")
|
name = self._module.params.get("name")
|
||||||
try:
|
try:
|
||||||
@@ -486,6 +506,11 @@ def argspec():
|
|||||||
wait_sleep=dict(type="int", default=5),
|
wait_sleep=dict(type="int", default=5),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
pod_selectors=dict(
|
||||||
|
type="list",
|
||||||
|
elements="str",
|
||||||
|
aliases=["label_selectors"],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return argument_spec
|
return argument_spec
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module: k8s_exec
|
|||||||
|
|
||||||
short_description: Execute command in Pod
|
short_description: Execute command in Pod
|
||||||
|
|
||||||
version_added: "0.10.0"
|
version_added: 0.10.0
|
||||||
|
|
||||||
author: "Tristan de Cacqueray (@tristanC)"
|
author: "Tristan de Cacqueray (@tristanC)"
|
||||||
|
|
||||||
@@ -26,8 +26,8 @@ extends_documentation_fragment:
|
|||||||
- kubernetes.core.k8s_auth_options
|
- kubernetes.core.k8s_auth_options
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 3.6"
|
- "python >= 3.9"
|
||||||
- "kubernetes >= 12.0.0"
|
- "kubernetes >= 24.2.0"
|
||||||
- "PyYAML >= 3.11"
|
- "PyYAML >= 3.11"
|
||||||
|
|
||||||
notes:
|
notes:
|
||||||
@@ -131,27 +131,27 @@ except ImportError:
|
|||||||
# ImportError are managed by the common module already.
|
# ImportError are managed by the common module already.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
||||||
AnsibleModule,
|
AnsibleModule,
|
||||||
)
|
)
|
||||||
from ansible.module_utils._text import to_native
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
|
|
||||||
AUTH_ARG_SPEC,
|
AUTH_ARG_SPEC,
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import (
|
|
||||||
AnsibleK8SModule,
|
|
||||||
)
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
||||||
get_api_client,
|
get_api_client,
|
||||||
)
|
)
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import (
|
||||||
|
AnsibleK8SModule,
|
||||||
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
||||||
CoreException,
|
CoreException,
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from kubernetes.client.apis import core_v1_api
|
from kubernetes.client.apis import core_v1_api
|
||||||
from kubernetes.stream import stream
|
|
||||||
from kubernetes.client.exceptions import ApiException
|
from kubernetes.client.exceptions import ApiException
|
||||||
|
from kubernetes.stream import stream
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# ImportError are managed by the common module already.
|
# ImportError are managed by the common module already.
|
||||||
pass
|
pass
|
||||||
@@ -219,12 +219,6 @@ def execute_module(module, client):
|
|||||||
else:
|
else:
|
||||||
rc = int(err["details"]["causes"][0]["message"])
|
rc = int(err["details"]["causes"][0]["message"])
|
||||||
|
|
||||||
module.deprecate(
|
|
||||||
"The 'return_code' return key is being renamed to 'rc'. "
|
|
||||||
"Both keys are being returned for now to allow users to migrate their automation.",
|
|
||||||
version="4.0.0",
|
|
||||||
collection_name="kubernetes.core",
|
|
||||||
)
|
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
# Some command might change environment, but ultimately failing at end
|
# Some command might change environment, but ultimately failing at end
|
||||||
changed=True,
|
changed=True,
|
||||||
|
|||||||
@@ -44,6 +44,14 @@ options:
|
|||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
default: []
|
default: []
|
||||||
|
hidden_fields:
|
||||||
|
description:
|
||||||
|
- Hide fields matching any of the field definitions in the result
|
||||||
|
- An example might be C(hidden_fields=[metadata.managedFields])
|
||||||
|
- Only field definitions that don't reference list items are supported (so V(spec.containers[0]) would not work)
|
||||||
|
type: list
|
||||||
|
elements: str
|
||||||
|
version_added: 2.5.0
|
||||||
|
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- kubernetes.core.k8s_auth_options
|
- kubernetes.core.k8s_auth_options
|
||||||
@@ -51,8 +59,8 @@ extends_documentation_fragment:
|
|||||||
- kubernetes.core.k8s_wait_options
|
- kubernetes.core.k8s_wait_options
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 3.6"
|
- "python >= 3.9"
|
||||||
- "kubernetes >= 12.0.0"
|
- "kubernetes >= 24.2.0"
|
||||||
- "PyYAML >= 3.11"
|
- "PyYAML >= 3.11"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -157,12 +165,12 @@ from ansible_collections.kubernetes.core.plugins.module_utils.args_common import
|
|||||||
AUTH_ARG_SPEC,
|
AUTH_ARG_SPEC,
|
||||||
WAIT_ARG_SPEC,
|
WAIT_ARG_SPEC,
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import (
|
|
||||||
AnsibleK8SModule,
|
|
||||||
)
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
||||||
get_api_client,
|
get_api_client,
|
||||||
)
|
)
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import (
|
||||||
|
AnsibleK8SModule,
|
||||||
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
||||||
CoreException,
|
CoreException,
|
||||||
)
|
)
|
||||||
@@ -183,6 +191,7 @@ def execute_module(module, svc):
|
|||||||
wait_sleep=module.params["wait_sleep"],
|
wait_sleep=module.params["wait_sleep"],
|
||||||
wait_timeout=module.params["wait_timeout"],
|
wait_timeout=module.params["wait_timeout"],
|
||||||
condition=module.params["wait_condition"],
|
condition=module.params["wait_condition"],
|
||||||
|
hidden_fields=module.params["hidden_fields"],
|
||||||
)
|
)
|
||||||
module.exit_json(changed=False, **facts)
|
module.exit_json(changed=False, **facts)
|
||||||
|
|
||||||
@@ -198,6 +207,7 @@ def argspec():
|
|||||||
namespace=dict(),
|
namespace=dict(),
|
||||||
label_selectors=dict(type="list", elements="str", default=[]),
|
label_selectors=dict(type="list", elements="str", default=[]),
|
||||||
field_selectors=dict(type="list", elements="str", default=[]),
|
field_selectors=dict(type="list", elements="str", default=[]),
|
||||||
|
hidden_fields=dict(type="list", elements="str"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return args
|
return args
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ extends_documentation_fragment:
|
|||||||
- kubernetes.core.k8s_wait_options
|
- kubernetes.core.k8s_wait_options
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 3.6"
|
- "python >= 3.9"
|
||||||
- "kubernetes >= 12.0.0"
|
- "kubernetes >= 24.2.0"
|
||||||
- "PyYAML >= 3.11"
|
- "PyYAML >= 3.11"
|
||||||
- "jsonpatch"
|
- "jsonpatch"
|
||||||
"""
|
"""
|
||||||
@@ -127,8 +127,8 @@ error:
|
|||||||
import copy
|
import copy
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import missing_required_lib
|
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
|
from ansible.module_utils.basic import missing_required_lib
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
||||||
AnsibleModule,
|
AnsibleModule,
|
||||||
)
|
)
|
||||||
@@ -152,7 +152,6 @@ from ansible_collections.kubernetes.core.plugins.module_utils.k8s.waiter import
|
|||||||
get_waiter,
|
get_waiter,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from kubernetes.dynamic.exceptions import DynamicApiError
|
from kubernetes.dynamic.exceptions import DynamicApiError
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module: k8s_log
|
|||||||
|
|
||||||
short_description: Fetch logs from Kubernetes resources
|
short_description: Fetch logs from Kubernetes resources
|
||||||
|
|
||||||
version_added: "0.10.0"
|
version_added: 0.10.0
|
||||||
|
|
||||||
author:
|
author:
|
||||||
- "Fabian von Feilitzsch (@fabianvf)"
|
- "Fabian von Feilitzsch (@fabianvf)"
|
||||||
@@ -61,30 +61,30 @@ options:
|
|||||||
- A relative time in seconds before the current time from which to show logs.
|
- A relative time in seconds before the current time from which to show logs.
|
||||||
required: no
|
required: no
|
||||||
type: str
|
type: str
|
||||||
version_added: '2.2.0'
|
version_added: 2.2.0
|
||||||
previous:
|
previous:
|
||||||
description:
|
description:
|
||||||
- If C(true), print the logs for the previous instance of the container in a pod if it exists.
|
- If C(true), print the logs for the previous instance of the container in a pod if it exists.
|
||||||
required: no
|
required: no
|
||||||
type: bool
|
type: bool
|
||||||
default: False
|
default: False
|
||||||
version_added: '2.4.0'
|
version_added: 2.4.0
|
||||||
tail_lines:
|
tail_lines:
|
||||||
description:
|
description:
|
||||||
- A number of lines from the end of the logs to retrieve.
|
- A number of lines from the end of the logs to retrieve.
|
||||||
required: no
|
required: no
|
||||||
type: int
|
type: int
|
||||||
version_added: '2.4.0'
|
version_added: 2.4.0
|
||||||
all_containers:
|
all_containers:
|
||||||
description:
|
description:
|
||||||
- If set to C(true), retrieve all containers' logs in the pod(s).
|
- If set to C(true), retrieve all containers' logs in the pod(s).
|
||||||
- mutually exclusive with C(container).
|
- mutually exclusive with C(container).
|
||||||
type: bool
|
type: bool
|
||||||
version_added: '2.4.0'
|
version_added: 2.4.0
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 3.6"
|
- "python >= 3.9"
|
||||||
- "kubernetes >= 12.0.0"
|
- "kubernetes >= 24.2.0"
|
||||||
- "PyYAML >= 3.11"
|
- "PyYAML >= 3.11"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ __metaclass__ = type
|
|||||||
DOCUMENTATION = r"""
|
DOCUMENTATION = r"""
|
||||||
module: k8s_rollback
|
module: k8s_rollback
|
||||||
short_description: Rollback Kubernetes (K8S) Deployments and DaemonSets
|
short_description: Rollback Kubernetes (K8S) Deployments and DaemonSets
|
||||||
version_added: "1.0.0"
|
version_added: 1.0.0
|
||||||
author:
|
author:
|
||||||
- "Julien Huon (@julienhuon)"
|
- "Julien Huon (@julienhuon)"
|
||||||
description:
|
description:
|
||||||
@@ -34,8 +34,8 @@ extends_documentation_fragment:
|
|||||||
- kubernetes.core.k8s_auth_options
|
- kubernetes.core.k8s_auth_options
|
||||||
- kubernetes.core.k8s_name_options
|
- kubernetes.core.k8s_name_options
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 3.6"
|
- "python >= 3.9"
|
||||||
- "kubernetes >= 12.0.0"
|
- "kubernetes >= 24.2.0"
|
||||||
- "PyYAML >= 3.11"
|
- "PyYAML >= 3.11"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
@@ -46,8 +45,8 @@ options:
|
|||||||
version_added: 2.0.0
|
version_added: 2.0.0
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 3.6"
|
- "python >= 3.9"
|
||||||
- "kubernetes >= 12.0.0"
|
- "kubernetes >= 24.2.0"
|
||||||
- "PyYAML >= 3.11"
|
- "PyYAML >= 3.11"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -151,14 +150,13 @@ except ImportError:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
||||||
AnsibleModule,
|
AnsibleModule,
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
||||||
AUTH_ARG_SPEC,
|
AUTH_ARG_SPEC,
|
||||||
RESOURCE_ARG_SPEC,
|
|
||||||
NAME_ARG_SPEC,
|
NAME_ARG_SPEC,
|
||||||
|
RESOURCE_ARG_SPEC,
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
||||||
get_api_client,
|
get_api_client,
|
||||||
@@ -170,15 +168,15 @@ from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions imp
|
|||||||
CoreException,
|
CoreException,
|
||||||
ResourceTimeout,
|
ResourceTimeout,
|
||||||
)
|
)
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.resource import (
|
||||||
|
create_definitions,
|
||||||
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.service import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.service import (
|
||||||
diff_objects,
|
diff_objects,
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.waiter import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.waiter import (
|
||||||
get_waiter,
|
get_waiter,
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.resource import (
|
|
||||||
create_definitions,
|
|
||||||
)
|
|
||||||
|
|
||||||
SCALE_ARG_SPEC = {
|
SCALE_ARG_SPEC = {
|
||||||
"replicas": {"type": "int", "required": True},
|
"replicas": {"type": "int", "required": True},
|
||||||
@@ -391,7 +389,7 @@ def scale(
|
|||||||
namespace=namespace,
|
namespace=namespace,
|
||||||
)
|
)
|
||||||
if not success:
|
if not success:
|
||||||
raise ResourceTimeout("Resource scaling timed out", **result)
|
raise ResourceTimeout("Resource scaling timed out", result)
|
||||||
|
|
||||||
match, diffs = diff_objects(existing.to_dict(), result["result"])
|
match, diffs = diff_objects(existing.to_dict(), result["result"])
|
||||||
result["changed"] = not match
|
result["changed"] = not match
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ options:
|
|||||||
type: bool
|
type: bool
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = r"""
|
EXAMPLES = r"""
|
||||||
@@ -143,7 +143,6 @@ result:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
||||||
@@ -154,25 +153,24 @@ from ansible_collections.kubernetes.core.plugins.module_utils.args_common import
|
|||||||
COMMON_ARG_SPEC,
|
COMMON_ARG_SPEC,
|
||||||
RESOURCE_ARG_SPEC,
|
RESOURCE_ARG_SPEC,
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import (
|
|
||||||
AnsibleK8SModule,
|
|
||||||
)
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
||||||
get_api_client,
|
get_api_client,
|
||||||
)
|
)
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import (
|
||||||
|
AnsibleK8SModule,
|
||||||
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import (
|
||||||
CoreException,
|
CoreException,
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.service import (
|
|
||||||
K8sService,
|
|
||||||
)
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.resource import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.resource import (
|
||||||
create_definitions,
|
create_definitions,
|
||||||
)
|
)
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.runner import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.runner import (
|
||||||
perform_action,
|
perform_action,
|
||||||
)
|
)
|
||||||
|
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.service import (
|
||||||
|
K8sService,
|
||||||
|
)
|
||||||
|
|
||||||
SERVICE_ARG_SPEC = {
|
SERVICE_ARG_SPEC = {
|
||||||
"apply": {"type": "bool", "default": False},
|
"apply": {"type": "bool", "default": False},
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ __metaclass__ = type
|
|||||||
DOCUMENTATION = r"""
|
DOCUMENTATION = r"""
|
||||||
module: k8s_taint
|
module: k8s_taint
|
||||||
short_description: Taint a node in a Kubernetes/OpenShift cluster
|
short_description: Taint a node in a Kubernetes/OpenShift cluster
|
||||||
version_added: "2.3.0"
|
version_added: 2.3.0
|
||||||
author: Alina Buzachis (@alinabuzachis)
|
author: Alina Buzachis (@alinabuzachis)
|
||||||
description:
|
description:
|
||||||
- Taint allows a node to refuse Pod to be scheduled unless that Pod has a matching toleration.
|
- Taint allows a node to refuse Pod to be scheduled unless that Pod has a matching toleration.
|
||||||
@@ -60,8 +60,8 @@ options:
|
|||||||
default: false
|
default: false
|
||||||
type: bool
|
type: bool
|
||||||
requirements:
|
requirements:
|
||||||
- python >= 3.6
|
- python >= 3.9
|
||||||
- kubernetes >= 12.0.0
|
- kubernetes >= 24.2.0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = r"""
|
EXAMPLES = r"""
|
||||||
@@ -127,7 +127,6 @@ result:
|
|||||||
import copy
|
import copy
|
||||||
|
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import (
|
||||||
AnsibleModule,
|
AnsibleModule,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
kubernetes>=12.0.0
|
kubernetes>=24.2.0
|
||||||
requests-oauthlib
|
requests-oauthlib
|
||||||
jsonpatch
|
jsonpatch
|
||||||
|
|||||||
@@ -24,3 +24,5 @@ test_namespace:
|
|||||||
- "helm-local-path-003"
|
- "helm-local-path-003"
|
||||||
- "helm-from-repository"
|
- "helm-from-repository"
|
||||||
- "helm-from-url"
|
- "helm-from-url"
|
||||||
|
- "helm-reuse-values"
|
||||||
|
- "helm-chart-with-space-into-name"
|
||||||
|
|||||||
130
tests/integration/targets/helm/library/helm_test_pending.py
Normal file
130
tests/integration/targets/helm/library/helm_test_pending.py
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright: (c) 2023, Ansible Project
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
|
DOCUMENTATION = r"""
|
||||||
|
---
|
||||||
|
module: helm_test_pending
|
||||||
|
short_description: created pending-install release
|
||||||
|
author:
|
||||||
|
- Aubin Bikouo (@abikouo)
|
||||||
|
requirements:
|
||||||
|
- "helm (https://github.com/helm/helm/releases)"
|
||||||
|
description:
|
||||||
|
- This module is used to create a pending install release for integration testing
|
||||||
|
- The scope of this module is the integration testing of the kubernetes.core collection only.
|
||||||
|
options:
|
||||||
|
binary_path:
|
||||||
|
description:
|
||||||
|
- The path of a helm binary to use.
|
||||||
|
required: true
|
||||||
|
type: path
|
||||||
|
chart_ref:
|
||||||
|
description:
|
||||||
|
- chart reference on chart repository (e.g. my-repo/my-chart-ref)
|
||||||
|
required: true
|
||||||
|
type: str
|
||||||
|
chart_release:
|
||||||
|
description:
|
||||||
|
- Release name to manage.
|
||||||
|
required: true
|
||||||
|
type: str
|
||||||
|
chart_release_namespace:
|
||||||
|
description:
|
||||||
|
- Kubernetes namespace where the chart should be installed.
|
||||||
|
required: true
|
||||||
|
type: str
|
||||||
|
"""
|
||||||
|
|
||||||
|
EXAMPLES = r"""
|
||||||
|
"""
|
||||||
|
|
||||||
|
RETURN = r"""
|
||||||
|
"""
|
||||||
|
|
||||||
|
import json
|
||||||
|
import subprocess
|
||||||
|
import time
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
class HelmReleaseNotFoundError(Exception):
|
||||||
|
def __init__(self, message):
|
||||||
|
super().__init__(message)
|
||||||
|
|
||||||
|
|
||||||
|
def create_pending_install_release(helm_binary, chart_ref, chart_release, namespace):
|
||||||
|
# create pending-install release
|
||||||
|
command = [
|
||||||
|
helm_binary,
|
||||||
|
"install",
|
||||||
|
chart_release,
|
||||||
|
chart_ref,
|
||||||
|
"--namespace",
|
||||||
|
namespace,
|
||||||
|
"--wait",
|
||||||
|
]
|
||||||
|
proc = subprocess.Popen(command)
|
||||||
|
time.sleep(2)
|
||||||
|
proc.kill()
|
||||||
|
# ensure release status is pending-install
|
||||||
|
command = [
|
||||||
|
helm_binary,
|
||||||
|
"list",
|
||||||
|
"--all",
|
||||||
|
"--output=json",
|
||||||
|
"--namespace",
|
||||||
|
namespace,
|
||||||
|
"--filter",
|
||||||
|
chart_release,
|
||||||
|
]
|
||||||
|
cmd = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
out, err = cmd.communicate()
|
||||||
|
|
||||||
|
data = json.loads(out)
|
||||||
|
if not data:
|
||||||
|
error = "Release %s not found." % chart_release
|
||||||
|
raise HelmReleaseNotFoundError(message=error)
|
||||||
|
return data[0]["status"] == "pending-install", data[0]["status"]
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
module = AnsibleModule(
|
||||||
|
argument_spec=dict(
|
||||||
|
binary_path=dict(type="path", required=True),
|
||||||
|
chart_ref=dict(type="str", required=True),
|
||||||
|
chart_release=dict(type="str", required=True),
|
||||||
|
chart_release_namespace=dict(type="str", required=True),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
params = dict(
|
||||||
|
helm_binary=module.params.get("binary_path"),
|
||||||
|
chart_release=module.params.get("chart_release"),
|
||||||
|
chart_ref=module.params.get("chart_ref"),
|
||||||
|
namespace=module.params.get("chart_release_namespace"),
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
result, status = create_pending_install_release(**params)
|
||||||
|
if not result:
|
||||||
|
module.fail_json(
|
||||||
|
msg="unable to create pending-install release, current status is %s"
|
||||||
|
% status
|
||||||
|
)
|
||||||
|
module.exit_json(changed=True, msg="Release created with status '%s'" % status)
|
||||||
|
except HelmReleaseNotFoundError as err:
|
||||||
|
module.fail_json(
|
||||||
|
msg="Error while trying to create pending-install release due to '%s'" % err
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -52,12 +52,12 @@ result:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.kubernetes.core.plugins.module_utils.version import (
|
from ansible_collections.kubernetes.core.plugins.module_utils.version import (
|
||||||
LooseVersion,
|
LooseVersion,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|||||||
7
tests/integration/targets/helm/playbook.yaml
Normal file
7
tests/integration/targets/helm/playbook.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- connection: local
|
||||||
|
gather_facts: true
|
||||||
|
hosts: localhost
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- helm
|
||||||
5
tests/integration/targets/helm/runme.sh
Executable file
5
tests/integration/targets/helm/runme.sh
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eux
|
||||||
|
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
|
||||||
|
export ANSIBLE_ROLES_PATH=../
|
||||||
|
ansible-playbook playbook.yaml "$@"
|
||||||
@@ -25,12 +25,18 @@
|
|||||||
- from_repository
|
- from_repository
|
||||||
- from_url
|
- from_url
|
||||||
|
|
||||||
|
- name: test helm upgrade with reuse_values
|
||||||
|
include_tasks: test_helm_reuse_values.yml
|
||||||
|
|
||||||
- name: test helm dependency update
|
- name: test helm dependency update
|
||||||
include_tasks: test_up_dep.yml
|
include_tasks: test_up_dep.yml
|
||||||
|
|
||||||
- name: Test helm uninstall
|
- name: Test helm uninstall
|
||||||
include_tasks: test_helm_uninstall.yml
|
include_tasks: test_helm_uninstall.yml
|
||||||
|
|
||||||
|
- name: Test helm install with chart name containing space
|
||||||
|
include_tasks: test_helm_with_space_into_chart_name.yml
|
||||||
|
|
||||||
# https://github.com/ansible-collections/community.kubernetes/issues/296
|
# https://github.com/ansible-collections/community.kubernetes/issues/296
|
||||||
- name: Test Skip CRDS feature in helm chart install
|
- name: Test Skip CRDS feature in helm chart install
|
||||||
include_tasks: test_crds.yml
|
include_tasks: test_crds.yml
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
---
|
||||||
|
- name: Test helm reuse_values
|
||||||
|
vars:
|
||||||
|
helm_namespace: "{{ test_namespace[9] }}"
|
||||||
|
chart_release_values:
|
||||||
|
replica:
|
||||||
|
replicaCount: 3
|
||||||
|
master:
|
||||||
|
count: 1
|
||||||
|
kind: Deployment
|
||||||
|
chart_reuse_values:
|
||||||
|
replica:
|
||||||
|
replicaCount: 1
|
||||||
|
master:
|
||||||
|
count: 3
|
||||||
|
block:
|
||||||
|
- name: Initial chart installation
|
||||||
|
helm:
|
||||||
|
binary_path: "{{ helm_binary }}"
|
||||||
|
chart_ref: redis
|
||||||
|
chart_repo_url: https://charts.bitnami.com/bitnami
|
||||||
|
release_name: test-redis
|
||||||
|
release_namespace: "{{ helm_namespace }}"
|
||||||
|
create_namespace: true
|
||||||
|
release_values: "{{ chart_release_values }}"
|
||||||
|
register: install
|
||||||
|
|
||||||
|
- name: Get value set as string
|
||||||
|
helm_info:
|
||||||
|
binary_path: "{{ helm_binary }}"
|
||||||
|
release_name: test-redis
|
||||||
|
release_namespace: "{{ helm_namespace }}"
|
||||||
|
register: release_value
|
||||||
|
|
||||||
|
- name: Validate that chart values are as expected
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- install is changed
|
||||||
|
- '"--reuse-values=True" not in install.command'
|
||||||
|
- release_value["status"]["values"] == chart_release_values
|
||||||
|
|
||||||
|
- name: Upgrade chart using reuse_values=true
|
||||||
|
helm:
|
||||||
|
binary_path: "{{ helm_binary }}"
|
||||||
|
chart_ref: redis
|
||||||
|
chart_repo_url: https://charts.bitnami.com/bitnami
|
||||||
|
release_name: test-redis
|
||||||
|
release_namespace: "{{ helm_namespace }}"
|
||||||
|
reuse_values: true
|
||||||
|
reset_values: false
|
||||||
|
release_values: "{{ chart_reuse_values }}"
|
||||||
|
register: upgrade
|
||||||
|
|
||||||
|
- name: Get value set as string
|
||||||
|
helm_info:
|
||||||
|
binary_path: "{{ helm_binary }}"
|
||||||
|
release_name: test-redis
|
||||||
|
release_namespace: "{{ helm_namespace }}"
|
||||||
|
register: release_value
|
||||||
|
|
||||||
|
- name: Validate that chart values are as expected
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- upgrade is changed
|
||||||
|
- '"--reuse-values=True" in upgrade.command'
|
||||||
|
- '"--reset-values" not in upgrade.command'
|
||||||
|
- release_value["status"]["values"] == chart_release_values | combine(chart_reuse_values, recursive=true)
|
||||||
|
|
||||||
|
always:
|
||||||
|
- name: Remove helm namespace
|
||||||
|
k8s:
|
||||||
|
api_version: v1
|
||||||
|
kind: Namespace
|
||||||
|
name: "{{ helm_namespace }}"
|
||||||
|
state: absent
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
- vars:
|
- vars:
|
||||||
chart_source: "https://github.com/kubernetes/kube-state-metrics/releases/download/kube-state-metrics-helm-chart-2.13.3/kube-state-metrics-2.13.3.tgz"
|
chart_source: "https://github.com/kubernetes/kube-state-metrics/releases/download/kube-state-metrics-helm-chart-2.13.3/kube-state-metrics-2.13.3.tgz"
|
||||||
chart_name: "test-wait-uninstall"
|
chart_name: "test-wait-uninstall"
|
||||||
|
chart_name_pending: "test-uninstall-pending-release"
|
||||||
helm_namespace: "{{ test_namespace[1] }}"
|
helm_namespace: "{{ test_namespace[1] }}"
|
||||||
block:
|
block:
|
||||||
|
|
||||||
@@ -64,6 +65,36 @@
|
|||||||
wait: yes
|
wait: yes
|
||||||
register: uninstall
|
register: uninstall
|
||||||
|
|
||||||
|
# Test uninstall chart release with 'pending-install' status
|
||||||
|
- name: Create chart release with 'pending-install' status
|
||||||
|
helm_test_pending:
|
||||||
|
binary_path: "{{ helm_binary }}"
|
||||||
|
chart_ref: "{{ chart_source }}"
|
||||||
|
chart_release: "{{ chart_name_pending }}"
|
||||||
|
chart_release_namespace: "{{ helm_namespace }}"
|
||||||
|
|
||||||
|
- name: Uninstall chart release with 'pending-install' status
|
||||||
|
helm:
|
||||||
|
binary_path: "{{ helm_binary }}"
|
||||||
|
release_name: "{{ chart_name_pending }}"
|
||||||
|
namespace: "{{ helm_namespace }}"
|
||||||
|
release_state: absent
|
||||||
|
register: _uninstall
|
||||||
|
|
||||||
|
- name: Get Helm release details
|
||||||
|
helm_info:
|
||||||
|
binary_path: "{{ helm_binary }}"
|
||||||
|
release_namespace: "{{ helm_namespace }}"
|
||||||
|
release_state: pending
|
||||||
|
release_name: "{{ chart_name_pending }}"
|
||||||
|
register: _info
|
||||||
|
|
||||||
|
- name: assert release does not exist anymore
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- _uninstall is changed
|
||||||
|
- _info.status is undefined
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Delete temp directory
|
- name: Delete temp directory
|
||||||
file:
|
file:
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
---
|
||||||
|
- name: Create test directory
|
||||||
|
ansible.builtin.tempfile:
|
||||||
|
state: directory
|
||||||
|
suffix: .helm
|
||||||
|
register: test_dir
|
||||||
|
|
||||||
|
- name: Test helm using directory with space
|
||||||
|
vars:
|
||||||
|
helm_dir: "{{ test_dir.path }}/Deploy Chart"
|
||||||
|
helm_namespace: "{{ test_namespace[10] }}"
|
||||||
|
chart_release_name: "deploy-chart-with-space-into-name"
|
||||||
|
helm_local_src: "test-chart"
|
||||||
|
block:
|
||||||
|
- name: Copy helm file into destination
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ helm_local_src }}"
|
||||||
|
dest: "{{ helm_dir }}"
|
||||||
|
|
||||||
|
- name: Install chart from local source with Space into name
|
||||||
|
helm:
|
||||||
|
binary_path: "{{ helm_binary }}"
|
||||||
|
name: "{{ chart_release_name }}"
|
||||||
|
chart_ref: "{{ helm_dir }}/{{ helm_local_src | basename }}"
|
||||||
|
namespace: "{{ helm_namespace }}"
|
||||||
|
create_namespace: true
|
||||||
|
register: install_chart
|
||||||
|
|
||||||
|
- name: Assert that chart is installed
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- install_chart is changed
|
||||||
|
- install_chart.status.status | lower == 'deployed'
|
||||||
|
|
||||||
|
- name: Check helm_info content
|
||||||
|
helm_info:
|
||||||
|
binary_path: "{{ helm_binary }}"
|
||||||
|
name: "{{ chart_release_name }}"
|
||||||
|
namespace: "{{ helm_namespace }}"
|
||||||
|
register: chart_info
|
||||||
|
|
||||||
|
- name: Assert that Chart is installed (using helm_info)
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- chart_info.status.status | lower == 'deployed'
|
||||||
|
|
||||||
|
always:
|
||||||
|
- name: Delete temporary directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
state: absent
|
||||||
|
name: "{{ test_dir.path }}"
|
||||||
|
|
||||||
|
- name: Remove helm namespace
|
||||||
|
k8s:
|
||||||
|
api_version: v1
|
||||||
|
kind: Namespace
|
||||||
|
name: "{{ helm_namespace }}"
|
||||||
|
state: absent
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- install.status.chart == "{{ chart_test }}-{{ chart_test_version }}"
|
- install.status.chart == chart_test+"-"+chart_test_version
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
|
|
||||||
- name: Check helm_info content
|
- name: Check helm_info content
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
- name: "Assert that {{ chart_test }} is installed from {{ source }} with helm_info"
|
- name: "Assert that {{ chart_test }} is installed from {{ source }} with helm_info"
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- content_info.status.chart == "{{ chart_test }}-{{ chart_test_version }}"
|
- content_info.status.chart == chart_test+"-"+chart_test_version
|
||||||
- content_info.status.status | lower == 'deployed'
|
- content_info.status.status | lower == 'deployed'
|
||||||
- release_state_content_info.status.status | lower == 'deployed'
|
- release_state_content_info.status.status | lower == 'deployed'
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is not changed
|
- install is not changed
|
||||||
- install.status.chart == "{{ chart_test }}-{{ chart_test_version }}"
|
- install.status.chart == chart_test+"-"+chart_test_version
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
|
|
||||||
- name: "Add vars to {{ chart_test }} from {{ source }}"
|
- name: "Add vars to {{ chart_test }} from {{ source }}"
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
- install.status.chart == "{{ chart_test }}-{{ chart_test_version }}"
|
- install.status.chart == chart_test+"-"+chart_test_version
|
||||||
- "install.status['values'].revisionHistoryLimit == 0"
|
- "install.status['values'].revisionHistoryLimit == 0"
|
||||||
|
|
||||||
- name: Check idempotency after adding vars
|
- name: Check idempotency after adding vars
|
||||||
@@ -148,7 +148,7 @@
|
|||||||
that:
|
that:
|
||||||
- install is not changed
|
- install is not changed
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
- install.status.chart == "{{ chart_test }}-{{ chart_test_version }}"
|
- install.status.chart == chart_test+"-"+chart_test_version
|
||||||
- "install.status['values'].revisionHistoryLimit == 0"
|
- "install.status['values'].revisionHistoryLimit == 0"
|
||||||
|
|
||||||
- name: "Remove Vars to {{ chart_test }} from {{ source }}"
|
- name: "Remove Vars to {{ chart_test }} from {{ source }}"
|
||||||
@@ -165,7 +165,7 @@
|
|||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
- install.status.chart == "{{ chart_test }}-{{ chart_test_version }}"
|
- install.status.chart == chart_test+"-"+chart_test_version
|
||||||
- install.status['values'] == {}
|
- install.status['values'] == {}
|
||||||
|
|
||||||
- name: Check idempotency after removing vars
|
- name: Check idempotency after removing vars
|
||||||
@@ -182,7 +182,7 @@
|
|||||||
that:
|
that:
|
||||||
- install is not changed
|
- install is not changed
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
- install.status.chart == "{{ chart_test }}-{{ chart_test_version }}"
|
- install.status.chart == chart_test+"-"+chart_test_version
|
||||||
- install.status['values'] == {}
|
- install.status['values'] == {}
|
||||||
|
|
||||||
- name: "Upgrade {{ chart_test }} from {{ source }}"
|
- name: "Upgrade {{ chart_test }} from {{ source }}"
|
||||||
@@ -199,7 +199,7 @@
|
|||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
- install.status.chart == "{{ chart_test }}-{{ chart_test_version_upgrade }}"
|
- install.status.chart == chart_test+"-"+chart_test_version_upgrade
|
||||||
|
|
||||||
- name: Check idempotency after upgrade
|
- name: Check idempotency after upgrade
|
||||||
helm:
|
helm:
|
||||||
@@ -215,7 +215,7 @@
|
|||||||
that:
|
that:
|
||||||
- install is not changed
|
- install is not changed
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
- install.status.chart == "{{ chart_test }}-{{ chart_test_version_upgrade }}"
|
- install.status.chart == chart_test+"-"+chart_test_version_upgrade
|
||||||
|
|
||||||
- name: "Remove {{ chart_test }} from {{ source }}"
|
- name: "Remove {{ chart_test }} from {{ source }}"
|
||||||
helm:
|
helm:
|
||||||
@@ -316,7 +316,7 @@
|
|||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
- install.status.chart == "{{ chart_test }}-{{ chart_test_version }}"
|
- install.status.chart == chart_test+"-"+chart_test_version
|
||||||
- "install.status['values'].revisionHistoryLimit == 0"
|
- "install.status['values'].revisionHistoryLimit == 0"
|
||||||
|
|
||||||
- name: "Install {{ chart_test }} from {{ source }} with values_files (again)"
|
- name: "Install {{ chart_test }} from {{ source }} with values_files (again)"
|
||||||
@@ -357,7 +357,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
- result is not failed
|
- result is not failed
|
||||||
- result.rc == 0
|
- result.rc == 0
|
||||||
- result.command is match("{{ helm_binary }} template {{ chart_source }}")
|
- result.command is match(helm_binary+" template "+chart_source)
|
||||||
|
|
||||||
- name: Check templates created
|
- name: Check templates created
|
||||||
stat:
|
stat:
|
||||||
@@ -388,7 +388,7 @@
|
|||||||
- result is changed
|
- result is changed
|
||||||
- result is not failed
|
- result is not failed
|
||||||
- result.rc == 0
|
- result.rc == 0
|
||||||
- result.command is match("{{ helm_binary }} template MyRelease {{ chart_source }}")
|
- result.command is match(helm_binary+" template MyRelease "+chart_source)
|
||||||
- result.stdout is search("ThisValue")
|
- result.stdout is search("ThisValue")
|
||||||
when: chart_source is search("test-chart")
|
when: chart_source is search("test-chart")
|
||||||
# limit assertion of test result to controlled (local) chart_source
|
# limit assertion of test result to controlled (local) chart_source
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: chart-reuse-values
|
||||||
|
description: A Helm chart for Kubernetes
|
||||||
|
|
||||||
|
# A chart can be either an 'application' or a 'library' chart.
|
||||||
|
#
|
||||||
|
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||||
|
# to be deployed.
|
||||||
|
#
|
||||||
|
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||||
|
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||||
|
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||||
|
type: application
|
||||||
|
|
||||||
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
|
# to the chart and its templates, including the app version.
|
||||||
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
|
version: 0.1.0
|
||||||
|
|
||||||
|
# This is the version number of the application being deployed. This version number should be
|
||||||
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
|
# It is recommended to use it with quotes.
|
||||||
|
appVersion: "1.16.0"
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: cmap
|
||||||
|
data:
|
||||||
|
ansible_version: {{ .Values.ansible_version }}
|
||||||
|
phase: {{ .Values.phase }}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ansible_version: milestone
|
||||||
|
phase: uat
|
||||||
7
tests/integration/targets/helm_diff/playbook.yaml
Normal file
7
tests/integration/targets/helm_diff/playbook.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- connection: local
|
||||||
|
gather_facts: true
|
||||||
|
hosts: localhost
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- helm_diff
|
||||||
5
tests/integration/targets/helm_diff/runme.sh
Executable file
5
tests/integration/targets/helm_diff/runme.sh
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eux
|
||||||
|
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
|
||||||
|
export ANSIBLE_ROLES_PATH=../
|
||||||
|
ansible-playbook playbook.yaml "$@"
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user