mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-11-21 14:48:37 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11b861f77e | ||
|
|
536eded7d0 | ||
|
|
408802cb67 | ||
|
|
782672d2fd | ||
|
|
ebb0d7f087 | ||
|
|
b7e1ed5661 | ||
|
|
f650940f0a | ||
|
|
4314ad6091 | ||
|
|
177297fdae | ||
|
|
10584acdbb | ||
|
|
094240ab77 | ||
|
|
f42c78ce83 | ||
|
|
c46180bb6f | ||
|
|
8a9dd54fe7 | ||
|
|
031bc475fa | ||
|
|
c098ecc8c8 | ||
|
|
732925b986 | ||
|
|
cb00cf3c9e | ||
|
|
7df5e01974 | ||
|
|
a7922e498c | ||
|
|
d9e0218dba | ||
|
|
0bc99117af | ||
|
|
c643719085 | ||
|
|
e475d06403 | ||
|
|
f31ecce59c | ||
|
|
3e58e3a9ad | ||
|
|
d4ef10fc80 | ||
|
|
ec8942dd90 | ||
|
|
08a761fc17 | ||
|
|
dd4ca7a8b0 | ||
|
|
b1d809d9f3 | ||
|
|
18f8894a22 | ||
|
|
3876bc1a21 | ||
|
|
470c042690 | ||
|
|
75a5560aec | ||
|
|
a80e2d067c | ||
|
|
6bb9cce51b | ||
|
|
4b3e24bf02 | ||
|
|
bc17b33d44 | ||
|
|
3634105366 | ||
|
|
ceeafa8c6d | ||
|
|
a4fc40732a | ||
|
|
0836e96c2d | ||
|
|
d211f316ad | ||
|
|
bb80dde66d | ||
|
|
8bf31513f5 | ||
|
|
ae90b60fd6 | ||
|
|
1c20b53bdc | ||
|
|
f69761f37c | ||
|
|
cb7a932951 | ||
|
|
248e0d7db9 | ||
|
|
53c6c0ee80 | ||
|
|
b58b2ca70e | ||
|
|
8a58d3b6de | ||
|
|
e79ed52a4d | ||
|
|
4d7dc2a7d1 | ||
|
|
c2cfa51655 | ||
|
|
fb10b41918 | ||
|
|
210467b26d | ||
|
|
11f619b69e | ||
|
|
16e92a20e8 | ||
|
|
58f8f2e6e9 | ||
|
|
52f9a5b54b | ||
|
|
e6076e5568 | ||
|
|
42acb4f52b | ||
|
|
d239adbbbc | ||
|
|
6d942f5e45 | ||
|
|
bc0406cf02 | ||
|
|
23b6cec173 | ||
|
|
34beacf32b | ||
|
|
3e32c12c40 | ||
|
|
13791ec7bf | ||
|
|
452fb3d7cb | ||
|
|
12abc9bda9 | ||
|
|
987c029c87 | ||
|
|
6c00f7c7de | ||
|
|
bd1cacc0cf | ||
|
|
9cfa9038fc | ||
|
|
1c16a2d2b5 | ||
|
|
798f5493f9 | ||
|
|
4fa36487ab | ||
|
|
34467d42b3 | ||
|
|
ae624cfa44 | ||
|
|
05e5e0a5ac | ||
|
|
87344b93fc | ||
|
|
200d64f5ea | ||
|
|
ec35c74e2e | ||
|
|
027700c3f4 | ||
|
|
da93cce1fa | ||
|
|
448d3fe156 | ||
|
|
6158300062 | ||
|
|
3160e4aad6 | ||
|
|
93734fcefc | ||
|
|
a861079dc1 | ||
|
|
5148ee5f74 | ||
|
|
c48778d709 | ||
|
|
cf3c3a9dcc | ||
|
|
1705ced1b5 | ||
|
|
6a0635a2bb | ||
|
|
f568c9da62 | ||
|
|
94e42354cd | ||
|
|
642eb936c0 | ||
|
|
775959c3f9 | ||
|
|
77627bb8d9 | ||
|
|
b1fbd38352 | ||
|
|
a06b2c3969 | ||
|
|
34fd40d46a |
@@ -1,6 +1,9 @@
|
||||
---
|
||||
profile: production
|
||||
|
||||
warn_list:
|
||||
- no-log-password
|
||||
|
||||
exclude_paths:
|
||||
- .ansible/
|
||||
- .github/
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
# https://docs.ansible.com/ansible-lint/docs/rules/
|
||||
# no-changed-when is not requried for examples
|
||||
plugins/connection/kubectl.py no-changed-when
|
||||
# false positive result
|
||||
plugins/connection/kubectl.py var-naming[no-reserved]
|
||||
plugins/connection/kubectl.py jinja[invalid]
|
||||
# collection EE metadata is not an ansible-builder definition file
|
||||
meta/execution-environment.yml schema[execution-environment]
|
||||
|
||||
@@ -81,8 +81,6 @@ jobs:
|
||||
steps:
|
||||
- run: |
|
||||
python -c "
|
||||
import sys
|
||||
|
||||
required = ['sanity', 'units', 'coverage']
|
||||
if '${{ github.event_name }}' == 'pull_request':
|
||||
required = ['security-check', 'linters', 'sanity', 'units', 'coverage']
|
||||
@@ -93,29 +91,7 @@ jobs:
|
||||
'units': '${{ needs.units.result }}',
|
||||
'coverage': '${{ needs.coverage.result }}',
|
||||
}
|
||||
|
||||
for name in required:
|
||||
if results[name] == 'failure':
|
||||
print(f'all_green: required job failed: {name} results={results}', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
# cancel-in-progress superseded this run; do not fail (newer run is authoritative)
|
||||
if any(v == 'cancelled' for v in results.values()):
|
||||
print(
|
||||
'all_green: one or more jobs cancelled (usually concurrency); skipping strict gate.',
|
||||
results,
|
||||
)
|
||||
sys.exit(0)
|
||||
|
||||
not_ok = [j for j in required if results[j] != 'success']
|
||||
if not_ok:
|
||||
print(f'all_green: required jobs not success: {not_ok} results={results}', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
for job, status in results.items():
|
||||
if job not in required and status not in ('success', 'skipped'):
|
||||
print(f'all_green: unexpected {job}={status} results={results}', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
print('all_green OK', results)
|
||||
ok = all(results[j] == 'success' for j in required)
|
||||
skipped_ok = all(results[j] in ('success', 'skipped') for j in results)
|
||||
assert ok and skipped_ok, f'required={required} results={results}'
|
||||
"
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Run collection certification checks
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- stable-*
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: cert-ver-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
call:
|
||||
uses: ansible-collections/partner-certification-checker/.github/workflows/certification-reusable.yml@f4bf7ba4d3f008b2db8fc6a812fa3f89fdf42c2e # v4.1.0
|
||||
@@ -0,0 +1,210 @@
|
||||
name: Integration tests Helm
|
||||
|
||||
concurrency:
|
||||
group: integration-tests-helm-${{ github.head_ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- labeled
|
||||
- unlabeled
|
||||
- synchronize
|
||||
branches:
|
||||
- main
|
||||
- stable-*
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
splitter:
|
||||
env:
|
||||
source_dir: "./source"
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
helm_targets: ${{ steps.select-targets.outputs.targets }}
|
||||
permissions:
|
||||
pull-requests: read
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout the collection repository
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
path: ${{ env.source_dir }}
|
||||
fetch-depth: "0"
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: list changes for pull request
|
||||
id: splitter
|
||||
uses: ansible-network/github_actions/.github/actions/ansible_test_splitter@4678c74a7d712d55e663c88f66eec6d9c3642550
|
||||
with:
|
||||
collections_to_test: ${{ env.source_dir }}
|
||||
total_jobs: 8
|
||||
|
||||
- name: Select Helm targets
|
||||
id: select-targets
|
||||
run: |
|
||||
import os, json
|
||||
with open(os.environ.get('GITHUB_OUTPUT'), "a", encoding="utf-8") as fh:
|
||||
data = os.environ.get("ALL_TEST_TARGETS")
|
||||
targets = []
|
||||
for target in data.split(";"):
|
||||
if target and ':' in target:
|
||||
targets.extend([v for v in target.split(':', maxsplit=1)[1].split(',') if v.startswith('helm')])
|
||||
fh.write(f'targets={json.dumps(targets)}\n')
|
||||
shell: python
|
||||
env:
|
||||
ALL_TEST_TARGETS: ${{ steps.splitter.outputs.test_targets }}
|
||||
|
||||
integration:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
needs:
|
||||
- splitter
|
||||
if: ${{ needs.splitter.outputs.helm_targets != '' && needs.splitter.outputs.helm_targets != '[]' }}
|
||||
env:
|
||||
source: "./source"
|
||||
ansible_posix: "./ansible_posix"
|
||||
community_general: "./community_general"
|
||||
ansible-version: "milestone"
|
||||
python-version: "3.13"
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
helm-version:
|
||||
- v3.0.0
|
||||
- v3.1.0
|
||||
- v3.8.0
|
||||
- v3.10.3
|
||||
- v3.15.4
|
||||
- v3.16.0
|
||||
- v3.17.0
|
||||
- v3.22.0
|
||||
- v4.0.0
|
||||
- v4.2.1
|
||||
- latest
|
||||
ansible_test_target: ${{ fromJson(needs.splitter.outputs.helm_targets) }}
|
||||
exclude:
|
||||
# helm_registry_auth: only test against recent versions to reduce CI cost
|
||||
- ansible_test_target: "helm_registry_auth"
|
||||
helm-version: "v3.0.0"
|
||||
- ansible_test_target: "helm_registry_auth"
|
||||
helm-version: "v3.1.0"
|
||||
- ansible_test_target: "helm_registry_auth"
|
||||
helm-version: "v3.8.0"
|
||||
- ansible_test_target: "helm_registry_auth"
|
||||
helm-version: "v3.10.3"
|
||||
- ansible_test_target: "helm_registry_auth"
|
||||
helm-version: "v3.15.4"
|
||||
- ansible_test_target: "helm_registry_auth"
|
||||
helm-version: "v3.16.0"
|
||||
# helm install/upgrade --create-namespace requires helm >= 3.2.0
|
||||
- ansible_test_target: "helm_diff"
|
||||
helm-version: "v3.0.0"
|
||||
- ansible_test_target: "helm_diff"
|
||||
helm-version: "v3.1.0"
|
||||
- ansible_test_target: "helm_diff"
|
||||
helm-version: "v3.8.0"
|
||||
- ansible_test_target: "helm_diff"
|
||||
helm-version: "v3.10.3"
|
||||
# UPGRADE FAILED: conflict occurred while applying object helm-diff/test-chart-another-configmap /v1
|
||||
- ansible_test_target: "helm_diff"
|
||||
helm-version: "v4.0.0"
|
||||
- ansible_test_target: "helm_repository"
|
||||
helm-version: "v3.0.0"
|
||||
- ansible_test_target: "helm_repository"
|
||||
helm-version: "v3.1.0"
|
||||
- ansible_test_target: "helm_kubeconfig"
|
||||
helm-version: "v3.0.0"
|
||||
- ansible_test_target: "helm_kubeconfig"
|
||||
helm-version: "v3.1.0"
|
||||
- ansible_test_target: "helm_set_values"
|
||||
helm-version: "v3.0.0"
|
||||
- ansible_test_target: "helm_set_values"
|
||||
helm-version: "v3.1.0"
|
||||
- ansible_test_target: "helm_set_values"
|
||||
helm-version: "v3.8.0"
|
||||
- ansible_test_target: "helm"
|
||||
helm-version: "v3.0.0"
|
||||
- ansible_test_target: "helm"
|
||||
helm-version: "v3.1.0"
|
||||
- ansible_test_target: "helm_uninstall"
|
||||
helm-version: "v3.0.0"
|
||||
- ansible_test_target: "helm_uninstall"
|
||||
helm-version: "v3.1.0"
|
||||
name: "${{ matrix.ansible_test_target }}-${{ matrix.helm-version }}"
|
||||
steps:
|
||||
- name: Checkout kubernetes.core repository
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
path: ${{ env.source }}
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up Python ${{ env.python-version }}
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: ${{ env.python-version }}
|
||||
|
||||
# install ansible
|
||||
- name: Install ansible-core (${{ env.ansible-version }})
|
||||
env:
|
||||
ANSIBLE_VERSION: ${{ env.ansible-version }}
|
||||
run: |
|
||||
curl -sSL --proto '=https' --tlsv1.2 --retry 5 --retry-delay 10 --retry-all-errors \
|
||||
"https://github.com/ansible/ansible/archive/${ANSIBLE_VERSION}.tar.gz" \
|
||||
-o ansible.tar.gz
|
||||
python3 -m pip install --disable-pip-version-check ./ansible.tar.gz
|
||||
rm ansible.tar.gz
|
||||
shell: bash
|
||||
|
||||
- name: Build and install collection
|
||||
id: install-src
|
||||
uses: ansible-network/github_actions/.github/actions/build_install_collection@4678c74a7d712d55e663c88f66eec6d9c3642550
|
||||
with:
|
||||
install_python_dependencies: true
|
||||
source_path: ${{ env.source }}
|
||||
|
||||
- name: create kubernetes cluster
|
||||
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
|
||||
with:
|
||||
node_image: "kindest/node:v1.29.2"
|
||||
|
||||
- name: "Install Helm version ${{ matrix.helm-version }}"
|
||||
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
|
||||
with:
|
||||
version: '${{ matrix.helm-version }}'
|
||||
|
||||
- name: Verify Helm Installation
|
||||
run: helm version
|
||||
|
||||
- name: Disable selinux with selinux_please_lie_to_me
|
||||
run: |
|
||||
python3 -m pip uninstall -y selinux
|
||||
python3 -m pip install --only-binary=:all: selinux_please_lie_to_me==1.0.1
|
||||
shell: bash
|
||||
|
||||
- name: Install python requirements
|
||||
run: python3 -m pip install -r requirements.txt -r test-requirements.txt
|
||||
shell: bash
|
||||
working-directory: ${{ steps.install-src.outputs.collection_path }}
|
||||
|
||||
- name: Run integration tests
|
||||
run: >-
|
||||
ansible-test integration
|
||||
--diff
|
||||
--no-temp-workdir
|
||||
--color
|
||||
--skip-tags False
|
||||
--retry-on-error
|
||||
--continue-on-error
|
||||
--python ${{ env.python-version }}
|
||||
-v
|
||||
${{ matrix.ansible_test_target }}
|
||||
shell: bash
|
||||
working-directory: ${{ steps.install-src.outputs.collection_path }}
|
||||
@@ -17,9 +17,8 @@ jobs:
|
||||
source_dir: "./source"
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
test_targets: ${{ steps.splitter.outputs.test_targets }}
|
||||
test_targets_json: ${{ steps.splitter.outputs.test_targets_json }}
|
||||
test_jobs: ${{ steps.splitter.outputs.test_jobs }}
|
||||
test_targets: ${{ steps.select-targets.outputs.targets }}
|
||||
test_jobs: ${{ steps.select-targets.outputs.jobs }}
|
||||
steps:
|
||||
- name: Checkout the collection repository
|
||||
uses: actions/checkout@v3
|
||||
@@ -35,18 +34,40 @@ jobs:
|
||||
collections_to_test: ${{ env.source_dir }}
|
||||
total_jobs: 8
|
||||
|
||||
- name: Display splitter output
|
||||
- name: Remove all Helm related targets
|
||||
id: select-targets
|
||||
run: |
|
||||
echo "test_targets=${{ steps.splitter.outputs.test_targets }}"
|
||||
echo "test_targets_json=${{ steps.splitter.outputs.test_targets_json }}"
|
||||
echo "test_jobs=${{ steps.splitter.outputs.test_jobs }}"
|
||||
import os, json
|
||||
with open(os.environ.get('GITHUB_OUTPUT'), "a", encoding="utf-8") as fh:
|
||||
data = os.environ.get("ALL_TEST_TARGETS")
|
||||
index = 0
|
||||
result = {}
|
||||
for target in data.split(";"):
|
||||
if target and ':' in target:
|
||||
k8s = [v for v in target.split(':', maxsplit=1)[1].split(',') if not v.startswith('helm')]
|
||||
if k8s:
|
||||
result[index] = ' '.join(k8s)
|
||||
index += 1
|
||||
fh.write(f'targets={json.dumps(result)}\n')
|
||||
fh.write(f'jobs={json.dumps(list(result.keys()))}\n')
|
||||
shell: python
|
||||
env:
|
||||
ALL_TEST_TARGETS: ${{ steps.splitter.outputs.test_targets }}
|
||||
|
||||
- name: Display splitter output
|
||||
env:
|
||||
TARGETS: ${{ steps.select-targets.outputs.targets }}
|
||||
JOBS: ${{ steps.select-targets.outputs.jobs }}
|
||||
run: |
|
||||
echo "targets => $TARGETS"
|
||||
echo "jobs => $JOBS"
|
||||
shell: bash
|
||||
integration:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
needs:
|
||||
- splitter
|
||||
if: ${{ needs.splitter.outputs.test_targets != '' }}
|
||||
if: ${{ needs.splitter.outputs.test_jobs != '' && needs.splitter.outputs.test_jobs != '[]' }}
|
||||
env:
|
||||
source: "./source"
|
||||
cloud_common: "./cloudcommon"
|
||||
@@ -56,15 +77,24 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# Ref must match a branch/tag on github.com/ansible/ansible (e.g. stable-2.18, not 2.18).
|
||||
ansible-version: ["stable-2.18", "milestone"]
|
||||
#
|
||||
ansible-version: ["stable-2.18", "stable-2.21", "milestone"]
|
||||
enable-turbo-mode: [true, false]
|
||||
python-version: ["3.12", "3.13"]
|
||||
exclude:
|
||||
# stable-2.18 is used mainly because turbo mode, no reason to test it with turbo mode disabled
|
||||
- ansible-version: "stable-2.18"
|
||||
enable-turbo-mode: false
|
||||
# turbo mode is supported only by ansible<2.19
|
||||
- ansible-version: "milestone"
|
||||
enable-turbo-mode: true
|
||||
# stable-2.18 supports 3.12; milestone (devel) requires >=3.13
|
||||
- ansible-version: "stable-2.21"
|
||||
enable-turbo-mode: true
|
||||
# stable-2.18 supports 3.12
|
||||
- ansible-version: "stable-2.18"
|
||||
python-version: "3.13"
|
||||
- ansible-version: "stable-2.21"
|
||||
python-version: "3.12"
|
||||
- ansible-version: "milestone"
|
||||
python-version: "3.12"
|
||||
workflow-id: ${{ fromJson(needs.splitter.outputs.test_jobs) }}
|
||||
@@ -78,12 +108,14 @@ jobs:
|
||||
fh.write(f'ansible_test_targets={json.loads(os.environ.get("ALL_TEST_TARGETS")).get(os.environ.get("WORKFLOW_ID"))}\n')
|
||||
shell: python
|
||||
env:
|
||||
ALL_TEST_TARGETS: ${{ needs.splitter.outputs.test_targets_json }}
|
||||
ALL_TEST_TARGETS: ${{ needs.splitter.outputs.test_targets }}
|
||||
WORKFLOW_ID: ${{ matrix.workflow-id }}
|
||||
|
||||
- name: Display ansible test targets
|
||||
env:
|
||||
ANSIBLE_TEST_TARGETS: ${{ steps.read-targets.outputs.ansible_test_targets }}
|
||||
run: |
|
||||
echo "ansible_test_targets -> ${{ steps.read-targets.outputs.ansible_test_targets }}"
|
||||
echo "ansible_test_targets -> $ANSIBLE_TEST_TARGETS"
|
||||
|
||||
- name: Checkout kubernetes.core repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
name: label new issues
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
|
||||
jobs:
|
||||
add_label:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
steps:
|
||||
- uses: actions-ecosystem/action-add-labels@v1
|
||||
with:
|
||||
labels: needs_triage
|
||||
+2
-1
@@ -16,12 +16,13 @@ tests/integration/cloud-config-*
|
||||
.ansible
|
||||
|
||||
# Helm charts
|
||||
tests/integration/*-chart-*.tgz
|
||||
tests/integration/*.tgz
|
||||
tests/integration/targets/*/*.tgz
|
||||
|
||||
# ansible-test generated file
|
||||
tests/integration/inventory
|
||||
tests/integration/*-*.yml
|
||||
tests/integration/integration_config.yml
|
||||
|
||||
# IDE and editor settings
|
||||
.vscode/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
repos:
|
||||
- repo: https://github.com/ansible/cloud-content-ci-automation
|
||||
rev: precommit_hook
|
||||
rev: 77f45b0357b6b3c27b04e934f0f51c9b50b7aa25
|
||||
hooks:
|
||||
- id: block-ide-ai-files
|
||||
always_run: true
|
||||
|
||||
+145
-3
@@ -4,6 +4,48 @@ Kubernetes Collection Release Notes
|
||||
|
||||
.. contents:: Topics
|
||||
|
||||
v6.6.0
|
||||
======
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- Remove the remaining ``ansible.module_utils.six`` import to avoid deprecation warnings, replacing it with the Python standard library equivalent (https://github.com/ansible-collections/kubernetes.core/pull/1197).
|
||||
- helm - Add ``wait_for_jobs`` option to wait for all Jobs to complete before marking a Helm release as successful. Requires Helm >= 3.5.0 (https://github.com/ansible-collections/kubernetes.core/pull/1140).
|
||||
- helm - add the ``cleanup_on_fail`` option, mapping to the ``--cleanup-on-fail`` flag, to allow deletion of new resources created during a failed upgrade. It complements ``atomic`` and can be combined with it, but cannot be used with ``replace``, since that deploys through ``helm install`` which does not accept the flag (https://github.com/ansible-collections/kubernetes.core/pull/1206).
|
||||
- helm - warn when ``reuse_values`` or ``reset_then_reuse_values`` is requested in a combination helm ignores, which happens by default because ``reset_values`` defaults to ``true``, and whenever either is combined with ``replace``. The option descriptions and the examples now state that ``reset_values`` has to be set to ``false`` for either option to take effect (https://github.com/ansible-collections/kubernetes.core/pull/1230).
|
||||
- k8s lookup - warn when ``ENABLE_TURBO_MODE`` is set but the ``cloud.common`` collection is not installed, instead of silently falling back to the standard lookup base (https://github.com/ansible-collections/kubernetes.core/pull/1242).
|
||||
- k8s_cp - Add the ``copy_timeout`` option (default 300 seconds) bounding how long the module will spend streaming an archive to a pod and waiting for the remote ``tar`` to finish, so that a stalled copy fails instead of hanging indefinitely (https://github.com/ansible-collections/kubernetes.core/pull/1217).
|
||||
- k8s_cp - Stream the tar archive to the pod chunk by chunk instead of building the whole archive in memory first, which cuts peak memory use when copying large files (https://github.com/ansible-collections/kubernetes.core/pull/1217).
|
||||
- k8s_cp - When copying to a pod, the module now also uses ``/bin/sh`` and ``head`` in the container, when present, to confirm the copy completed. Containers without them keep the previous behaviour and get a warning that completion could not be verified (https://github.com/ansible-collections/kubernetes.core/pull/1217).
|
||||
- k8s_info - Support for metadata-only fetches in k8s_info module (https://github.com/ansible-collections/kubernetes.core/pull/1030)
|
||||
- meta - Add ``helm_plugin`` and ``helm_plugin_info`` to the ``helm`` action group, and ``k8s_taint`` to the ``k8s`` action group, so that ``module_defaults`` set on those groups applies to them (https://github.com/ansible-collections/kubernetes.core/pull/1216).
|
||||
- use `collections.abc` instead of deprecated `ansible.module_utils.common._collections_compat` (https://github.com/ansible-collections/kubernetes.core/pull/1057).
|
||||
- waiter - Add ``job_complete`` predicate to support waiting for Job resources to reach ``Complete`` or ``Failed`` condition (https://github.com/ansible-collections/kubernetes.core/issues/1201).
|
||||
|
||||
Deprecated Features
|
||||
-------------------
|
||||
|
||||
- Ansible Turbo mode (``ENABLE_TURBO_MODE``) has been deprecated and will be removed in release 8.0.0, as it depends on the ``cloud.common`` collection, which is being retired (https://github.com/ansible-collections/kubernetes.core/pull/1242).
|
||||
- helm - the ``status.values`` return value has been deprecated and will be removed in version 8.0.0. Use ``status.release_values`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- helm - the ``wait_timeout`` parameter has been deprecated and will be removed in version 7.0.0. Use ``timeout`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- helm_info - the ``status.values`` return value has been deprecated and will be removed in version 8.0.0. Use ``status.release_values`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- k8s_exec - the ``return_code`` return value has been deprecated and will be removed in version 7.0.0. Use ``rc`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- k8s_service - the ``merge_type=json`` option has been deprecated and will be removed in version 7.0.0. Use ``kubernetes.core.k8s_json_patch`` module instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- Ansible Turbo mode - ignore ``ENABLE_TURBO_MODE`` on ansible-core 2.19.0 and later, where the ``cloud.common`` collection is not supported, and fall back to the standard ``AnsibleModule`` instead of failing with ``byte indices must be integers or slices, not str`` (https://github.com/ansible-collections/kubernetes.core/pull/1242).
|
||||
- helm - do not pass the upgrade-only ``--reuse-values`` and ``--reset-then-reuse-values`` flags to ``helm install``, which rejected them with ``unknown flag`` whenever ``reuse_values`` or ``reset_then_reuse_values`` was combined with ``replace`` (https://github.com/ansible-collections/kubernetes.core/pull/1230).
|
||||
- helm - fix the ``reuse_values`` example, which set only ``reuse_values=true``. ``reset_values`` defaults to ``true`` and helm ignores ``--reuse-values`` whenever ``--reset-values`` is passed, so following the example reset the release values instead of reusing them (https://github.com/ansible-collections/kubernetes.core/pull/1230).
|
||||
- helm - skip Helm's OCI registry progress messages when parsing the output of ``helm show chart``. As of Helm 4.2.1 these are printed to stdout instead of stderr (https://github.com/helm/helm/pull/32056), which made installing a chart from an OCI registry fail with a YAML scanner error when the chart version contained a ``+`` (https://github.com/ansible-collections/kubernetes.core/pull/1223).
|
||||
- helm_repository - normalize both sides of the repository URL comparison, so that a repository already registered with a trailing slash is recognized as matching instead of failing with ``Repository already have a repository named <name>`` (https://github.com/ansible-collections/kubernetes.core/pull/1236).
|
||||
- helm_template - strip Helm's OCI registry progress messages from the returned ``stdout``, which is documented to contain only the rendered templates (https://github.com/ansible-collections/kubernetes.core/pull/1223).
|
||||
- k8s lookup - ignore ``ENABLE_TURBO_MODE`` on ansible-core 2.19.0 and later, where the ``cloud.common`` collection is not supported. Fall back to the standard ``LookupBase`` instead of failing with a traceback (https://github.com/ansible-collections/kubernetes.core/pull/1253).
|
||||
- k8s_cp - Fix silent truncation when copying to a pod. The module closed the exec connection immediately after writing the last chunk of the tar archive, which killed the remote ``tar`` before it had finished extracting, and never checked the process exit status, so a partial copy was reported as a success. The archive is now bounded with ``head -c`` so ``tar`` gets a clean EOF and exits on its own, and the module waits for that exit and fails on a non-zero status (https://github.com/ansible-collections/kubernetes.core/pull/1217).
|
||||
- k8s_info - Handle empty template output gracefully by returning ``changed=false`` instead of failing when Jinja2 template renders to an empty string (https://github.com/ansible-collections/kubernetes.core/issues/1042).
|
||||
|
||||
v6.5.0
|
||||
======
|
||||
|
||||
@@ -142,12 +184,112 @@ Bugfixes
|
||||
v6.0.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
This major release removes the deprecated ``k8s`` inventory plugin and also removes ``ansible-core<2.16`` support.
|
||||
|
||||
Breaking Changes / Porting Guide
|
||||
--------------------------------
|
||||
|
||||
- Remove deprecated ``k8s`` invetory plugin (https://github.com/ansible-collections/kubernetes.core/pull/867).
|
||||
- Remove support for ``ansible-core<2.16`` (https://github.com/ansible-collections/kubernetes.core/pull/867).
|
||||
|
||||
v5.5.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
This minor release deprecates Ansible Turbo mode (``ENABLE_TURBO_MODE``), the ``status.values`` return value of the ``helm`` and ``helm_info`` modules, the ``wait_timeout`` parameter of the ``helm`` module, the ``return_code`` return value of the ``k8s_exec`` module, and the ``merge_type=json`` option of the ``k8s_service`` module. It also includes bugfixes for ``helm_repository`` URL comparison and for empty template output handling in ``k8s_info``.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- Remove the remaining ``ansible.module_utils.six`` import to avoid deprecation warnings, replacing it with the Python standard library equivalent (https://github.com/ansible-collections/kubernetes.core/pull/1197).
|
||||
- k8s lookup - warn when ``ENABLE_TURBO_MODE`` is set but the ``cloud.common`` collection is not installed, instead of silently falling back to the standard lookup base (https://github.com/ansible-collections/kubernetes.core/pull/1242).
|
||||
|
||||
Deprecated Features
|
||||
-------------------
|
||||
|
||||
- Ansible Turbo mode (``ENABLE_TURBO_MODE``) has been deprecated and will be removed in release 8.0.0, as it depends on the ``cloud.common`` collection, which is being retired (https://github.com/ansible-collections/kubernetes.core/pull/1242).
|
||||
- helm - the ``status.values`` return value has been deprecated and will be removed in version 8.0.0. Use ``status.release_values`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- helm - the ``wait_timeout`` parameter has been deprecated and will be removed in version 7.0.0. Use ``timeout`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- helm_info - the ``status.values`` return value has been deprecated and will be removed in version 8.0.0. Use ``status.release_values`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- k8s_exec - the ``return_code`` return value has been deprecated and will be removed in version 7.0.0. Use ``rc`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- k8s_service - the ``merge_type=json`` option has been deprecated and will be removed in version 7.0.0. Use ``kubernetes.core.k8s_json_patch`` module instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- Ansible Turbo mode - ignore ``ENABLE_TURBO_MODE`` on ansible-core 2.19.0 and later, where the ``cloud.common`` collection is not supported, and fall back to the standard ``AnsibleModule`` instead of failing with ``byte indices must be integers or slices, not str`` (https://github.com/ansible-collections/kubernetes.core/pull/1242).
|
||||
- helm_repository - normalize both sides of the repository URL comparison, so that a repository already registered with a trailing slash is recognized as matching instead of failing with ``Repository already have a repository named <name>`` (https://github.com/ansible-collections/kubernetes.core/pull/1236).
|
||||
- k8s lookup - ignore ``ENABLE_TURBO_MODE`` on ansible-core 2.19.0 and later, where the ``cloud.common`` collection is not supported. Fall back to the standard ``LookupBase`` instead of failing with a traceback (https://github.com/ansible-collections/kubernetes.core/pull/1253).
|
||||
- k8s_info - Handle empty template output gracefully by returning ``changed=false`` instead of failing when Jinja2 template renders to an empty string (https://github.com/ansible-collections/kubernetes.core/issues/1042).
|
||||
|
||||
v5.4.4
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
This release corrects the documented and enforced minimum ``ansible-core`` version to ``>=2.16.0``.
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- meta - Update ``requires_ansible`` in ``runtime.yml`` and README to ``>=2.16.0`` to match the actual minimum supported ``ansible-core`` version (https://github.com/ansible-collections/kubernetes.core/pull/1193).
|
||||
|
||||
v5.4.3
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
This release contains bugfixes such as improved idempotency for helm repository URLs with trailing slashes.
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- ee - Add ``meta/execution-environment.yml`` to decouple ansible-builder EE builds from the ``openshift-clients`` system dependency declared in ``bindep.txt``, which is not available in standard UBI repositories and caused builds to fail with ``No package matches 'openshift-clients'`` (https://github.com/ansible-collections/kubernetes.core/issues/1141).
|
||||
- helm_repository - Correct handling of repository URLs with trailing slashes (https://github.com/ansible-collections/kubernetes.core/pull/1121).
|
||||
- k8s_drain - Fix logic for handling pods with local storage to correctly check for empty_dir volumes in replicated pods and pods managed by DaemonSets (https://github.com/ansible-collections/kubernetes.core/pull/1095).
|
||||
|
||||
v5.4.2
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
This release includes bugfixes such as replacing the passing of ``warnings`` to ``exit_json`` with ``AnsibleModule.warn`` as well as a security update for selectively redacting sensitive information from kubeconfig, and adds a new ``release_values`` key to the ``status`` return value.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- helm - Add ``release_values`` key to ``status`` return value that can be accessed using Jinja2 dot notation (https://github.com/ansible-collections/kubernetes.core/pull/1056).
|
||||
- helm_info - Add ``release_values`` key to ``status`` return value that can be accessed using Jinja2 dot notation (https://github.com/ansible-collections/kubernetes.core/pull/1056).
|
||||
|
||||
Deprecated Features
|
||||
-------------------
|
||||
|
||||
- helm - the ``status.values`` return value has been deprecated and will be removed in a release after 2027-01-08. Use ``status.release_values`` instead (https://github.com/ansible-collections/kubernetes.core/pull/1056).
|
||||
- helm_info - the ``status.values`` return value has been deprecated and will be removed in a release after 2027-01-08. Use ``status.release_values`` instead (https://github.com/ansible-collections/kubernetes.core/pull/1056).
|
||||
|
||||
Security Fixes
|
||||
--------------
|
||||
|
||||
- Selectively redact sensitive info from kubeconfig instead of applying blanket ``no_log=True`` (https://github.com/ansible-collections/kubernetes.core/pull/1014).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- Add idempotency for ``helm_pull`` module (https://github.com/ansible-collections/kubernetes.core/pull/1055).
|
||||
- Fixed a bug where setting ``K8S_AUTH_VERIFY_SSL=true`` (or any string value) caused the value to be treated as a separate ``kubectl`` command argument (https://github.com/ansible-collections/kubernetes.core/pull/1049).
|
||||
- Limit supported versions of Helm to <4.0.0 (https://github.com/ansible-collections/kubernetes.core/pull/1039).
|
||||
- Replace passing ``warnings`` to ``exit_json`` with ``AnsibleModule.warn`` in the ``k8s_drain``, ``k8s_rollback.py`` and ``k8s_scale.py`` modules as it deprecated in ``ansible-core>=2.19.0`` and will be removed in ``ansible-core>=2.23.0`` (https://github.com/ansible-collections/kubernetes.core/pull/1033).
|
||||
- k8s - Fix return block from the module documentation (https://github.com/ansible-collections/kubernetes.core/pull/1056).
|
||||
- meta - Add ``k8s_cluster_info``, ``k8s_json_patch`` and ``k8s_rollback`` to k8s action group (https://github.com/ansible-collections/kubernetes.core/pull/992).
|
||||
|
||||
v5.4.1
|
||||
======
|
||||
|
||||
@@ -187,15 +329,15 @@ This release includes minor changes, bug fixes and also bumps ``ansible-lint`` v
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- Bump version of ``ansible-lint`` to 25.1.2 (https://github.com/ansible-collections/kubernetes.core/pull/919).
|
||||
- action/k8s_info - update templating mechanism with changes from ``ansible-core 2.19`` (https://github.com/ansible-collections/kubernetes.core/pull/888).
|
||||
- helm - add ``reset_then_reuse_values`` support to helm module (https://github.com/ansible-collections/kubernetes.core/issues/803).
|
||||
- helm - add support for ``insecure_skip_tls_verify`` option to helm and helm_repository(https://github.com/ansible-collections/kubernetes.core/issues/694).
|
||||
- helm - add support for ``insecure_skip_tls_verify`` option to helm and ``helm_repository`` (https://github.com/ansible-collections/kubernetes.core/issues/694).
|
||||
- kubernetes.core - Bump version of ``ansible-lint`` to ``25.1.2`` (https://github.com/ansible-collections/kubernetes.core/pull/919).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- module_utils/k8s/service - fix issue when trying to delete resource using ``delete_options`` and ``check_mode=true`` (https://github.com/ansible-collections/kubernetes.core/issues/892).
|
||||
- module_utils/k8s/service - fix issue when trying to delete resource using `delete_options` and `check_mode=true` (https://github.com/ansible-collections/kubernetes.core/issues/892).
|
||||
|
||||
v5.2.0
|
||||
======
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Also needs to be updated in galaxy.yml
|
||||
VERSION = 6.5.0
|
||||
VERSION = 7.0.0-dev0
|
||||
|
||||
TEST_ARGS ?= ""
|
||||
PYTHON_VERSION ?= `python -c 'import platform; print(".".join(platform.python_version_tuple()[0:2]))'`
|
||||
|
||||
@@ -94,23 +94,27 @@ Before using the Kubernetes collection, you need to install it with the Ansible
|
||||
|
||||
ansible-galaxy collection install kubernetes.core
|
||||
|
||||
Red Hat customers can install certified content from [Ansible Automation Hub](https://console.redhat.com/ansible/automation-hub). Configure Automation Hub as the primary content source for the Ansible Galaxy CLI by following the [Red Hat configuration guide](https://docs.redhat.com/en/documentation/red_hat_ansible_automation_platform/2.4/html/getting_started_with_automation_hub/configure-hub-primary), then install the collection with `ansible-galaxy collection install kubernetes.core`.
|
||||
|
||||
You can also include it in a `requirements.yml` file and install it via `ansible-galaxy collection install -r requirements.yml`, using the format:
|
||||
|
||||
```yaml
|
||||
---
|
||||
collections:
|
||||
- name: kubernetes.core
|
||||
version: 6.5.0
|
||||
version: 6.6.0
|
||||
```
|
||||
|
||||
### Installing the Kubernetes Python Library
|
||||
|
||||
Content in this collection requires the [Kubernetes Python client](https://pypi.org/project/kubernetes/) to interact with Kubernetes' APIs. You can install it with:
|
||||
Content in this collection requires the [Kubernetes Python client](https://pypi.org/project/kubernetes/) to interact with Kubernetes' APIs. For installs outside an execution environment, install it with:
|
||||
|
||||
```bash
|
||||
pip3 install kubernetes
|
||||
```
|
||||
|
||||
Execution environments install this dependency when they are built with `ansible-builder`; you do not need to install it separately with `pip3` in that case.
|
||||
|
||||
## Use Cases
|
||||
|
||||
It's preferable to use content in this collection using their Fully Qualified Collection Namespace (FQCN), for example `kubernetes.core.k8s_info`:
|
||||
@@ -181,7 +185,9 @@ For documentation on how to use individual modules and other content included in
|
||||
|
||||
## Ansible Turbo Mode Tech Preview
|
||||
|
||||
> **Note:** Ansible Turbo mode is supported only with ``ansible-core`` versions **lower than 2.19**. Starting from ``ansible-core`` 2.19, the ``cloud.common`` collection is no longer supported, and therefore Ansible Turbo mode is also not supported in ``kubernetes.core``. If ``ENABLE_TURBO_MODE`` is set to ``1`` (or any truthy value) with ``ansible-core >= 2.19.0``, it may lead to fails.
|
||||
> **Deprecated:** Ansible Turbo mode (`ENABLE_TURBO_MODE`) is deprecated and will be removed in a future major release (planned for 8.0.0), since it depends on the `cloud.common` collection, which is being retired. Setting `ENABLE_TURBO_MODE` will keep emitting a deprecation warning until support is removed, at which point the variable will have no effect.
|
||||
|
||||
> **Note:** Ansible Turbo mode is supported only with ``ansible-core`` versions **lower than 2.19**. Starting from ``ansible-core`` 2.19, the ``cloud.common`` collection is no longer supported, and therefore Ansible Turbo mode is also not supported in ``kubernetes.core``. If ``ENABLE_TURBO_MODE`` is set to ``1`` (or any truthy value) with ``ansible-core >= 2.19.0``, Turbo mode is ignored and a warning is emitted; modules run without it.
|
||||
|
||||
The ``kubernetes.core`` collection supports Ansible Turbo mode as a tech preview via the ``cloud.common`` collection (requires `ansible-core < 2.19`). By default, this feature is disabled. To enable Turbo mode for modules, set the environment variable `ENABLE_TURBO_MODE=1` on the managed node. For example:
|
||||
|
||||
@@ -197,7 +203,7 @@ The ``kubernetes.core`` collection supports Ansible Turbo mode as a tech preview
|
||||
To enable Turbo mode for k8s lookup plugin, set the environment variable `ENABLE_TURBO_MODE=1` on the managed node. This is not working when
|
||||
defined in the playbook using `environment` keyword as above, you must set it using `export ENABLE_TURBO_MODE=1`.
|
||||
|
||||
Please read more about Ansible Turbo mode - [here](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/ansible_turbo_mode.rst).
|
||||
Please read more about Ansible Turbo mode - [here](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/ansible_turbo_mode.rst).
|
||||
|
||||
## Testing
|
||||
|
||||
@@ -213,6 +219,8 @@ You can run the collection's test suites with the commands:
|
||||
make test-integration
|
||||
make test-unit
|
||||
|
||||
For instructions on running Helm integration tests locally, see the [integration tests README](https://github.com/ansible-collections/kubernetes.core/blob/main/tests/integration/README.md).
|
||||
|
||||
### Testing with `molecule`
|
||||
|
||||
There are also integration tests in the `molecule` directory which are meant to be run against a local Kubernetes cluster, e.g. using [KinD](https://kind.sigs.k8s.io) or [Minikube](https://minikube.sigs.k8s.io). To set up a local cluster using KinD and run Molecule:
|
||||
@@ -224,7 +232,7 @@ There are also integration tests in the `molecule` directory which are meant to
|
||||
|
||||
If you want to develop new content for this collection or improve what is already here, clone the Git repository into one of the configured [`COLLECTIONS_PATHS`](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#collections-paths) and work on it there.
|
||||
|
||||
See [Contributing to kubernetes.core](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/CONTRIBUTING.md).
|
||||
See [Contributing to kubernetes.core](https://github.com/ansible-collections/kubernetes.core/blob/main/CONTRIBUTING.md).
|
||||
|
||||
Join the Ansible community:
|
||||
|
||||
@@ -241,6 +249,8 @@ This project follows the [Ansible Code of Conduct](https://docs.ansible.com/ansi
|
||||
|
||||
## Support
|
||||
|
||||
This collection is maintained by Red Hat Ansible Cloud Content.
|
||||
|
||||
As Red Hat Ansible Certified Content, this collection is entitled to support through the Ansible Automation Platform (AAP) using the **Create issue** button on the top right corner. If a support case cannot be opened with Red Hat and the collection has been obtained either from Galaxy or GitHub, there may be community help available on the [Ansible Forum](https://forum.ansible.com/).
|
||||
|
||||
> **Note:** The `stable-4` branch (all `4.x.y` releases) is no longer supported. No backports or releases are performed on `stable-4`.
|
||||
@@ -249,7 +259,7 @@ We announce releases and important changes through Ansible's [The Bullhorn newsl
|
||||
|
||||
We take part in the global quarterly [Ansible Contributor Summit](https://github.com/ansible/community/wiki/Contributor-Summit). Track The Bullhorn and join when announced.
|
||||
|
||||
For the latest supported versions, see [Release Notes and Roadmap](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/README.md#release-notes-and-roadmap).
|
||||
For the latest supported versions, see [Release Notes and Roadmap](https://github.com/ansible-collections/kubernetes.core/blob/main/README.md#release-notes-and-roadmap).
|
||||
|
||||
Report bugs, request features, or ask questions by opening an issue in the [GitHub repository](https://github.com/ansible-collections/kubernetes.core/).
|
||||
|
||||
@@ -261,7 +271,7 @@ Releases are automatically built and pushed to Ansible Galaxy for any new tag. B
|
||||
1. The `version` in `galaxy.yml`
|
||||
2. This README's `requirements.yml` example
|
||||
3. The `VERSION` in `Makefile`
|
||||
2. Update the CHANGELOG:
|
||||
2. Update the [CHANGELOG](CHANGELOG.rst):
|
||||
1. Make sure you have [`antsibull-changelog`](https://pypi.org/project/antsibull-changelog/) installed.
|
||||
2. Make sure there are fragments for all known changes in `changelogs/fragments`.
|
||||
3. Run `antsibull-changelog release`.
|
||||
@@ -276,9 +286,9 @@ The process for [uploading a supported release to Automation Hub](https://docs.r
|
||||
|
||||
* [Using Ansible collections](https://docs.ansible.com/ansible/devel/user_guide/collections_using.html)
|
||||
* [Ansible communication guide](https://docs.ansible.com/ansible/devel/community/communication.html)
|
||||
* [Continuous integration (CI) overview](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/CI.md)
|
||||
* [SonarCloud integration](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/SONARCLOUD.md)
|
||||
* [Ansible Turbo mode (tech preview)](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/ansible_turbo_mode.rst)
|
||||
* [Continuous integration (CI) overview](https://github.com/ansible-collections/kubernetes.core/blob/main/CI.md)
|
||||
* [SonarCloud integration](https://github.com/ansible-collections/kubernetes.core/blob/main/SONARCLOUD.md)
|
||||
* [Ansible Turbo mode (tech preview)](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/ansible_turbo_mode.rst)
|
||||
|
||||
### Code of conduct
|
||||
|
||||
@@ -290,4 +300,4 @@ If you encounter abusive behavior, please refer to the [policy violations](https
|
||||
|
||||
GNU General Public License v3.0 or later
|
||||
|
||||
See [LICENSE](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/LICENSE) to see the full text.
|
||||
See [LICENSE](https://github.com/ansible-collections/kubernetes.core/blob/main/LICENSE) to see the full text.
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ Workflow files:
|
||||
|
||||
Scanner configuration lives in [sonar-project.properties](sonar-project.properties).
|
||||
|
||||
The **coverage** job (in **`all_green`**) uses **`ansible-test`** (`units --coverage`, then **`coverage combine`** / **`coverage xml`**) with **ansible-core `stable-2.18`** on **`stable-6`**, then writes **`coverage.xml`** with workspace paths normalized for Sonar. **`pytest-cov`** is listed in **`tests/unit/requirements.txt`** for parity and any direct pytest runs; **`ansible-test`** still owns the coverage data used in CI.
|
||||
The **coverage** job (in **`all_green`**) uses **`ansible-test`** (`units --coverage`, then **`coverage combine`** / **`coverage xml`**), then writes **`coverage.xml`** with workspace paths normalized for Sonar. **`pytest-cov`** is listed in **`tests/unit/requirements.txt`** for parity and any direct pytest runs; **`ansible-test`** still owns the coverage data used in CI.
|
||||
|
||||
**`sonarcloud.yml`** declares a required secret **`ANSIBLE_COLLECTIONS_ORG_SONAR_TOKEN_CICD_BOT`** and **`permissions: contents: read`**, **`pull-requests: read`**.
|
||||
|
||||
|
||||
@@ -1073,6 +1073,132 @@ releases:
|
||||
- 20250922-remove-ansible-six-imports.yaml
|
||||
- 5.4.1.yml
|
||||
release_date: '2025-10-07'
|
||||
5.4.2:
|
||||
changes:
|
||||
bugfixes:
|
||||
- Add idempotency for ``helm_pull`` module (https://github.com/ansible-collections/kubernetes.core/pull/1055).
|
||||
- Fixed a bug where setting ``K8S_AUTH_VERIFY_SSL=true`` (or any string value)
|
||||
caused the value to be treated as a separate ``kubectl`` command argument
|
||||
(https://github.com/ansible-collections/kubernetes.core/pull/1049).
|
||||
- Limit supported versions of Helm to <4.0.0 (https://github.com/ansible-collections/kubernetes.core/pull/1039).
|
||||
- Replace passing ``warnings`` to ``exit_json`` with ``AnsibleModule.warn``
|
||||
in the ``k8s_drain``, ``k8s_rollback.py`` and ``k8s_scale.py`` modules as
|
||||
it deprecated in ``ansible-core>=2.19.0`` and will be removed in ``ansible-core>=2.23.0``
|
||||
(https://github.com/ansible-collections/kubernetes.core/pull/1033).
|
||||
- k8s - Fix return block from the module documentation (https://github.com/ansible-collections/kubernetes.core/pull/1056).
|
||||
- meta - Add ``k8s_cluster_info``, ``k8s_json_patch`` and ``k8s_rollback`` to
|
||||
k8s action group (https://github.com/ansible-collections/kubernetes.core/pull/992).
|
||||
deprecated_features:
|
||||
- helm - the ``status.values`` return value has been deprecated and will be
|
||||
removed in a release after 2027-01-08. Use ``status.release_values`` instead
|
||||
(https://github.com/ansible-collections/kubernetes.core/pull/1056).
|
||||
- helm_info - the ``status.values`` return value has been deprecated and will
|
||||
be removed in a release after 2027-01-08. Use ``status.release_values`` instead
|
||||
(https://github.com/ansible-collections/kubernetes.core/pull/1056).
|
||||
minor_changes:
|
||||
- helm - Add ``release_values`` key to ``status`` return value that can be accessed
|
||||
using Jinja2 dot notation (https://github.com/ansible-collections/kubernetes.core/pull/1056).
|
||||
- helm_info - Add ``release_values`` key to ``status`` return value that can
|
||||
be accessed using Jinja2 dot notation (https://github.com/ansible-collections/kubernetes.core/pull/1056).
|
||||
release_summary: This release includes bugfixes such as replacing the passing
|
||||
of ``warnings`` to ``exit_json`` with ``AnsibleModule.warn`` as well as a
|
||||
security update for selectively redacting sensitive information from kubeconfig,
|
||||
and adds a new ``release_values`` key to the ``status`` return value.
|
||||
security_fixes:
|
||||
- Selectively redact sensitive info from kubeconfig instead of applying blanket
|
||||
``no_log=True`` (https://github.com/ansible-collections/kubernetes.core/pull/1014).
|
||||
fragments:
|
||||
- 1033-warnings-deprecations.yaml
|
||||
- 20251002-fix-k8s-actiongroup.yaml
|
||||
- 20251007-selective-kubeconfig-redaction.yaml
|
||||
- 20251115-limit-versions-of-helm.yaml
|
||||
- 20251220-fix-K8S_AUTH_VERIFY_SSL-in-kubectl-connecton-plugion.yaml
|
||||
- 20260107-add-idempodency-for-helm-pull.yaml
|
||||
- 20260108-fix-sanity-failures.yml
|
||||
- 5-4-2.yaml
|
||||
release_date: '2026-02-03'
|
||||
5.4.3:
|
||||
changes:
|
||||
bugfixes:
|
||||
- ee - Add ``meta/execution-environment.yml`` to decouple ansible-builder EE
|
||||
builds from the ``openshift-clients`` system dependency declared in ``bindep.txt``,
|
||||
which is not available in standard UBI repositories and caused builds to fail
|
||||
with ``No package matches 'openshift-clients'`` (https://github.com/ansible-collections/kubernetes.core/issues/1141).
|
||||
- helm_repository - Correct handling of repository URLs with trailing slashes
|
||||
(https://github.com/ansible-collections/kubernetes.core/pull/1121).
|
||||
- k8s_drain - Fix logic for handling pods with local storage to correctly check
|
||||
for empty_dir volumes in replicated pods and pods managed by DaemonSets (https://github.com/ansible-collections/kubernetes.core/pull/1095).
|
||||
release_summary: This release contains bugfixes such as improved idempotency
|
||||
for helm repository URLs with trailing slashes.
|
||||
fragments:
|
||||
- 1173-security-check-workflow.yml
|
||||
- 20260306-k8s_drain-delete-logic-fixes-for-daemonsets.yaml
|
||||
- 20260506-improve_idempotency_for_helm_repository.yaml
|
||||
- 5-4-3.yml
|
||||
- fix-openshift-clients-ee-dependency.yaml
|
||||
release_date: '2026-07-08'
|
||||
5.4.4:
|
||||
changes:
|
||||
bugfixes:
|
||||
- meta - Update ``requires_ansible`` in ``runtime.yml`` and README to ``>=2.16.0``
|
||||
to match the actual minimum supported ``ansible-core`` version (https://github.com/ansible-collections/kubernetes.core/pull/1193).
|
||||
release_summary: This release corrects the documented and enforced minimum ``ansible-core``
|
||||
version to ``>=2.16.0``.
|
||||
release_date: '2026-07-09'
|
||||
5.5.0:
|
||||
changes:
|
||||
bugfixes:
|
||||
- Ansible Turbo mode - ignore ``ENABLE_TURBO_MODE`` on ansible-core 2.19.0 and
|
||||
later, where the ``cloud.common`` collection is not supported, and fall back
|
||||
to the standard ``AnsibleModule`` instead of failing with ``byte indices must
|
||||
be integers or slices, not str`` (https://github.com/ansible-collections/kubernetes.core/pull/1242).
|
||||
- helm_repository - normalize both sides of the repository URL comparison, so
|
||||
that a repository already registered with a trailing slash is recognized as
|
||||
matching instead of failing with ``Repository already have a repository named
|
||||
<name>`` (https://github.com/ansible-collections/kubernetes.core/pull/1236).
|
||||
- k8s lookup - ignore ``ENABLE_TURBO_MODE`` on ansible-core 2.19.0 and later,
|
||||
where the ``cloud.common`` collection is not supported. Fall back to the standard
|
||||
``LookupBase`` instead of failing with a traceback (https://github.com/ansible-collections/kubernetes.core/pull/1253).
|
||||
- k8s_info - Handle empty template output gracefully by returning ``changed=false``
|
||||
instead of failing when Jinja2 template renders to an empty string (https://github.com/ansible-collections/kubernetes.core/issues/1042).
|
||||
deprecated_features:
|
||||
- Ansible Turbo mode (``ENABLE_TURBO_MODE``) has been deprecated and will be
|
||||
removed in release 8.0.0, as it depends on the ``cloud.common`` collection,
|
||||
which is being retired (https://github.com/ansible-collections/kubernetes.core/pull/1242).
|
||||
- helm - the ``status.values`` return value has been deprecated and will be
|
||||
removed in version 8.0.0. Use ``status.release_values`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- helm - the ``wait_timeout`` parameter has been deprecated and will be removed
|
||||
in version 7.0.0. Use ``timeout`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- helm_info - the ``status.values`` return value has been deprecated and will
|
||||
be removed in version 8.0.0. Use ``status.release_values`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- k8s_exec - the ``return_code`` return value has been deprecated and will be
|
||||
removed in version 7.0.0. Use ``rc`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- k8s_service - the ``merge_type=json`` option has been deprecated and will
|
||||
be removed in version 7.0.0. Use ``kubernetes.core.k8s_json_patch`` module
|
||||
instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
minor_changes:
|
||||
- Remove the remaining ``ansible.module_utils.six`` import to avoid deprecation
|
||||
warnings, replacing it with the Python standard library equivalent (https://github.com/ansible-collections/kubernetes.core/pull/1197).
|
||||
- k8s lookup - warn when ``ENABLE_TURBO_MODE`` is set but the ``cloud.common``
|
||||
collection is not installed, instead of silently falling back to the standard
|
||||
lookup base (https://github.com/ansible-collections/kubernetes.core/pull/1242).
|
||||
release_summary: This minor release deprecates Ansible Turbo mode (``ENABLE_TURBO_MODE``),
|
||||
the ``status.values`` return value of the ``helm`` and ``helm_info`` modules,
|
||||
the ``wait_timeout`` parameter of the ``helm`` module, the ``return_code``
|
||||
return value of the ``k8s_exec`` module, and the ``merge_type=json`` option
|
||||
of the ``k8s_service`` module. It also includes bugfixes for ``helm_repository``
|
||||
URL comparison and for empty template output handling in ``k8s_info``.
|
||||
fragments:
|
||||
- 1253-k8s-lookup-turbo-version-check.yml
|
||||
- 20250108-fix-empty-template-output.yaml
|
||||
- 20260723-remove-module-utils-six.yaml
|
||||
- 20260908-helm-repository-trailing-slash.yaml
|
||||
- 20260911-deprecate-status-values.yaml
|
||||
- 20260911-update-deprecation-notices.yaml
|
||||
- 5.5.0.yml
|
||||
- deprecate-enable-turbo-mode.yml
|
||||
- fix-ansible-lint-warnings.yaml
|
||||
release_date: '2026-09-15'
|
||||
6.0.0:
|
||||
changes:
|
||||
breaking_changes:
|
||||
@@ -1251,3 +1377,112 @@ releases:
|
||||
name: kubeconfig
|
||||
namespace: ''
|
||||
release_date: '2026-07-08'
|
||||
6.6.0:
|
||||
changes:
|
||||
bugfixes:
|
||||
- Ansible Turbo mode - ignore ``ENABLE_TURBO_MODE`` on ansible-core 2.19.0 and
|
||||
later, where the ``cloud.common`` collection is not supported, and fall back
|
||||
to the standard ``AnsibleModule`` instead of failing with ``byte indices must
|
||||
be integers or slices, not str`` (https://github.com/ansible-collections/kubernetes.core/pull/1242).
|
||||
- helm - do not pass the upgrade-only ``--reuse-values`` and ``--reset-then-reuse-values``
|
||||
flags to ``helm install``, which rejected them with ``unknown flag`` whenever
|
||||
``reuse_values`` or ``reset_then_reuse_values`` was combined with ``replace``
|
||||
(https://github.com/ansible-collections/kubernetes.core/pull/1230).
|
||||
- helm - fix the ``reuse_values`` example, which set only ``reuse_values=true``.
|
||||
``reset_values`` defaults to ``true`` and helm ignores ``--reuse-values``
|
||||
whenever ``--reset-values`` is passed, so following the example reset the
|
||||
release values instead of reusing them (https://github.com/ansible-collections/kubernetes.core/pull/1230).
|
||||
- helm - skip Helm's OCI registry progress messages when parsing the output
|
||||
of ``helm show chart``. As of Helm 4.2.1 these are printed to stdout instead
|
||||
of stderr (https://github.com/helm/helm/pull/32056), which made installing
|
||||
a chart from an OCI registry fail with a YAML scanner error when the chart
|
||||
version contained a ``+`` (https://github.com/ansible-collections/kubernetes.core/pull/1223).
|
||||
- helm_repository - normalize both sides of the repository URL comparison, so
|
||||
that a repository already registered with a trailing slash is recognized as
|
||||
matching instead of failing with ``Repository already have a repository named
|
||||
<name>`` (https://github.com/ansible-collections/kubernetes.core/pull/1236).
|
||||
- helm_template - strip Helm's OCI registry progress messages from the returned
|
||||
``stdout``, which is documented to contain only the rendered templates (https://github.com/ansible-collections/kubernetes.core/pull/1223).
|
||||
- k8s lookup - ignore ``ENABLE_TURBO_MODE`` on ansible-core 2.19.0 and later,
|
||||
where the ``cloud.common`` collection is not supported. Fall back to the standard
|
||||
``LookupBase`` instead of failing with a traceback (https://github.com/ansible-collections/kubernetes.core/pull/1253).
|
||||
- k8s_cp - Fix silent truncation when copying to a pod. The module closed the
|
||||
exec connection immediately after writing the last chunk of the tar archive,
|
||||
which killed the remote ``tar`` before it had finished extracting, and never
|
||||
checked the process exit status, so a partial copy was reported as a success.
|
||||
The archive is now bounded with ``head -c`` so ``tar`` gets a clean EOF and
|
||||
exits on its own, and the module waits for that exit and fails on a non-zero
|
||||
status (https://github.com/ansible-collections/kubernetes.core/pull/1217).
|
||||
- k8s_info - Handle empty template output gracefully by returning ``changed=false``
|
||||
instead of failing when Jinja2 template renders to an empty string (https://github.com/ansible-collections/kubernetes.core/issues/1042).
|
||||
deprecated_features:
|
||||
- Ansible Turbo mode (``ENABLE_TURBO_MODE``) has been deprecated and will be
|
||||
removed in release 8.0.0, as it depends on the ``cloud.common`` collection,
|
||||
which is being retired (https://github.com/ansible-collections/kubernetes.core/pull/1242).
|
||||
- helm - the ``status.values`` return value has been deprecated and will be
|
||||
removed in version 8.0.0. Use ``status.release_values`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- helm - the ``wait_timeout`` parameter has been deprecated and will be removed
|
||||
in version 7.0.0. Use ``timeout`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- helm_info - the ``status.values`` return value has been deprecated and will
|
||||
be removed in version 8.0.0. Use ``status.release_values`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- k8s_exec - the ``return_code`` return value has been deprecated and will be
|
||||
removed in version 7.0.0. Use ``rc`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
- k8s_service - the ``merge_type=json`` option has been deprecated and will
|
||||
be removed in version 7.0.0. Use ``kubernetes.core.k8s_json_patch`` module
|
||||
instead (https://github.com/ansible-collections/kubernetes.core/issues/1239).
|
||||
minor_changes:
|
||||
- Remove the remaining ``ansible.module_utils.six`` import to avoid deprecation
|
||||
warnings, replacing it with the Python standard library equivalent (https://github.com/ansible-collections/kubernetes.core/pull/1197).
|
||||
- helm - Add ``wait_for_jobs`` option to wait for all Jobs to complete before
|
||||
marking a Helm release as successful. Requires Helm >= 3.5.0 (https://github.com/ansible-collections/kubernetes.core/pull/1140).
|
||||
- helm - add the ``cleanup_on_fail`` option, mapping to the ``--cleanup-on-fail``
|
||||
flag, to allow deletion of new resources created during a failed upgrade.
|
||||
It complements ``atomic`` and can be combined with it, but cannot be used
|
||||
with ``replace``, since that deploys through ``helm install`` which does not
|
||||
accept the flag (https://github.com/ansible-collections/kubernetes.core/pull/1206).
|
||||
- helm - warn when ``reuse_values`` or ``reset_then_reuse_values`` is requested
|
||||
in a combination helm ignores, which happens by default because ``reset_values``
|
||||
defaults to ``true``, and whenever either is combined with ``replace``. The
|
||||
option descriptions and the examples now state that ``reset_values`` has to
|
||||
be set to ``false`` for either option to take effect (https://github.com/ansible-collections/kubernetes.core/pull/1230).
|
||||
- k8s lookup - warn when ``ENABLE_TURBO_MODE`` is set but the ``cloud.common``
|
||||
collection is not installed, instead of silently falling back to the standard
|
||||
lookup base (https://github.com/ansible-collections/kubernetes.core/pull/1242).
|
||||
- k8s_cp - Add the ``copy_timeout`` option (default 300 seconds) bounding how
|
||||
long the module will spend streaming an archive to a pod and waiting for the
|
||||
remote ``tar`` to finish, so that a stalled copy fails instead of hanging
|
||||
indefinitely (https://github.com/ansible-collections/kubernetes.core/pull/1217).
|
||||
- k8s_cp - Stream the tar archive to the pod chunk by chunk instead of building
|
||||
the whole archive in memory first, which cuts peak memory use when copying
|
||||
large files (https://github.com/ansible-collections/kubernetes.core/pull/1217).
|
||||
- k8s_cp - When copying to a pod, the module now also uses ``/bin/sh`` and ``head``
|
||||
in the container, when present, to confirm the copy completed. Containers
|
||||
without them keep the previous behaviour and get a warning that completion
|
||||
could not be verified (https://github.com/ansible-collections/kubernetes.core/pull/1217).
|
||||
- k8s_info - Support for metadata-only fetches in k8s_info module (https://github.com/ansible-collections/kubernetes.core/pull/1030)
|
||||
- meta - Add ``helm_plugin`` and ``helm_plugin_info`` to the ``helm`` action
|
||||
group, and ``k8s_taint`` to the ``k8s`` action group, so that ``module_defaults``
|
||||
set on those groups applies to them (https://github.com/ansible-collections/kubernetes.core/pull/1216).
|
||||
- use `collections.abc` instead of deprecated `ansible.module_utils.common._collections_compat`
|
||||
(https://github.com/ansible-collections/kubernetes.core/pull/1057).
|
||||
- waiter - Add ``job_complete`` predicate to support waiting for Job resources
|
||||
to reach ``Complete`` or ``Failed`` condition (https://github.com/ansible-collections/kubernetes.core/issues/1201).
|
||||
fragments:
|
||||
- 1253-k8s-lookup-turbo-version-check.yml
|
||||
- 20250108-fix-empty-template-output.yaml
|
||||
- 20251027-metadata-only-fetches.yaml
|
||||
- 20260109-fix-deprecated-calls.yaml
|
||||
- 20260723-remove-module-utils-six.yaml
|
||||
- 20260805-add-job-wait-condition.yaml
|
||||
- 20260807-helm-cleanup-on-fail.yaml
|
||||
- 20260807-helm-wait-for-jobs.yaml
|
||||
- 20260812-action-groups.yaml
|
||||
- 20260813-k8s-cp-truncation.yaml
|
||||
- 20260817-helm-oci-registry-progress-on-stdout.yml
|
||||
- 20260826-helm-value-reuse-options.yaml
|
||||
- 20260908-helm-repository-trailing-slash.yaml
|
||||
- 20260911-deprecate-status-values.yaml
|
||||
- 20260911-update-deprecation-notices.yaml
|
||||
- deprecate-enable-turbo-mode.yml
|
||||
- fix-ansible-lint-warnings.yaml
|
||||
release_date: '2026-09-16'
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
bugfixes:
|
||||
- helm - Remove `--plain-http` option from `helm diff upgrade`, as it is not supported by the helm-diff plugin (https://github.com/ansible-collections/kubernetes.core/pull/1232).
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
bugfixes:
|
||||
- k8s, k8s_service - emit warnings through ``AnsibleModule.warn`` instead of putting them in the result dict that is unpacked into ``exit_json``/``fail_json``. Passing ``warnings`` that way is deprecated since ansible-core 2.19 and will be removed in 2.23, so every run that produced a warning (for example the "No meaningful diff was generated" hint, warnings returned by the Kubernetes API, or ``validate`` findings) also emitted a deprecation warning (https://github.com/ansible-collections/kubernetes.core/pull/1267).
|
||||
- k8s - warnings raised while processing a multi-document manifest are now shown to the user. They were previously nested under ``result.results[*].warnings``, where ansible-core never picked them up, so they were silently dropped whenever more than one resource was processed (https://github.com/ansible-collections/kubernetes.core/pull/1267).
|
||||
@@ -12,12 +12,19 @@ Following document provides overview of Ansible Turbo mode in ``kubernetes.core`
|
||||
:depth: 1
|
||||
|
||||
|
||||
.. warning::
|
||||
Ansible Turbo mode is **deprecated** and will be removed in a future major release
|
||||
(planned for 8.0.0), as it depends on the ``cloud.common`` collection, which is being
|
||||
retired. Setting ``ENABLE_TURBO_MODE`` now emits a deprecation warning; once support is
|
||||
removed, the variable will have no effect. Start planning your migration away from
|
||||
Turbo mode.
|
||||
|
||||
.. warning::
|
||||
Ansible Turbo mode is supported only with ``ansible-core`` versions **lower than 2.19**.
|
||||
Starting from ``ansible-core`` 2.19, the ``cloud.common`` collection is no longer supported,
|
||||
and therefore Ansible Turbo mode is also not supported in ``kubernetes.core``.
|
||||
If ``ENABLE_TURBO_MODE`` is set to ``1`` (or any truthy value) with ``ansible-core >= 2.19.0``,
|
||||
it may lead to failures.
|
||||
Turbo mode is ignored and a warning is emitted; modules run without it.
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
|
||||
@@ -42,6 +42,92 @@ Basic authentication is also supported using the ``username`` and ``password`` o
|
||||
|
||||
To disable SSL certificate verification, set ``verify_ssl`` to false.
|
||||
|
||||
Sharing options across tasks with action groups
|
||||
===============================================
|
||||
|
||||
Repeating the same authentication options on every task gets verbose quickly. The collection
|
||||
defines two `action groups <https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_module_defaults.html#module-defaults-groups>`_
|
||||
so you can set them once with ``module_defaults``:
|
||||
|
||||
``kubernetes.core.k8s``
|
||||
Modules that talk to the Kubernetes API and accept the standard authentication options
|
||||
(``kubeconfig``, ``context``, ``host``, ``api_key``, ``validate_certs``, and so on):
|
||||
``k8s``, ``k8s_cluster_info``, ``k8s_cp``, ``k8s_drain``, ``k8s_exec``, ``k8s_info``,
|
||||
``k8s_json_patch``, ``k8s_log``, ``k8s_rollback``, ``k8s_scale``, ``k8s_service``, and
|
||||
``k8s_taint``.
|
||||
|
||||
``kubernetes.core.helm``
|
||||
Modules that shell out to the ``helm`` binary and accept its shared authentication
|
||||
options (``binary_path``, ``kubeconfig``, ``context``, ``host``, ``api_key``,
|
||||
``ca_cert``, ``validate_certs``): ``helm``, ``helm_info``, ``helm_plugin``,
|
||||
``helm_plugin_info``, and ``helm_repository``.
|
||||
|
||||
Prefix the group name with ``group/`` to use it:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
- hosts: localhost
|
||||
module_defaults:
|
||||
group/kubernetes.core.k8s:
|
||||
kubeconfig: /path/to/kubeconfig
|
||||
context: staging
|
||||
group/kubernetes.core.helm:
|
||||
binary_path: /path/to/helm
|
||||
kubeconfig: /path/to/kubeconfig
|
||||
context: staging
|
||||
tasks:
|
||||
- name: Create a namespace
|
||||
kubernetes.core.k8s:
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: monitoring
|
||||
|
||||
- name: Read it back
|
||||
kubernetes.core.k8s_info:
|
||||
kind: Namespace
|
||||
name: monitoring
|
||||
|
||||
- name: Add the prometheus chart repository
|
||||
kubernetes.core.helm_repository:
|
||||
name: prometheus-community
|
||||
repo_url: https://prometheus-community.github.io/helm-charts
|
||||
|
||||
- name: Deploy the kube-prometheus-stack chart
|
||||
kubernetes.core.helm:
|
||||
name: kube-prometheus-stack
|
||||
chart_ref: prometheus-community/kube-prometheus-stack
|
||||
release_namespace: monitoring
|
||||
|
||||
- name: Collect the releases in that namespace
|
||||
kubernetes.core.helm_info:
|
||||
name: kube-prometheus-stack
|
||||
release_namespace: monitoring
|
||||
|
||||
Every task picks up ``kubeconfig`` and ``context`` from its group without repeating them, the
|
||||
``helm`` modules additionally pick up ``binary_path``, and an option set on an individual task
|
||||
still wins over the group default.
|
||||
|
||||
.. note::
|
||||
|
||||
Always write the group name fully qualified as ``group/kubernetes.core.k8s``. A bare
|
||||
``group/k8s`` refers to the legacy ``k8s`` group that ansible-core defined back when the
|
||||
Kubernetes modules shipped in core itself. The two are not the same group, and the legacy
|
||||
one does not cover the modules in this collection.
|
||||
|
||||
Some modules are deliberately **not** in these groups because they do not accept the shared
|
||||
authentication options, and including them would make ``module_defaults`` fail for everyone
|
||||
using the group:
|
||||
|
||||
- ``helm_pull`` and ``helm_template`` accept only ``binary_path``.
|
||||
- ``helm_registry_auth`` accepts ``binary_path`` and its own ``host``, which is an OCI
|
||||
registry URL rather than a Kubernetes API server.
|
||||
- ``kubeconfig`` writes a kubeconfig file locally and takes no cluster connection options.
|
||||
|
||||
Pass options to those modules directly, or give them their own per-module ``module_defaults``
|
||||
entry.
|
||||
|
||||
Reporting an issue
|
||||
==================
|
||||
|
||||
|
||||
@@ -427,6 +427,23 @@ Common return values are documented `here <https://docs.ansible.com/projects/ans
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>release_values</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></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 6.3.0</div>
|
||||
</td>
|
||||
<td>always</td>
|
||||
<td>
|
||||
<div>Dict of Values used to deploy.</div>
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="1">
|
||||
@@ -488,7 +505,7 @@ Common return values are documented `here <https://docs.ansible.com/projects/ans
|
||||
<td>always</td>
|
||||
<td>
|
||||
<div>Dict of Values used to deploy</div>
|
||||
<div>This return value has been deprecated and will be removed in a release after 2027-01-08. Use RV(status.release_values) instead.</div>
|
||||
<div>This return value has been deprecated and will be removed in version 8.0.0. Use RV(status.release_values) instead.</div>
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -157,6 +157,29 @@ Parameters
|
||||
<div>Chart version to install. If this is not specified, the latest version is installed.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>cleanup_on_fail</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 6.6.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>Allow deletion of new resources created during a failed upgrade.</div>
|
||||
<div>Maps to the <code>--cleanup-on-fail</code> flag, which is available since helm 3.0.0 and was not renamed in Helm v4.</div>
|
||||
<div>Complements O(atomic) rather than replacing it, and the two can be combined so that a rollback also drops resources orphaned by the failed upgrade.</div>
|
||||
<div>Helm only accepts this flag on <code>helm upgrade</code>, so it cannot be used together with O(replace), which deploys through <code>helm install</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
@@ -522,7 +545,9 @@ Parameters
|
||||
</td>
|
||||
<td>
|
||||
<div>When upgrading package, reset the values to the ones built into the chart, apply the last release's values and merge in any overrides from parameters O(release_values), O(values_files) or O(set_values).</div>
|
||||
<div>If O(reset_values) or O(reuse_values) is set to V(True), this is ignored.</div>
|
||||
<div>Helm ignores this when <code>--reset-values</code> or <code>--reuse-values</code> is passed. Since O(reset_values) defaults to V(true), it has to be set to V(false), and O(reuse_values) left unset or V(false), for this option to take any effect.</div>
|
||||
<div><code>helm install</code> does not accept <code>--reset-then-reuse-values</code>, so this option is ignored when O(replace) is set.</div>
|
||||
<div>The module warns whenever one of those combinations makes this option a no-op.</div>
|
||||
<div>This feature requires helm diff >= 3.9.12.</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -544,6 +569,7 @@ Parameters
|
||||
</td>
|
||||
<td>
|
||||
<div>When upgrading package, reset the values to the ones built into the chart.</div>
|
||||
<div>Defaults to V(true), which makes helm ignore O(reuse_values) and O(reset_then_reuse_values). Set it to V(false) to use either of them.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -563,8 +589,10 @@ Parameters
|
||||
</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>
|
||||
<div>When upgrading package, specifies whether to reuse the last release's values and merge in any overrides from parameters O(release_values), O(values_files) or O(set_values).</div>
|
||||
<div>Helm ignores this when <code>--reset-values</code> is passed. Since O(reset_values) defaults to V(true), it has to be set to V(false) for this option to take any effect.</div>
|
||||
<div><code>helm install</code> does not accept <code>--reuse-values</code>, so this option is ignored when O(replace) is set.</div>
|
||||
<div>The module warns whenever one of those combinations makes this option a no-op.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -811,6 +839,28 @@ Parameters
|
||||
<div>When <em>release_state</em> is set to <code>absent</code>, will wait until all the resources are deleted before returning. It will wait for as long as <em>wait_timeout</em>. This feature requires helm>=3.7.0. Added in version 2.3.0.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>wait_for_jobs</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 6.6.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 <em>release_state</em> is set to <code>present</code>, and <em>wait</em> is set to <code>True</code>, wait until all jobs are in a completed state before marking the release as successful.</div>
|
||||
<div>Ignored when used without O(wait).</div>
|
||||
<div>Requires Helm >= 3.5.0</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
@@ -824,7 +874,7 @@ Parameters
|
||||
</td>
|
||||
<td>
|
||||
<div>Timeout when wait option is enabled (helm2 is a number of seconds, helm3 is a duration).</div>
|
||||
<div>The use of <em>wait_timeout</em> to wait for kubernetes commands to complete has been deprecated and will be removed after 2022-12-01.</div>
|
||||
<div>The use of <em>wait_timeout</em> to wait for kubernetes commands to complete has been deprecated and will be removed in version 7.0.0. Use O(timeout) instead.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -935,6 +985,7 @@ Examples
|
||||
release_namespace: default
|
||||
force: True
|
||||
wait: True
|
||||
wait_for_jobs: True
|
||||
replace: True
|
||||
update_repo_cache: True
|
||||
disable_hook: True
|
||||
@@ -954,21 +1005,37 @@ Examples
|
||||
enabled: True
|
||||
|
||||
# Deploy latest version
|
||||
# 'reset_values' defaults to true and helm ignores '--reuse-values' when it is set,
|
||||
# so it has to be turned off explicitly.
|
||||
- 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
|
||||
reset_values: false
|
||||
values:
|
||||
replicas: 2
|
||||
version: 3e8ec0b2dffa40fb97d5342e4af887de95faa8c61a62480dd7f8aa03dffcf533
|
||||
|
||||
# Same for 'reset_then_reuse_values', which helm ignores when either
|
||||
# '--reset-values' or '--reuse-values' is set.
|
||||
- name: Deploy latest version of Grafana chart using reset_then_reuse_values
|
||||
kubernetes.core.helm:
|
||||
name: test
|
||||
chart_ref: stable/grafana
|
||||
release_namespace: monitoring
|
||||
reset_then_reuse_values: true
|
||||
reset_values: false
|
||||
values:
|
||||
replicas: 2
|
||||
|
||||
|
||||
|
||||
Return Values
|
||||
-------------
|
||||
Common return values are documented `here <https://docs.ansible.com/projects/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
|
||||
Common return values are documented `here <https://docs.ansible.com/projects/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
|
||||
|
||||
.. raw:: html
|
||||
|
||||
@@ -1152,7 +1219,7 @@ Common return values are documented `here <https://docs.ansible.com/projects/ans
|
||||
<td>always</td>
|
||||
<td>
|
||||
<div>Dict of Values used to deploy.</div>
|
||||
<div>This return value has been deprecated and will be removed in a release after 2027-01-08. Use RV(status.release_values) instead.</div>
|
||||
<div>This return value has been deprecated and will be removed in version 8.0.0. Use RV(status.release_values) instead.</div>
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -152,6 +152,25 @@ Parameters
|
||||
<div>The name of a context found in the config file. Can also be specified via K8S_AUTH_CONTEXT environment variable.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>copy_timeout</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 6.6.0</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">300</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>Maximum time in seconds to spend streaming the archive to the pod and waiting for the remote <code>tar</code> process to finish extracting it.</div>
|
||||
<div>Raise this when copying large files over a slow connection.</div>
|
||||
<div>This option is ignored when <em>state</em> is set to <code>from_pod</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
@@ -512,6 +531,7 @@ Notes
|
||||
|
||||
.. note::
|
||||
- the tar binary is required on the container when copying from local filesystem to pod.
|
||||
- a POSIX shell at ``/bin/sh`` and ``head`` are also used, when present, to bound the archive sent to the container so that the module can confirm the copy finished. Without them the copy still runs but completion cannot be verified, and a warning is emitted.
|
||||
- the (init) container has to be started before you copy files or directories to it.
|
||||
- To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file.
|
||||
|
||||
|
||||
@@ -535,7 +535,7 @@ Common return values are documented `here <https://docs.ansible.com/projects/ans
|
||||
</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<div>The command status code. This attribute is deprecated and will be removed in a future release. Please use rc instead.</div>
|
||||
<div>The command status code. This attribute is deprecated and will be removed in version 7.0.0. Use RV(result.rc) instead.</div>
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -280,6 +280,29 @@ Parameters
|
||||
<div>List of label selectors to use to filter results</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>metadata_only</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 6.6.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>Request metadata only response from the Kubernetes API server.</div>
|
||||
<div>This feature is useful for clients that only need to check for the existence of an object,</div>
|
||||
<div>or that only need to read its metadata.</div>
|
||||
<div>It can significantly reduce the size of the response from the API server.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
@@ -716,6 +739,12 @@ Examples
|
||||
retries: 60
|
||||
delay: 15
|
||||
|
||||
- name: Get a list of all pods metadata only
|
||||
kubernetes.core.k8s_info:
|
||||
kind: Pod
|
||||
metadata_only: true
|
||||
register: pod_metadata_list
|
||||
|
||||
|
||||
|
||||
Return Values
|
||||
|
||||
@@ -813,7 +813,7 @@ Parameters
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Determines if an object should be created, patched, or deleted. When set to <code>present</code>, an object will be created, if it does not already exist. If set to <code>absent</code>, an existing object will be deleted. If set to <code>present</code>, an existing object will be patched, if its attributes differ from those specified using <em>resource_definition</em> or <em>src</em>.</div>
|
||||
<div>Determines if an object should be created, patched, or deleted. When set to <code>present</code>, an object will be created if it does not already exist, and an existing object will be patched if its attributes differ from those specified using <em>resource_definition</em> or <em>src</em>. If set to <code>absent</code>, an existing object will be deleted.</div>
|
||||
<div><code>patched</code> state is an existing resource that has a given patch applied. If the resource doesn't exist, silently skip it (do not raise an error).</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -247,6 +247,7 @@ Parameters
|
||||
<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</div>
|
||||
<div>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><em>merge_type=json</em> has been deprecated and will be removed in version 7.0.0. Use <span class='module'>kubernetes.core.k8s_json_patch</span> instead.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -508,7 +509,7 @@ Parameters
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Determines if an object should be created, patched, or deleted. When set to <code>present</code>, an object will be created, if it does not already exist. If set to <code>absent</code>, an existing object will be deleted. If set to <code>present</code>, an existing object will be patched, if its attributes differ from those specified using <em>resource_definition</em> or <em>src</em>.</div>
|
||||
<div>Determines if an object should be created, patched, or deleted. When set to <code>present</code>, an object will be created if it does not already exist, and an existing object will be patched if its attributes differ from those specified using <em>resource_definition</em> or <em>src</em>. If set to <code>absent</code>, an existing object will be deleted.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -383,6 +383,7 @@ Examples
|
||||
# and requires python to be installed in the image
|
||||
- name: Run a command in a pod
|
||||
ansible.builtin.command: echo "Hello, World!"
|
||||
changed_when: false
|
||||
|
||||
- name: Run a command in a pod using local kubectl with inventory variables
|
||||
# Example inventory:
|
||||
@@ -407,6 +408,7 @@ Examples
|
||||
# and requires python to be installed in the image
|
||||
- name: Run a command in a pod
|
||||
ansible.builtin.command: echo "Hello, World!"
|
||||
changed_when: false
|
||||
|
||||
- name: Run a command in a pod using dynamic inventory
|
||||
hosts: localhost
|
||||
@@ -440,6 +442,7 @@ Examples
|
||||
# be aware that the command is executed as the user that started the container
|
||||
# and requires python to be installed in the image
|
||||
ansible.builtin.command: echo "Hello, World!"
|
||||
changed_when: false
|
||||
delegate_to: "{{ my_app_pod_name }}"
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ tags:
|
||||
- openshift
|
||||
- okd
|
||||
- cluster
|
||||
version: 6.5.0
|
||||
version: 7.0.0-dev0
|
||||
build_ignore:
|
||||
- .DS_Store
|
||||
- "*.tar.gz"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
version: 3
|
||||
dependencies:
|
||||
python: requirements.txt
|
||||
system: meta/ee-bindep.txt
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
---
|
||||
requires_ansible: '>=2.16.0'
|
||||
|
||||
# Only modules that accept the shared authentication options belong in these
|
||||
# groups: HELM_AUTH_ARG_SPEC for helm, AUTH_ARG_SPEC for k8s. Adding a module
|
||||
# that does not accept them makes module_defaults fail for every user of the
|
||||
# group. This excludes helm_pull, helm_registry_auth, helm_template and
|
||||
# kubeconfig, which only take a subset (or none) of those options.
|
||||
action_groups:
|
||||
helm:
|
||||
- helm
|
||||
- helm_info
|
||||
- helm_plugin
|
||||
- helm_plugin_info
|
||||
- helm_repository
|
||||
k8s:
|
||||
- k8s
|
||||
@@ -18,6 +25,7 @@ action_groups:
|
||||
- k8s_rollback
|
||||
- k8s_scale
|
||||
- k8s_service
|
||||
- k8s_taint
|
||||
|
||||
plugin_routing:
|
||||
inventory:
|
||||
|
||||
@@ -35,7 +35,11 @@ def _from_yaml_to_definition(buffer):
|
||||
import yaml
|
||||
except ImportError:
|
||||
raise AnsibleError("Failed to import the required Python library (PyYAML).")
|
||||
return list(yaml.safe_load_all(buffer))
|
||||
|
||||
# Handle empty template output
|
||||
if buffer is None:
|
||||
return []
|
||||
return [doc for doc in yaml.safe_load_all(buffer) if doc is not None]
|
||||
|
||||
|
||||
ENV_KUBECONFIG_PATH_SEPARATOR = ";" if platform.system() == "Windows" else ":"
|
||||
@@ -380,10 +384,15 @@ class ActionModule(ActionBase):
|
||||
template = self._task.args.get("template", None)
|
||||
if template:
|
||||
self.load_template(template, new_module_args, task_vars)
|
||||
# If template rendered to empty definition, return early with no changes
|
||||
if not new_module_args.get("definition"):
|
||||
result["changed"] = False
|
||||
return self._ensure_invocation(result)
|
||||
|
||||
local_path = self._task.args.get("local_path")
|
||||
state = self._task.args.get("state", None)
|
||||
if local_path and state == "to_pod" and not remote_transport:
|
||||
is_local_pod_upload = local_path and state == "to_pod" and not remote_transport
|
||||
if is_local_pod_upload:
|
||||
new_module_args["local_path"] = self.get_file_realpath(local_path)
|
||||
|
||||
# Execute the k8s_* module.
|
||||
|
||||
@@ -196,6 +196,7 @@ EXAMPLES = r"""
|
||||
# and requires python to be installed in the image
|
||||
- name: Run a command in a pod
|
||||
ansible.builtin.command: echo "Hello, World!"
|
||||
changed_when: false
|
||||
|
||||
- name: Run a command in a pod using local kubectl with inventory variables
|
||||
# Example inventory:
|
||||
@@ -220,19 +221,20 @@ EXAMPLES = r"""
|
||||
# and requires python to be installed in the image
|
||||
- name: Run a command in a pod
|
||||
ansible.builtin.command: echo "Hello, World!"
|
||||
changed_when: false
|
||||
|
||||
- name: Run a command in a pod using dynamic inventory
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
vars:
|
||||
kubeconfig: /root/.kube/config
|
||||
namespace: my-namespace
|
||||
k8s_namespace: my-namespace
|
||||
my_app: my-app
|
||||
tasks:
|
||||
- name: Get My App pod info based on label
|
||||
kubernetes.core.k8s_info:
|
||||
kubeconfig: "{{ kubeconfig }}"
|
||||
namespace: "{{ namespace }}"
|
||||
namespace: "{{ k8s_namespace }}"
|
||||
kind: Pod
|
||||
label_selectors: app.kubernetes.io/name = "{{ my_app }}"
|
||||
register: my_app_pod
|
||||
@@ -247,12 +249,13 @@ EXAMPLES = r"""
|
||||
ansible_connection: kubernetes.core.kubectl
|
||||
ansible_kubectl_kubeconfig: "{{ kubeconfig }}"
|
||||
ansible_kubectl_pod: "{{ my_app_pod_name }}"
|
||||
ansible_kubectl_namespace: "{{ namespace }}"
|
||||
ansible_kubectl_namespace: "{{ k8s_namespace }}"
|
||||
|
||||
- name: Run a command in My App pod
|
||||
# be aware that the command is executed as the user that started the container
|
||||
# and requires python to be installed in the image
|
||||
ansible.builtin.command: echo "Hello, World!"
|
||||
changed_when: false
|
||||
delegate_to: "{{ my_app_pod_name }}"
|
||||
"""
|
||||
|
||||
@@ -262,11 +265,11 @@ import os.path
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
from shlex import quote as shlex_quote
|
||||
|
||||
from ansible.errors import AnsibleError, AnsibleFileNotFound
|
||||
from ansible.module_utils.common.text.converters import to_bytes
|
||||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
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
|
||||
|
||||
@@ -16,9 +16,8 @@ options:
|
||||
state:
|
||||
description:
|
||||
- Determines if an object should be created, patched, or deleted. When set to C(present), an object will be
|
||||
created, if it does not already exist. If set to C(absent), an existing object will be deleted. If set to
|
||||
C(present), an existing object will be patched, if its attributes differ from those specified using
|
||||
I(resource_definition) or I(src).
|
||||
created if it does not already exist, and an existing object will be patched if its attributes differ from
|
||||
those specified using I(resource_definition) or I(src). If set to C(absent), an existing object will be deleted.
|
||||
type: str
|
||||
default: present
|
||||
choices: [ absent, present ]
|
||||
|
||||
+33
-1
@@ -209,28 +209,60 @@ RETURN = """
|
||||
"""
|
||||
|
||||
import os
|
||||
from collections.abc import KeysView
|
||||
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.module_utils.common._collections_compat import KeysView
|
||||
from ansible.module_utils.ansible_release import __version__ as ansible_version
|
||||
from ansible.module_utils.common.validation import check_type_bool
|
||||
from ansible.utils.display import Display
|
||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
||||
get_api_client,
|
||||
)
|
||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.resource import (
|
||||
create_definitions,
|
||||
)
|
||||
from ansible_collections.kubernetes.core.plugins.module_utils.version import (
|
||||
LooseVersion,
|
||||
)
|
||||
|
||||
display = Display()
|
||||
|
||||
# cloud.common declares requires_ansible '>=2.15.0,<2.19'. On newer ansible-core the
|
||||
# import still succeeds, so the version has to be checked explicitly: relying on
|
||||
# ImportError alone lets turbo mode fail later with an unrelated traceback.
|
||||
TURBO_UNSUPPORTED_CORE = "2.19.0"
|
||||
|
||||
try:
|
||||
enable_turbo_mode = check_type_bool(os.environ.get("ENABLE_TURBO_MODE"))
|
||||
except TypeError:
|
||||
enable_turbo_mode = False
|
||||
|
||||
if enable_turbo_mode:
|
||||
display.deprecated(
|
||||
"ENABLE_TURBO_MODE is deprecated, as it relies on the cloud.common "
|
||||
"collection which is being retired. Setting this environment "
|
||||
"variable will have no effect once support is removed.",
|
||||
version="8.0.0",
|
||||
collection_name="kubernetes.core",
|
||||
)
|
||||
if LooseVersion(ansible_version) >= LooseVersion(TURBO_UNSUPPORTED_CORE):
|
||||
display.warning(
|
||||
"ENABLE_TURBO_MODE is ignored on ansible-core %s: Ansible Turbo mode requires "
|
||||
"the cloud.common collection, which supports ansible-core < %s only. "
|
||||
"Continuing without Turbo mode." % (ansible_version, TURBO_UNSUPPORTED_CORE)
|
||||
)
|
||||
enable_turbo_mode = False
|
||||
|
||||
if enable_turbo_mode:
|
||||
try:
|
||||
from ansible_collections.cloud.common.plugins.plugin_utils.turbo.lookup import (
|
||||
TurboLookupBase as LookupBase,
|
||||
)
|
||||
except ImportError:
|
||||
display.warning(
|
||||
"ENABLE_TURBO_MODE is set but the cloud.common collection is not installed. "
|
||||
"Continuing without Turbo mode."
|
||||
)
|
||||
from ansible.plugins.lookup import LookupBase # noqa: F401
|
||||
else:
|
||||
from ansible.plugins.lookup import LookupBase # noqa: F401
|
||||
|
||||
@@ -5,13 +5,39 @@ __metaclass__ = type
|
||||
|
||||
import os
|
||||
|
||||
from ansible.module_utils.ansible_release import __version__ as ansible_version
|
||||
from ansible.module_utils.common.validation import check_type_bool
|
||||
from ansible.module_utils.common.warnings import deprecate, warn
|
||||
from ansible_collections.kubernetes.core.plugins.module_utils.version import (
|
||||
LooseVersion,
|
||||
)
|
||||
|
||||
# cloud.common declares requires_ansible '>=2.15.0,<2.19'. On newer ansible-core the
|
||||
# import still succeeds, so the version has to be checked explicitly: relying on
|
||||
# ImportError alone lets turbo mode fail later with an unrelated traceback.
|
||||
TURBO_UNSUPPORTED_CORE = "2.19.0"
|
||||
|
||||
try:
|
||||
enable_turbo_mode = check_type_bool(os.environ.get("ENABLE_TURBO_MODE"))
|
||||
except TypeError:
|
||||
enable_turbo_mode = False
|
||||
|
||||
if enable_turbo_mode:
|
||||
deprecate(
|
||||
"ENABLE_TURBO_MODE is deprecated, as it relies on the cloud.common collection "
|
||||
"which is being retired. Setting this environment variable will have no effect "
|
||||
"once support is removed.",
|
||||
version="8.0.0",
|
||||
collection_name="kubernetes.core",
|
||||
)
|
||||
if LooseVersion(ansible_version) >= LooseVersion(TURBO_UNSUPPORTED_CORE):
|
||||
warn(
|
||||
"ENABLE_TURBO_MODE is ignored on ansible-core %s: Ansible Turbo mode requires "
|
||||
"the cloud.common collection, which supports ansible-core < %s only. "
|
||||
"Continuing without Turbo mode." % (ansible_version, TURBO_UNSUPPORTED_CORE)
|
||||
)
|
||||
enable_turbo_mode = False
|
||||
|
||||
if enable_turbo_mode:
|
||||
try:
|
||||
from ansible_collections.cloud.common.plugins.module_utils.turbo.module import ( # noqa: F401
|
||||
@@ -20,6 +46,10 @@ if enable_turbo_mode:
|
||||
|
||||
AnsibleModule.collection_name = "kubernetes.core"
|
||||
except ImportError:
|
||||
warn(
|
||||
"ENABLE_TURBO_MODE is set but the cloud.common collection is not installed. "
|
||||
"Continuing without Turbo mode."
|
||||
)
|
||||
from ansible.module_utils.basic import AnsibleModule # noqa: F401
|
||||
else:
|
||||
from ansible.module_utils.basic import AnsibleModule # noqa: F401
|
||||
|
||||
@@ -144,3 +144,18 @@ DELETE_OPTS_ARG_SPEC = {
|
||||
"options": {"resourceVersion": {"type": "str"}, "uid": {"type": "str"}},
|
||||
},
|
||||
}
|
||||
|
||||
METADATA_ONLY_HEADERS_SPEC = {
|
||||
"accept": {"type": "str"},
|
||||
}
|
||||
|
||||
METADATA_ONLY_HEADER_VALUES = {
|
||||
"partial_object": (
|
||||
"application/json;as=PartialObjectMetadata;g=meta.k8s.io;v=v1,"
|
||||
"application/json;q=0.9"
|
||||
),
|
||||
"partial_object_list": (
|
||||
"application/json;as=PartialObjectMetadataList;g=meta.k8s.io;v=v1,"
|
||||
"application/json;q=0.9"
|
||||
),
|
||||
}
|
||||
|
||||
+178
-53
@@ -18,7 +18,9 @@ from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import shlex
|
||||
import tarfile
|
||||
import time
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from select import select
|
||||
from tempfile import NamedTemporaryFile, TemporaryFile
|
||||
@@ -296,14 +298,156 @@ class K8SCopyToPod(K8SCopy):
|
||||
Copy files/directory from local filesystem into remote Pod
|
||||
"""
|
||||
|
||||
# Size of the chunks the tar archive is written to stdin with.
|
||||
CHUNK_SIZE = 1024 * 1024
|
||||
SHELL = "/bin/sh"
|
||||
|
||||
def __init__(self, module, client):
|
||||
super(K8SCopyToPod, self).__init__(module, client)
|
||||
self.files_to_copy = list()
|
||||
self.named_temp_file = None
|
||||
self.copy_timeout = module.params.get("copy_timeout")
|
||||
|
||||
def close_temp_file(self):
|
||||
if self.named_temp_file:
|
||||
self.named_temp_file.close()
|
||||
|
||||
def _fail(self, response, msg, stderr=(), **kwargs):
|
||||
"""Fail, keeping whatever the remote already wrote to stderr.
|
||||
|
||||
An early close or a stall is usually the symptom, not the cause: tar
|
||||
has typically said why on stderr first.
|
||||
"""
|
||||
if stderr:
|
||||
msg = "{0}: {1}".format(msg, "".join(stderr))
|
||||
response.close()
|
||||
self.close_temp_file()
|
||||
self.module.fail_json(
|
||||
msg="Failed to copy local file/directory into Pod: {0}".format(msg),
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
def tar_command(self, dest_file):
|
||||
if self.no_preserve:
|
||||
command = [
|
||||
"tar",
|
||||
"--no-same-permissions",
|
||||
"--no-same-owner",
|
||||
"-xmf",
|
||||
"-",
|
||||
]
|
||||
else:
|
||||
command = ["tar", "-xmf", "-"]
|
||||
|
||||
if dest_file.startswith("/"):
|
||||
command.extend(["-C", "/"])
|
||||
return command
|
||||
|
||||
def can_bound_stream(self):
|
||||
"""Whether the container can run ``sh -c 'head -c ...'``."""
|
||||
error, _out, _err = self._run_from_pod(
|
||||
cmd=[self.SHELL, "-c", "command -v head"]
|
||||
)
|
||||
return (error or {}).get("status") == "Success"
|
||||
|
||||
def remote_command(self, dest_file, archive_size):
|
||||
"""Build the command that extracts the archive inside the container.
|
||||
|
||||
The websocket exec protocol the kubernetes client speaks (v4) cannot
|
||||
half-close stdin, so the only EOF the remote process can get is the
|
||||
connection going away. Relying on that races with tar finishing and
|
||||
truncates the file (issue #776), and tar cannot be relied on to stop at
|
||||
the end-of-archive marker either -- busybox tar blocks for EOF.
|
||||
|
||||
Piping through ``head -c`` bounds the stream at the exact archive size,
|
||||
so tar sees a clean EOF, exits on its own, and the API server reports
|
||||
its exit status on the error channel. Only where the container has no
|
||||
shell do we fall back to feeding tar directly, which cannot confirm
|
||||
that the copy completed.
|
||||
"""
|
||||
command = self.tar_command(dest_file)
|
||||
if not self.can_bound_stream():
|
||||
self.module.warn(
|
||||
"Container has no '{0}' with 'head', falling back to writing the"
|
||||
" archive straight to tar. The module cannot confirm the copy"
|
||||
" completed; verify the file after copying.".format(self.SHELL)
|
||||
)
|
||||
return command, False
|
||||
|
||||
return [
|
||||
self.SHELL,
|
||||
"-c",
|
||||
"head -c {0} | {1}".format(
|
||||
archive_size, " ".join(shlex.quote(arg) for arg in command)
|
||||
),
|
||||
], True
|
||||
|
||||
def _stream_tar_to_pod(self, response, tar_buffer, wait_for_exit):
|
||||
"""Feed the archive to the remote extractor and wait for it to finish.
|
||||
|
||||
Writing the last chunk only hands the bytes to the local socket; they
|
||||
still have to cross the API server and reach the container. Closing the
|
||||
connection at that point kills the extractor mid-write and silently
|
||||
truncates the file, which is what issue #776 reports.
|
||||
"""
|
||||
stdout, stderr = [], []
|
||||
|
||||
def drain(timeout):
|
||||
response.update(timeout=timeout)
|
||||
if response.peek_stdout():
|
||||
stdout.append(response.read_stdout().rstrip("\n"))
|
||||
if response.peek_stderr():
|
||||
stderr.append(response.read_stderr().rstrip("\n"))
|
||||
|
||||
deadline = time.monotonic() + self.copy_timeout
|
||||
|
||||
chunk = tar_buffer.read(self.CHUNK_SIZE)
|
||||
while chunk:
|
||||
if not response.is_open():
|
||||
self._fail(
|
||||
response,
|
||||
"connection to Pod {0}/{1} closed before the whole archive was"
|
||||
" sent, the remote file is incomplete".format(
|
||||
self.namespace, self.name
|
||||
),
|
||||
stderr,
|
||||
)
|
||||
if time.monotonic() > deadline:
|
||||
self._fail(
|
||||
response,
|
||||
"timed out after {0}s sending the archive to Pod {1}/{2}".format(
|
||||
self.copy_timeout, self.namespace, self.name
|
||||
),
|
||||
stderr,
|
||||
)
|
||||
# Non-blocking, keeps the receive buffer clear while we write.
|
||||
drain(0)
|
||||
response.write_stdin(chunk)
|
||||
chunk = tar_buffer.read(self.CHUNK_SIZE)
|
||||
|
||||
if not wait_for_exit:
|
||||
# No way to make the extractor exit, so no status to collect: read
|
||||
# whatever it has already said and close, as the module always did.
|
||||
drain(0)
|
||||
response.close()
|
||||
return None, stdout, stderr
|
||||
|
||||
# The archive is on the wire; wait for the extractor to consume it,
|
||||
# exit, and have its status reported on the error channel.
|
||||
while response.is_open():
|
||||
if time.monotonic() > deadline:
|
||||
self._fail(
|
||||
response,
|
||||
"timed out after {0}s waiting for tar to finish extracting on Pod"
|
||||
" {1}/{2}".format(self.copy_timeout, self.namespace, self.name),
|
||||
stderr,
|
||||
)
|
||||
drain(1)
|
||||
|
||||
error = yaml.safe_load(response.read_channel(ERROR_CHANNEL)) or {}
|
||||
response.close()
|
||||
return error, stdout, stderr
|
||||
|
||||
def run(self):
|
||||
# remove trailing slash from destination path
|
||||
dest_file = self.remote_path.rstrip("/")
|
||||
@@ -336,65 +480,46 @@ class K8SCopyToPod(K8SCopy):
|
||||
dest_file = os.path.join(dest_file, os.path.basename(src_file))
|
||||
|
||||
if not self.check_mode:
|
||||
if self.no_preserve:
|
||||
tar_command = [
|
||||
"tar",
|
||||
"--no-same-permissions",
|
||||
"--no-same-owner",
|
||||
"-xmf",
|
||||
"-",
|
||||
]
|
||||
else:
|
||||
tar_command = ["tar", "-xmf", "-"]
|
||||
|
||||
if dest_file.startswith("/"):
|
||||
tar_command.extend(["-C", "/"])
|
||||
|
||||
response = stream(
|
||||
self.api_instance.connect_get_namespaced_pod_exec,
|
||||
self.name,
|
||||
self.namespace,
|
||||
command=tar_command,
|
||||
stderr=True,
|
||||
stdin=True,
|
||||
stdout=True,
|
||||
tty=False,
|
||||
_preload_content=False,
|
||||
**self.container_arg,
|
||||
)
|
||||
with TemporaryFile() as tar_buffer:
|
||||
# Build the archive first: bounding the remote read needs its
|
||||
# exact size.
|
||||
with tarfile.open(fileobj=tar_buffer, mode="w") as tar:
|
||||
tar.add(src_file, dest_file)
|
||||
archive_size = tar_buffer.tell()
|
||||
tar_buffer.seek(0)
|
||||
commands = []
|
||||
# push command in chunk mode
|
||||
size = 1024 * 1024
|
||||
while True:
|
||||
data = tar_buffer.read(size)
|
||||
if not data:
|
||||
break
|
||||
commands.append(data)
|
||||
|
||||
stderr, stdout = [], []
|
||||
while response.is_open():
|
||||
if response.peek_stdout():
|
||||
stdout.append(response.read_stdout().rstrip("\n"))
|
||||
if response.peek_stderr():
|
||||
stderr.append(response.read_stderr().rstrip("\n"))
|
||||
if commands:
|
||||
cmd = commands.pop(0)
|
||||
response.write_stdin(cmd)
|
||||
else:
|
||||
break
|
||||
response.close()
|
||||
if stderr:
|
||||
self.close_temp_file()
|
||||
self.module.fail_json(
|
||||
command=tar_command,
|
||||
msg="Failed to copy local file/directory into Pod due to: {0}".format(
|
||||
"".join(stderr)
|
||||
),
|
||||
command, wait_for_exit = self.remote_command(dest_file, archive_size)
|
||||
response = stream(
|
||||
self.api_instance.connect_get_namespaced_pod_exec,
|
||||
self.name,
|
||||
self.namespace,
|
||||
command=command,
|
||||
stderr=True,
|
||||
stdin=True,
|
||||
stdout=True,
|
||||
tty=False,
|
||||
_preload_content=False,
|
||||
**self.container_arg,
|
||||
)
|
||||
error, stdout, stderr = self._stream_tar_to_pod(
|
||||
response, tar_buffer, wait_for_exit
|
||||
)
|
||||
|
||||
if error is not None and error.get("status") != "Success":
|
||||
self._fail(
|
||||
response,
|
||||
"".join(stderr) or error.get("message", "unknown error"),
|
||||
command=command,
|
||||
)
|
||||
if error is None and stderr:
|
||||
# Legacy path: no exit status to go on, so any output is fatal.
|
||||
self._fail(response, "".join(stderr), command=command)
|
||||
if stderr:
|
||||
self.module.warn(
|
||||
"tar wrote to stderr while extracting into Pod {0}/{1}: {2}".format(
|
||||
self.namespace, self.name, "".join(stderr)
|
||||
)
|
||||
)
|
||||
self.close_temp_file()
|
||||
if self.content:
|
||||
self.module.exit_json(
|
||||
|
||||
@@ -32,6 +32,53 @@ except ImportError:
|
||||
HAS_YAML = False
|
||||
|
||||
|
||||
# Helm's registry client writes these progress messages to stdout as of helm 4.2.1
|
||||
# (helm/helm#32056); earlier versions sent them to stderr. Anything that parses the
|
||||
# stdout of a helm command which may pull from an OCI registry has to skip them.
|
||||
# Kept verbatim from helm's pkg/registry/client.go so that a reworded message fails
|
||||
# to match, and therefore fails loudly, rather than silently eating real output.
|
||||
REGISTRY_PROGRESS_RE = re.compile(r"^(?:Pulled|Pushed|Digest): \S")
|
||||
|
||||
REGISTRY_UNDERSCORE_SUFFIX = " contains an underscore.\n"
|
||||
|
||||
REGISTRY_UNDERSCORE_MESSAGE = """
|
||||
OCI artifact references (e.g. tags) do not support the plus sign (+). To support
|
||||
storing semantic versions, Helm adopts the convention of changing plus (+) to
|
||||
an underscore (_) in chart version tags when pushing to a registry and back to
|
||||
a plus (+) when pulling from a registry.
|
||||
"""
|
||||
|
||||
REGISTRY_UNDERSCORE_MESSAGE_LINES = len(REGISTRY_UNDERSCORE_MESSAGE.splitlines())
|
||||
|
||||
|
||||
def strip_registry_progress(out):
|
||||
"""
|
||||
Drop OCI registry progress messages from the front of a helm command's stdout.
|
||||
|
||||
Helm emits 'Pulled:'/'Pushed:' and 'Digest:' lines, followed - when the
|
||||
reference contains an underscore - by a free-text explanation that is not
|
||||
valid YAML. Since helm 4.2.1 these land on stdout ahead of the real output,
|
||||
so 'helm show chart' can no longer be parsed and 'helm template' no longer
|
||||
returns only rendered manifests.
|
||||
"""
|
||||
lines = out.splitlines(keepends=True)
|
||||
index = 0
|
||||
while index < len(lines):
|
||||
if REGISTRY_PROGRESS_RE.match(lines[index]):
|
||||
index += 1
|
||||
elif lines[index].endswith(REGISTRY_UNDERSCORE_SUFFIX):
|
||||
# helm prints its registryUnderscoreMessage right after this line, led
|
||||
# by a blank line. Anything else is not a message we know about.
|
||||
start = index + 1
|
||||
end = start + REGISTRY_UNDERSCORE_MESSAGE_LINES
|
||||
if "".join(lines[start:end]) != REGISTRY_UNDERSCORE_MESSAGE:
|
||||
break
|
||||
index = end
|
||||
else:
|
||||
break
|
||||
return "".join(lines[index:])
|
||||
|
||||
|
||||
def parse_helm_plugin_list(output=None):
|
||||
"""
|
||||
Parse `helm plugin list`, return list of plugins
|
||||
|
||||
@@ -181,6 +181,7 @@ def _create_headers(module=None, **kwargs):
|
||||
header_map = {
|
||||
"impersonate_user": "Impersonate-User",
|
||||
"impersonate_groups": "Impersonate-Group",
|
||||
"accept": "Accept",
|
||||
}
|
||||
|
||||
headers = {}
|
||||
|
||||
@@ -92,10 +92,10 @@ def run_module(module) -> None:
|
||||
|
||||
for definition in definitions:
|
||||
result = {"changed": False, "result": {}}
|
||||
warnings = []
|
||||
|
||||
if module.params.get("validate") is not None:
|
||||
warnings = validate(client, module, definition)
|
||||
for warning in validate(client, module, definition):
|
||||
module.warn(warning)
|
||||
|
||||
try:
|
||||
result = perform_action(svc, definition, module.params)
|
||||
@@ -109,16 +109,12 @@ def run_module(module) -> None:
|
||||
except AttributeError:
|
||||
pass
|
||||
error["msg"] = to_native(e)
|
||||
if warnings:
|
||||
error.setdefault("warnings", []).extend(warnings)
|
||||
|
||||
if module.params.get("continue_on_error"):
|
||||
result["error"] = error
|
||||
else:
|
||||
module.fail_json(**error)
|
||||
|
||||
if warnings:
|
||||
result.setdefault("warnings", []).extend(warnings)
|
||||
changed |= result["changed"]
|
||||
results.append(result)
|
||||
|
||||
@@ -177,7 +173,7 @@ def perform_action(svc, definition: Dict, params: Dict) -> Dict:
|
||||
result["method"] = "apply"
|
||||
elif not existing:
|
||||
if state == "patched":
|
||||
result.setdefault("warnings", []).append(
|
||||
svc.module.warn(
|
||||
"resource 'kind={kind},name={name}' was not found but will not be "
|
||||
"created as 'state' parameter has been set to '{state}'".format(
|
||||
kind=kind, name=definition["metadata"].get("name"), state=state
|
||||
@@ -194,8 +190,8 @@ def perform_action(svc, definition: Dict, params: Dict) -> Dict:
|
||||
instance, warnings = svc.update(resource, definition, existing)
|
||||
result["method"] = "update"
|
||||
|
||||
if warnings:
|
||||
result["warnings"] = warnings
|
||||
for warning in warnings:
|
||||
svc.module.warn(warning)
|
||||
|
||||
# If needed, wait and/or create diff
|
||||
success = True
|
||||
@@ -217,7 +213,7 @@ def perform_action(svc, definition: Dict, params: Dict) -> Dict:
|
||||
existing = {}
|
||||
match, diffs = diff_objects(existing, instance, hidden_fields)
|
||||
if match and diffs:
|
||||
result.setdefault("warnings", []).append(
|
||||
svc.module.warn(
|
||||
"No meaningful diff was generated, but the API may not be idempotent "
|
||||
"(only metadata.generation or metadata.resourceVersion were changed)"
|
||||
)
|
||||
|
||||
@@ -47,6 +47,18 @@ def pod_ready(pod: ResourceInstance) -> bool:
|
||||
)
|
||||
|
||||
|
||||
def job_complete(job: ResourceInstance) -> bool:
|
||||
return bool(
|
||||
job.status
|
||||
and job.status.conditions
|
||||
and any(
|
||||
condition["type"] in ("Complete", "Failed")
|
||||
and boolean(condition["status"], strict=False)
|
||||
for condition in job.status.conditions
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def daemonset_ready(daemonset: ResourceInstance) -> bool:
|
||||
return bool(
|
||||
daemonset.status
|
||||
@@ -89,18 +101,18 @@ def custom_condition(condition: Dict, resource: ResourceInstance) -> bool:
|
||||
if not matches:
|
||||
return False
|
||||
# There should never be more than one condition of a specific type
|
||||
match: ResourceField = matches[0]
|
||||
if match.status == "Unknown":
|
||||
if match.status == condition["status"]:
|
||||
match_condition: ResourceField = matches[0]
|
||||
if match_condition.status == "Unknown":
|
||||
if match_condition.status == condition["status"]:
|
||||
if "reason" not in condition:
|
||||
return True
|
||||
if condition["reason"]:
|
||||
return match.reason == condition["reason"]
|
||||
return match_condition.reason == condition["reason"]
|
||||
return False
|
||||
status = True if match.status == "True" else False
|
||||
status = True if match_condition.status == "True" else False
|
||||
if status == boolean(condition["status"], strict=False):
|
||||
if condition.get("reason"):
|
||||
return match.reason == condition["reason"]
|
||||
return match_condition.reason == condition["reason"]
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -143,6 +155,7 @@ RESOURCE_PREDICATES = {
|
||||
"DaemonSet": daemonset_ready,
|
||||
"Deployment": deployment_ready,
|
||||
"Pod": pod_ready,
|
||||
"Job": job_complete,
|
||||
"StatefulSet": statefulset_ready,
|
||||
"ClusterOperator": cluster_operator_ready,
|
||||
}
|
||||
|
||||
@@ -15,4 +15,6 @@ __metaclass__ = type
|
||||
#
|
||||
# from ansible.module_utils.compat.version import LooseVersion
|
||||
|
||||
from ._version import LooseVersion # noqa: F401
|
||||
from ._version import LooseVersion # noqa: F401 # pylint: disable=unused-import
|
||||
|
||||
__all__ = ["LooseVersion"]
|
||||
|
||||
+217
-74
@@ -132,15 +132,19 @@ options:
|
||||
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.
|
||||
- When upgrading package, specifies whether to reuse the last release's values and merge in any overrides from parameters O(release_values),
|
||||
O(values_files) or O(set_values).
|
||||
- Helm ignores this when C(--reset-values) is passed. Since O(reset_values) defaults to V(true), it has to be set to V(false)
|
||||
for this option to take any effect.
|
||||
- C(helm install) does not accept C(--reuse-values), so this option is ignored when O(replace) is set.
|
||||
- The module warns whenever one of those combinations makes this option a no-op.
|
||||
type: bool
|
||||
required: false
|
||||
version_added: 3.0.0
|
||||
reset_values:
|
||||
description:
|
||||
- When upgrading package, reset the values to the ones built into the chart.
|
||||
- Defaults to V(true), which makes helm ignore O(reuse_values) and O(reset_then_reuse_values). Set it to V(false) to use either of them.
|
||||
type: bool
|
||||
required: false
|
||||
default: True
|
||||
@@ -149,7 +153,10 @@ options:
|
||||
description:
|
||||
- When upgrading package, reset the values to the ones built into the chart, apply the last release's values and merge in any overrides from
|
||||
parameters O(release_values), O(values_files) or O(set_values).
|
||||
- If O(reset_values) or O(reuse_values) is set to V(True), this is ignored.
|
||||
- Helm ignores this when C(--reset-values) or C(--reuse-values) is passed. Since O(reset_values) defaults to V(true), it has to be
|
||||
set to V(false), and O(reuse_values) left unset or V(false), for this option to take any effect.
|
||||
- C(helm install) does not accept C(--reset-then-reuse-values), so this option is ignored when O(replace) is set.
|
||||
- The module warns whenever one of those combinations makes this option a no-op.
|
||||
- This feature requires helm diff >= 3.9.12.
|
||||
type: bool
|
||||
required: false
|
||||
@@ -187,10 +194,19 @@ options:
|
||||
It will wait for as long as I(wait_timeout). This feature requires helm>=3.7.0. Added in version 2.3.0.
|
||||
default: False
|
||||
type: bool
|
||||
wait_for_jobs:
|
||||
description:
|
||||
- When I(release_state) is set to C(present), and I(wait) is set to C(True), wait until all jobs are in a
|
||||
completed state before marking the release as successful.
|
||||
- Ignored when used without O(wait).
|
||||
- Requires Helm >= 3.5.0
|
||||
version_added: 6.6.0
|
||||
default: False
|
||||
type: bool
|
||||
wait_timeout:
|
||||
description:
|
||||
- Timeout when wait option is enabled (helm2 is a number of seconds, helm3 is a duration).
|
||||
- The use of I(wait_timeout) to wait for kubernetes commands to complete has been deprecated and will be removed after 2022-12-01.
|
||||
- The use of I(wait_timeout) to wait for kubernetes commands to complete has been deprecated and will be removed in version 7.0.0. Use O(timeout) instead.
|
||||
type: str
|
||||
timeout:
|
||||
description:
|
||||
@@ -207,6 +223,18 @@ options:
|
||||
O(atomic) option works the same way regardless of the installed Helm version.
|
||||
type: bool
|
||||
default: False
|
||||
cleanup_on_fail:
|
||||
description:
|
||||
- Allow deletion of new resources created during a failed upgrade.
|
||||
- Maps to the C(--cleanup-on-fail) flag, which is available since helm 3.0.0 and
|
||||
was not renamed in Helm v4.
|
||||
- Complements O(atomic) rather than replacing it, and the two can be combined so
|
||||
that a rollback also drops resources orphaned by the failed upgrade.
|
||||
- Helm only accepts this flag on C(helm upgrade), so it cannot be used together
|
||||
with O(replace), which deploys through C(helm install).
|
||||
type: bool
|
||||
default: False
|
||||
version_added: 6.6.0
|
||||
server_side:
|
||||
description:
|
||||
- Control Helm v4 server-side apply when installing or upgrading a release.
|
||||
@@ -385,6 +413,7 @@ EXAMPLES = r"""
|
||||
release_namespace: default
|
||||
force: True
|
||||
wait: True
|
||||
wait_for_jobs: True
|
||||
replace: True
|
||||
update_repo_cache: True
|
||||
disable_hook: True
|
||||
@@ -404,15 +433,30 @@ EXAMPLES = r"""
|
||||
enabled: True
|
||||
|
||||
# Deploy latest version
|
||||
# 'reset_values' defaults to true and helm ignores '--reuse-values' when it is set,
|
||||
# so it has to be turned off explicitly.
|
||||
- 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
|
||||
reset_values: false
|
||||
values:
|
||||
replicas: 2
|
||||
version: 3e8ec0b2dffa40fb97d5342e4af887de95faa8c61a62480dd7f8aa03dffcf533
|
||||
|
||||
# Same for 'reset_then_reuse_values', which helm ignores when either
|
||||
# '--reset-values' or '--reuse-values' is set.
|
||||
- name: Deploy latest version of Grafana chart using reset_then_reuse_values
|
||||
kubernetes.core.helm:
|
||||
name: test
|
||||
chart_ref: stable/grafana
|
||||
release_namespace: monitoring
|
||||
reset_then_reuse_values: true
|
||||
reset_values: false
|
||||
values:
|
||||
replicas: 2
|
||||
"""
|
||||
|
||||
RETURN = r"""
|
||||
@@ -454,8 +498,8 @@ status:
|
||||
returned: always
|
||||
description:
|
||||
- Dict of Values used to deploy.
|
||||
- This return value has been deprecated and will be removed in a release after
|
||||
2027-01-08. Use RV(status.release_values) instead.
|
||||
- This return value has been deprecated and will be removed in version 8.0.0.
|
||||
Use RV(status.release_values) instead.
|
||||
release_values:
|
||||
type: dict
|
||||
returned: always
|
||||
@@ -501,6 +545,7 @@ from ansible.module_utils.basic import missing_required_lib
|
||||
from ansible_collections.kubernetes.core.plugins.module_utils.helm import (
|
||||
AnsibleHelmModule,
|
||||
parse_helm_plugin_list,
|
||||
strip_registry_progress,
|
||||
)
|
||||
from ansible_collections.kubernetes.core.plugins.module_utils.helm_args_common import (
|
||||
HELM_AUTH_ARG_SPEC,
|
||||
@@ -548,6 +593,13 @@ def get_release_status(module, release_name, all_status=False):
|
||||
release["release_values"] = module.get_values(release_name)
|
||||
release["values"] = release["release_values"]
|
||||
|
||||
# Add deprecation warning for status.values
|
||||
module.deprecate(
|
||||
"The 'status.values' return value is deprecated and will be removed in version 8.0.0. Use 'status.release_values' instead.",
|
||||
version="8.0.0",
|
||||
collection_name="kubernetes.core",
|
||||
)
|
||||
|
||||
return release
|
||||
|
||||
|
||||
@@ -591,7 +643,52 @@ def fetch_chart_info(
|
||||
|
||||
rc, out, err = module.run_helm_command(inspect_command)
|
||||
|
||||
return yaml.safe_load(out)
|
||||
return yaml.safe_load(strip_registry_progress(out))
|
||||
|
||||
|
||||
def validate_value_options(
|
||||
module, replace, reuse_values, reset_values, reset_then_reuse_values
|
||||
):
|
||||
"""
|
||||
Check the value-reuse options against each other and against 'replace'.
|
||||
|
||||
'helm install' accepts none of these flags, so 'replace' drops all three. The rest
|
||||
are precedence rules helm applies silently: '--reset-values' wins over
|
||||
'--reuse-values', and both win over '--reset-then-reuse-values'. Since 'reset_values'
|
||||
defaults to true, requesting either of the other two on its own is a no-op.
|
||||
|
||||
Warn rather than fail throughout. Every one of these combinations is accepted by
|
||||
playbooks today: 'reuse_values' has existed since 3.0.0, and a release that is
|
||||
already converged never reaches deploy(), so the invalid command was never built.
|
||||
Failing here would turn tasks that pass today into tasks that fail.
|
||||
"""
|
||||
if replace:
|
||||
for name, requested in (
|
||||
("reuse_values", reuse_values is not None),
|
||||
("reset_then_reuse_values", reset_then_reuse_values),
|
||||
):
|
||||
if requested:
|
||||
module.warn(
|
||||
"{0} is ignored because replace=true deploys through 'helm install',"
|
||||
" which does not accept the flag.".format(name)
|
||||
)
|
||||
return
|
||||
|
||||
if reset_values:
|
||||
for name, requested in (
|
||||
("reuse_values", reuse_values),
|
||||
("reset_then_reuse_values", reset_then_reuse_values),
|
||||
):
|
||||
if requested:
|
||||
module.warn(
|
||||
"{0} is ignored because reset_values is true. "
|
||||
"Set reset_values=false to make it take effect.".format(name)
|
||||
)
|
||||
elif reuse_values and reset_then_reuse_values:
|
||||
module.warn(
|
||||
"reset_then_reuse_values is ignored because reuse_values is true. "
|
||||
"Set reuse_values=false to make it take effect."
|
||||
)
|
||||
|
||||
|
||||
def deploy(
|
||||
@@ -601,12 +698,14 @@ def deploy(
|
||||
release_values,
|
||||
chart_name,
|
||||
wait,
|
||||
wait_for_jobs,
|
||||
wait_timeout,
|
||||
disable_hook,
|
||||
force,
|
||||
values_files,
|
||||
history_max,
|
||||
atomic=False,
|
||||
cleanup_on_fail=False,
|
||||
create_namespace=False,
|
||||
replace=False,
|
||||
post_renderer=None,
|
||||
@@ -634,27 +733,41 @@ def deploy(
|
||||
deploy_command += " --dependency-update"
|
||||
else:
|
||||
deploy_command = command + " upgrade -i" # install/upgrade
|
||||
if reset_values:
|
||||
deploy_command += " --reset-values"
|
||||
if take_ownership:
|
||||
deploy_command += " --take-ownership"
|
||||
|
||||
if reuse_values is not None:
|
||||
deploy_command += " --reuse-values=" + str(reuse_values)
|
||||
# '--reset-values', '--reuse-values' and '--reset-then-reuse-values' are all
|
||||
# upgrade-only flags, so they must not leak into the 'replace' branch above.
|
||||
# validate_value_options() has already warned about that combination.
|
||||
if reset_values:
|
||||
deploy_command += " --reset-values"
|
||||
|
||||
if reset_then_reuse_values:
|
||||
helm_version = module.get_helm_version()
|
||||
if LooseVersion(helm_version) < LooseVersion("3.14.0"):
|
||||
module.fail_json(
|
||||
msg="reset_then_reuse_values requires helm >= 3.14.0, current version is {0}".format(
|
||||
helm_version
|
||||
if reuse_values is not None:
|
||||
deploy_command += " --reuse-values=" + str(reuse_values)
|
||||
|
||||
if reset_then_reuse_values:
|
||||
helm_version = module.get_helm_version()
|
||||
if LooseVersion(helm_version) < LooseVersion("3.14.0"):
|
||||
module.fail_json(
|
||||
msg="reset_then_reuse_values requires helm >= 3.14.0, current version is {0}".format(
|
||||
helm_version
|
||||
)
|
||||
)
|
||||
)
|
||||
else:
|
||||
deploy_command += " --reset-then-reuse-values"
|
||||
else:
|
||||
deploy_command += " --reset-then-reuse-values"
|
||||
|
||||
if wait:
|
||||
deploy_command += " --wait"
|
||||
if wait_for_jobs:
|
||||
helm_version = module.get_helm_version()
|
||||
if LooseVersion(helm_version) < LooseVersion("3.5.0"):
|
||||
module.fail_json(
|
||||
msg="wait_for_jobs requires helm >= 3.5.0, current version is {0}".format(
|
||||
helm_version
|
||||
)
|
||||
)
|
||||
else:
|
||||
deploy_command += " --wait-for-jobs"
|
||||
if wait_timeout is not None:
|
||||
deploy_command += " --timeout " + wait_timeout
|
||||
|
||||
@@ -667,6 +780,17 @@ def deploy(
|
||||
else:
|
||||
deploy_command += " --atomic"
|
||||
|
||||
if cleanup_on_fail:
|
||||
# '--cleanup-on-fail' is only accepted by 'helm upgrade', so it cannot be
|
||||
# combined with 'replace', which deploys through 'helm install'. The flag
|
||||
# exists since helm 3.0.0 and kept its name in v4, so no version gate is
|
||||
# needed on top of the module-wide helm >= 3.0.0 requirement.
|
||||
if replace:
|
||||
module.fail_json(
|
||||
msg="cleanup_on_fail is only supported by 'helm upgrade' and cannot be used with replace=true"
|
||||
)
|
||||
deploy_command += " --cleanup-on-fail"
|
||||
|
||||
if timeout:
|
||||
deploy_command += " --timeout " + timeout
|
||||
|
||||
@@ -832,7 +956,6 @@ def helmdiff_check(
|
||||
reset_values=True,
|
||||
reset_then_reuse_values=False,
|
||||
insecure_skip_tls_verify=False,
|
||||
plain_http=False,
|
||||
skip_schema_validation=False,
|
||||
):
|
||||
"""
|
||||
@@ -865,10 +988,10 @@ def helmdiff_check(
|
||||
if set_value_args:
|
||||
cmd += " " + set_value_args
|
||||
|
||||
if reuse_values:
|
||||
if not replace and reuse_values:
|
||||
cmd += " --reuse-values"
|
||||
|
||||
if reset_then_reuse_values:
|
||||
if not replace and reset_then_reuse_values:
|
||||
helm_diff_version = get_plugin_version("diff")
|
||||
helm_version = module.get_helm_version()
|
||||
fail_msg = ""
|
||||
@@ -900,17 +1023,6 @@ def helmdiff_check(
|
||||
else:
|
||||
cmd += " --skip-schema-validation"
|
||||
|
||||
if plain_http:
|
||||
helm_version = module.get_helm_version()
|
||||
if LooseVersion(helm_version) < LooseVersion("3.13.0"):
|
||||
module.fail_json(
|
||||
msg="plain_http requires helm >= 3.13.0, current version is {0}".format(
|
||||
helm_version
|
||||
)
|
||||
)
|
||||
else:
|
||||
cmd += " --plain-http"
|
||||
|
||||
rc, out, err = module.run_helm_command(cmd)
|
||||
return (len(out.strip()) > 0, out.strip())
|
||||
|
||||
@@ -942,44 +1054,58 @@ def default_check(release_status, chart_info, values=None, values_files=None):
|
||||
def argument_spec():
|
||||
arg_spec = copy.deepcopy(HELM_AUTH_ARG_SPEC)
|
||||
arg_spec.update(
|
||||
dict(
|
||||
chart_ref=dict(type="path"),
|
||||
chart_repo_url=dict(type="str"),
|
||||
chart_version=dict(type="str"),
|
||||
dependency_update=dict(type="bool", default=False, aliases=["dep_up"]),
|
||||
release_name=dict(type="str", required=True, aliases=["name"]),
|
||||
release_namespace=dict(type="str", required=True, aliases=["namespace"]),
|
||||
release_state=dict(
|
||||
default="present", choices=["present", "absent"], aliases=["state"]
|
||||
),
|
||||
release_values=dict(type="dict", default={}, aliases=["values"]),
|
||||
values_files=dict(type="list", default=[], elements="str"),
|
||||
update_repo_cache=dict(type="bool", default=False),
|
||||
disable_hook=dict(type="bool", default=False),
|
||||
force=dict(type="bool", default=False),
|
||||
purge=dict(type="bool", default=True),
|
||||
wait=dict(type="bool", default=False),
|
||||
wait_timeout=dict(type="str"),
|
||||
timeout=dict(type="str"),
|
||||
atomic=dict(type="bool", default=False),
|
||||
server_side=dict(type="str", choices=["auto", "true", "false"]),
|
||||
force_conflicts=dict(type="bool", default=False),
|
||||
create_namespace=dict(type="bool", default=False),
|
||||
post_renderer=dict(type="str"),
|
||||
replace=dict(type="bool", default=False),
|
||||
skip_crds=dict(type="bool", default=False),
|
||||
history_max=dict(type="int"),
|
||||
set_values=dict(type="list", elements="dict"),
|
||||
reuse_values=dict(type="bool"),
|
||||
reset_values=dict(type="bool", default=True),
|
||||
reset_then_reuse_values=dict(type="bool", default=False),
|
||||
insecure_skip_tls_verify=dict(
|
||||
type="bool", default=False, aliases=["skip_tls_certs_check"]
|
||||
),
|
||||
plain_http=dict(type="bool", default=False),
|
||||
take_ownership=dict(type="bool", default=False),
|
||||
skip_schema_validation=dict(type="bool", default=False),
|
||||
)
|
||||
{
|
||||
"chart_ref": {"type": "path"},
|
||||
"chart_repo_url": {"type": "str"},
|
||||
"chart_version": {"type": "str"},
|
||||
"dependency_update": {
|
||||
"type": "bool",
|
||||
"default": False,
|
||||
"aliases": ["dep_up"],
|
||||
},
|
||||
"release_name": {"type": "str", "required": True, "aliases": ["name"]},
|
||||
"release_namespace": {
|
||||
"type": "str",
|
||||
"required": True,
|
||||
"aliases": ["namespace"],
|
||||
},
|
||||
"release_state": {
|
||||
"default": "present",
|
||||
"choices": ["present", "absent"],
|
||||
"aliases": ["state"],
|
||||
},
|
||||
"release_values": {"type": "dict", "default": {}, "aliases": ["values"]},
|
||||
"values_files": {"type": "list", "default": [], "elements": "str"},
|
||||
"update_repo_cache": {"type": "bool", "default": False},
|
||||
"disable_hook": {"type": "bool", "default": False},
|
||||
"force": {"type": "bool", "default": False},
|
||||
"purge": {"type": "bool", "default": True},
|
||||
"wait": {"type": "bool", "default": False},
|
||||
"wait_for_jobs": {"type": "bool", "default": False},
|
||||
"wait_timeout": {"type": "str"},
|
||||
"timeout": {"type": "str"},
|
||||
"atomic": {"type": "bool", "default": False},
|
||||
"server_side": {"type": "str", "choices": ["auto", "true", "false"]},
|
||||
"force_conflicts": {"type": "bool", "default": False},
|
||||
"create_namespace": {"type": "bool", "default": False},
|
||||
"post_renderer": {"type": "str"},
|
||||
"replace": {"type": "bool", "default": False},
|
||||
"skip_crds": {"type": "bool", "default": False},
|
||||
"history_max": {"type": "int"},
|
||||
"set_values": {"type": "list", "elements": "dict"},
|
||||
"reuse_values": {"type": "bool"},
|
||||
"reset_values": {"type": "bool", "default": True},
|
||||
"reset_then_reuse_values": {"type": "bool", "default": False},
|
||||
"insecure_skip_tls_verify": {
|
||||
"type": "bool",
|
||||
"default": False,
|
||||
"aliases": ["skip_tls_certs_check"],
|
||||
},
|
||||
"plain_http": {"type": "bool", "default": False},
|
||||
"take_ownership": {"type": "bool", "default": False},
|
||||
"skip_schema_validation": {"type": "bool", "default": False},
|
||||
"cleanup_on_fail": {"type": "bool", "default": False},
|
||||
}
|
||||
)
|
||||
return arg_spec
|
||||
|
||||
@@ -1002,6 +1128,14 @@ def main():
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
# Add deprecation warning for wait_timeout
|
||||
if module.params.get("wait_timeout") is not None:
|
||||
module.deprecate(
|
||||
"The 'wait_timeout' parameter is deprecated and will be removed in version 7.0.0. Use 'timeout' instead.",
|
||||
version="7.0.0",
|
||||
collection_name="kubernetes.core",
|
||||
)
|
||||
|
||||
if not IMP_YAML:
|
||||
module.fail_json(msg=missing_required_lib("yaml"), exception=IMP_YAML_ERR)
|
||||
|
||||
@@ -1025,8 +1159,10 @@ def main():
|
||||
force = module.params.get("force")
|
||||
purge = module.params.get("purge")
|
||||
wait = module.params.get("wait")
|
||||
wait_for_jobs = module.params.get("wait_for_jobs")
|
||||
wait_timeout = module.params.get("wait_timeout")
|
||||
atomic = module.params.get("atomic")
|
||||
cleanup_on_fail = module.params.get("cleanup_on_fail")
|
||||
server_side = module.params.get("server_side")
|
||||
force_conflicts = module.params.get("force_conflicts")
|
||||
create_namespace = module.params.get("create_namespace")
|
||||
@@ -1099,6 +1235,10 @@ def main():
|
||||
)
|
||||
changed = True
|
||||
elif release_state == "present":
|
||||
validate_value_options(
|
||||
module, replace, reuse_values, reset_values, reset_then_reuse_values
|
||||
)
|
||||
|
||||
if chart_version is not None:
|
||||
helm_cmd += " --version=" + chart_version
|
||||
|
||||
@@ -1152,11 +1292,13 @@ def main():
|
||||
release_values,
|
||||
chart_ref,
|
||||
wait,
|
||||
wait_for_jobs,
|
||||
wait_timeout,
|
||||
disable_hook,
|
||||
False,
|
||||
values_files=values_files,
|
||||
atomic=atomic,
|
||||
cleanup_on_fail=cleanup_on_fail,
|
||||
server_side=server_side,
|
||||
force_conflicts=force_conflicts,
|
||||
create_namespace=create_namespace,
|
||||
@@ -1208,7 +1350,6 @@ def main():
|
||||
reset_values=reset_values,
|
||||
reset_then_reuse_values=reset_then_reuse_values,
|
||||
insecure_skip_tls_verify=insecure_skip_tls_verify,
|
||||
plain_http=plain_http,
|
||||
skip_schema_validation=skip_schema_validation,
|
||||
)
|
||||
if would_change and module._diff:
|
||||
@@ -1238,11 +1379,13 @@ def main():
|
||||
release_values,
|
||||
chart_ref,
|
||||
wait,
|
||||
wait_for_jobs,
|
||||
wait_timeout,
|
||||
disable_hook,
|
||||
force,
|
||||
values_files=values_files,
|
||||
atomic=atomic,
|
||||
cleanup_on_fail=cleanup_on_fail,
|
||||
server_side=server_side,
|
||||
force_conflicts=force_conflicts,
|
||||
create_namespace=create_namespace,
|
||||
|
||||
@@ -119,8 +119,8 @@ status:
|
||||
returned: always
|
||||
description:
|
||||
- Dict of Values used to deploy
|
||||
- This return value has been deprecated and will be removed in a release after
|
||||
2027-01-08. Use RV(status.release_values) instead.
|
||||
- This return value has been deprecated and will be removed in version 8.0.0.
|
||||
Use RV(status.release_values) instead.
|
||||
release_values:
|
||||
type: dict
|
||||
returned: always
|
||||
@@ -213,6 +213,14 @@ def get_release_status(module, release_name, release_state, get_all_values=False
|
||||
|
||||
release["release_values"] = module.get_values(release_name, get_all_values)
|
||||
release["values"] = release["release_values"]
|
||||
|
||||
# Add deprecation warning for status.values
|
||||
module.deprecate(
|
||||
"The 'status.values' return value is deprecated and will be removed in version 8.0.0. Use 'status.release_values' instead.",
|
||||
version="8.0.0",
|
||||
collection_name="kubernetes.core",
|
||||
)
|
||||
|
||||
release["manifest"] = module.get_manifest(release_name)
|
||||
release["notes"] = module.get_notes(release_name)
|
||||
release["hooks"] = module.get_hooks(release_name)
|
||||
|
||||
@@ -331,7 +331,7 @@ def main():
|
||||
insecure_skip_tls_verify,
|
||||
)
|
||||
changed = True
|
||||
elif repository_status["url"] != repo_url:
|
||||
elif repository_status["url"].rstrip("/") != repo_url:
|
||||
module.fail_json(
|
||||
msg="Repository already have a repository named {0}".format(repo_name)
|
||||
)
|
||||
|
||||
@@ -228,6 +228,7 @@ except ImportError:
|
||||
from ansible.module_utils.basic import missing_required_lib
|
||||
from ansible_collections.kubernetes.core.plugins.module_utils.helm import (
|
||||
AnsibleHelmModule,
|
||||
strip_registry_progress,
|
||||
)
|
||||
from ansible_collections.kubernetes.core.plugins.module_utils.version import (
|
||||
LooseVersion,
|
||||
@@ -394,6 +395,9 @@ def main():
|
||||
|
||||
if not check_mode:
|
||||
rc, out, err = module.run_helm_command(tmpl_cmd)
|
||||
# 'stdout' is documented to hold the rendered templates, so keep helm's
|
||||
# OCI registry progress messages out of it.
|
||||
out = strip_registry_progress(out)
|
||||
else:
|
||||
out = err = ""
|
||||
rc = 0
|
||||
|
||||
@@ -40,9 +40,8 @@ options:
|
||||
state:
|
||||
description:
|
||||
- Determines if an object should be created, patched, or deleted. When set to C(present), an object will be
|
||||
created, if it does not already exist. If set to C(absent), an existing object will be deleted. If set to
|
||||
C(present), an existing object will be patched, if its attributes differ from those specified using
|
||||
I(resource_definition) or I(src).
|
||||
created if it does not already exist, and an existing object will be patched if its attributes differ from
|
||||
those specified using I(resource_definition) or I(src). If set to C(absent), an existing object will be deleted.
|
||||
- C(patched) state is an existing resource that has a given patch applied. If the resource doesn't exist, silently skip it (do not raise an error).
|
||||
type: str
|
||||
default: present
|
||||
|
||||
@@ -76,9 +76,21 @@ options:
|
||||
- This option is ignored when I(content) is set or when I(state) is set to C(from_pod).
|
||||
type: bool
|
||||
default: False
|
||||
copy_timeout:
|
||||
description:
|
||||
- Maximum time in seconds to spend streaming the archive to the pod and waiting for the remote
|
||||
C(tar) process to finish extracting it.
|
||||
- Raise this when copying large files over a slow connection.
|
||||
- This option is ignored when I(state) is set to C(from_pod).
|
||||
type: int
|
||||
default: 300
|
||||
version_added: 6.6.0
|
||||
|
||||
notes:
|
||||
- the tar binary is required on the container when copying from local filesystem to pod.
|
||||
- a POSIX shell at C(/bin/sh) and C(head) are also used, when present, to bound the archive
|
||||
sent to the container so that the module can confirm the copy finished. Without them the
|
||||
copy still runs but completion cannot be verified, and a warning is emitted.
|
||||
- the (init) container has to be started before you copy files or directories to it.
|
||||
"""
|
||||
|
||||
@@ -180,6 +192,7 @@ def argspec():
|
||||
"choices": ["to_pod", "from_pod"],
|
||||
}
|
||||
argument_spec["no_preserve"] = {"type": "bool", "default": False}
|
||||
argument_spec["copy_timeout"] = {"type": "int", "default": 300}
|
||||
return argument_spec
|
||||
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ result:
|
||||
type: int
|
||||
version_added: 2.2.0
|
||||
return_code:
|
||||
description: The command status code. This attribute is deprecated and will be removed in a future release. Please use rc instead.
|
||||
description: The command status code. This attribute is deprecated and will be removed in version 7.0.0. Use RV(result.rc) instead.
|
||||
type: int
|
||||
"""
|
||||
|
||||
@@ -219,6 +219,13 @@ def execute_module(module, client):
|
||||
else:
|
||||
rc = int(err["details"]["causes"][0]["message"])
|
||||
|
||||
# Add deprecation warning for return_code return value
|
||||
module.deprecate(
|
||||
"The 'return_code' return value is deprecated and will be removed in version 7.0.0. Use 'rc' instead.",
|
||||
version="7.0.0",
|
||||
collection_name="kubernetes.core",
|
||||
)
|
||||
|
||||
module.exit_json(
|
||||
# Some command might change environment, but ultimately failing at end
|
||||
changed=True,
|
||||
|
||||
+40
-10
@@ -53,6 +53,15 @@ options:
|
||||
type: list
|
||||
elements: str
|
||||
version_added: 3.0.0
|
||||
metadata_only:
|
||||
description:
|
||||
- Request metadata only response from the Kubernetes API server.
|
||||
- This feature is useful for clients that only need to check for the existence of an object,
|
||||
- or that only need to read its metadata.
|
||||
- It can significantly reduce the size of the response from the API server.
|
||||
type: bool
|
||||
default: false
|
||||
version_added: 6.6.0
|
||||
|
||||
extends_documentation_fragment:
|
||||
- kubernetes.core.k8s_auth_options
|
||||
@@ -135,6 +144,12 @@ EXAMPLES = r"""
|
||||
(ocp_bootstrap_status.resources[0].data.status == 'complete')
|
||||
retries: 60
|
||||
delay: 15
|
||||
|
||||
- name: Get a list of all pods metadata only
|
||||
kubernetes.core.k8s_info:
|
||||
kind: Pod
|
||||
metadata_only: true
|
||||
register: pod_metadata_list
|
||||
"""
|
||||
|
||||
RETURN = r"""
|
||||
@@ -179,6 +194,8 @@ from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule impo
|
||||
)
|
||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (
|
||||
AUTH_ARG_SPEC,
|
||||
METADATA_ONLY_HEADER_VALUES,
|
||||
METADATA_ONLY_HEADERS_SPEC,
|
||||
WAIT_ARG_SPEC,
|
||||
)
|
||||
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
|
||||
@@ -216,15 +233,16 @@ def argspec():
|
||||
args = copy.deepcopy(AUTH_ARG_SPEC)
|
||||
args.update(WAIT_ARG_SPEC)
|
||||
args.update(
|
||||
dict(
|
||||
kind=dict(required=True),
|
||||
api_version=dict(default="v1", aliases=["api", "version"]),
|
||||
name=dict(),
|
||||
namespace=dict(),
|
||||
label_selectors=dict(type="list", elements="str", default=[]),
|
||||
field_selectors=dict(type="list", elements="str", default=[]),
|
||||
hidden_fields=dict(type="list", elements="str"),
|
||||
)
|
||||
{
|
||||
"kind": {"required": True},
|
||||
"api_version": {"default": "v1", "aliases": ["api", "version"]},
|
||||
"name": {},
|
||||
"namespace": {},
|
||||
"label_selectors": {"type": "list", "elements": "str", "default": []},
|
||||
"field_selectors": {"type": "list", "elements": "str", "default": []},
|
||||
"hidden_fields": {"type": "list", "elements": "str"},
|
||||
"metadata_only": {"type": "bool", "default": False},
|
||||
}
|
||||
)
|
||||
return args
|
||||
|
||||
@@ -233,8 +251,20 @@ def main():
|
||||
module = AnsibleK8SModule(
|
||||
module_class=AnsibleModule, argument_spec=argspec(), supports_check_mode=True
|
||||
)
|
||||
|
||||
metadata_only_headers = {}
|
||||
if module.params["metadata_only"]:
|
||||
metadata_only_headers = copy.deepcopy(METADATA_ONLY_HEADERS_SPEC)
|
||||
metadata_only_headers.update(
|
||||
{"accept": METADATA_ONLY_HEADER_VALUES["partial_object_list"]}
|
||||
)
|
||||
if module.params["name"]:
|
||||
metadata_only_headers.update(
|
||||
{"accept": METADATA_ONLY_HEADER_VALUES["partial_object"]}
|
||||
)
|
||||
|
||||
try:
|
||||
client = get_api_client(module)
|
||||
client = get_api_client(module, **metadata_only_headers)
|
||||
svc = K8sService(client, module)
|
||||
execute_module(module, svc)
|
||||
except CoreException as e:
|
||||
|
||||
@@ -36,6 +36,7 @@ options:
|
||||
- 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 combine Custom Resources and built-in resources.
|
||||
- I(merge_type=json) has been deprecated and will be removed in version 7.0.0. Use M(kubernetes.core.k8s_json_patch) instead.
|
||||
choices:
|
||||
- json
|
||||
- merge
|
||||
@@ -251,6 +252,15 @@ def main():
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
# Add deprecation warning for merge_type=json
|
||||
merge_type = module.params.get("merge_type")
|
||||
if merge_type and "json" in merge_type:
|
||||
module.deprecate(
|
||||
"The 'merge_type=json' option is deprecated and will be removed in version 7.0.0. Use the 'kubernetes.core.k8s_json_patch' module instead.",
|
||||
version="7.0.0",
|
||||
collection_name="kubernetes.core",
|
||||
)
|
||||
|
||||
try:
|
||||
client = get_api_client(module=module)
|
||||
svc = K8sService(client, module)
|
||||
|
||||
@@ -9,15 +9,26 @@ sonar.python.coverage.reportPaths=coverage.xml
|
||||
|
||||
sonar.tests=tests/unit,tests/integration
|
||||
sonar.python.version=3.12
|
||||
sonar.newCode.referenceBranch=stable-6
|
||||
sonar.newCode.referenceBranch=main
|
||||
|
||||
sonar.exclusions=tests/**,.tox/**
|
||||
|
||||
# Exclude test code from copy/paste detection. 'sonar.exclusions' above only
|
||||
# filters the *source* set (it disambiguates 'sonar.sources=.' from
|
||||
# 'sonar.tests'), so test files are still indexed as tests and still scored for
|
||||
# duplication. Unit tests here are unittest.TestCase classes: every class needs
|
||||
# its own setUp, and per-case arrange/assert blocks are deliberately repeated so
|
||||
# a failing test reads on its own. Because SonarCloud scores only *new code* on
|
||||
# a pull request, any PR adding cases to an already-repetitive test module
|
||||
# inherits duplication accrued across earlier PRs. Production code under
|
||||
# plugins/ stays fully covered by duplication analysis.
|
||||
sonar.cpd.exclusions=tests/**
|
||||
|
||||
# Ansible module argument_spec is conventionally defined with the dict(...)
|
||||
# constructor (not {...} literals) for readability and consistency across the
|
||||
# collection. Suppress python:S7498 ("prefer literal syntax"), which conflicts
|
||||
# with that convention and otherwise re-fires on every new module argument.
|
||||
sonar.issue.ignore.multicriteria=e1,e2,e3
|
||||
sonar.issue.ignore.multicriteria=e1,e2,e3,e4,e5
|
||||
sonar.issue.ignore.multicriteria.e1.ruleKey=python:S7498
|
||||
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.py
|
||||
|
||||
@@ -34,3 +45,24 @@ sonar.issue.ignore.multicriteria.e2.resourceKey=tests/**/*.py
|
||||
# to simplify maintenance. Suppress githubactions:S7637 ("use full commit SHA").
|
||||
sonar.issue.ignore.multicriteria.e3.ruleKey=githubactions:S7637
|
||||
sonar.issue.ignore.multicriteria.e3.resourceKey=.github/workflows/**/*.yaml
|
||||
|
||||
# Workflows across this repo install ansible-core from a GitHub source
|
||||
# archive (required for devel/milestone builds, which have no published
|
||||
# wheel) and install this collection's shared test-requirements.txt /
|
||||
# requirements.txt. Suppress githubactions:S8541 ("omitting --only-binary
|
||||
# :all:") repo-wide for workflow files: forcing wheel-only installs would
|
||||
# break the ansible-core source install and fails outright on the
|
||||
# test-requirements.txt pin coverage==4.5.4, which has no Python 3.13 wheel.
|
||||
# Scoped the same way as e3 above, since a filename-only resourceKey (as
|
||||
# originally used here) does not reliably suppress issues already raised
|
||||
# against this project.
|
||||
sonar.issue.ignore.multicriteria.e4.ruleKey=githubactions:S8541
|
||||
sonar.issue.ignore.multicriteria.e4.resourceKey=.github/workflows/**/*.yaml
|
||||
|
||||
# Same shared test-requirements.txt / requirements.txt as above are not
|
||||
# hash-locked; that is a repo-wide dependency-management concern affecting
|
||||
# every existing workflow. Suppress githubactions:S8544 ("dependencies
|
||||
# without locking resolved versions") repo-wide for workflow files rather
|
||||
# than diverging from established practice.
|
||||
sonar.issue.ignore.multicriteria.e5.ruleKey=githubactions:S8544
|
||||
sonar.issue.ignore.multicriteria.e5.resourceKey=.github/workflows/**/*.yaml
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
modules:
|
||||
python_requires: ">=3.6"
|
||||
python_requires: ">=3.9"
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
# Running Helm Integration Tests Locally
|
||||
|
||||
This guide explains how to run the `helm*` integration test targets locally using `ansible-test`.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- `ansible-test` available in your environment (installed with `ansible-core`)
|
||||
- A Kubernetes cluster accessible via `kubectl` (for targets that interact with a cluster)
|
||||
|
||||
## Configuration
|
||||
|
||||
Create an `integration_config.yml` file under `tests/integration/` with the following variables:
|
||||
|
||||
```yaml
|
||||
setup_helm_version: vx.x.x # e.g v4.2.1
|
||||
helm_install_path: /path/to/helm/directory
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
| Variable | Description |
|
||||
|---|---|
|
||||
| `setup_helm_version` | The Helm version to install (e.g. `v4.2.1`). The `v` prefix is optional and will be added automatically if omitted. |
|
||||
| `helm_install_path` | Path to a directory that either already contains a `helm` executable matching the version set in `setup_helm_version`, or an empty/non-existent directory where Helm will be downloaded and installed. |
|
||||
|
||||
If a `helm` binary already exists at `<helm_install_path>/helm`, the setup will skip the download and use the existing binary directly.
|
||||
|
||||
## Running Tests
|
||||
|
||||
Run a specific Helm test target with:
|
||||
|
||||
```bash
|
||||
ansible-test integration --python <version> -v --no-temp-workdir <target>
|
||||
```
|
||||
|
||||
For example, to run the `helm` target with Python 3.12:
|
||||
|
||||
```bash
|
||||
ansible-test integration --python 3.12 -v --no-temp-workdir helm
|
||||
```
|
||||
|
||||
You can run multiple targets in a single command:
|
||||
|
||||
```bash
|
||||
ansible-test integration --python 3.12 -v --no-temp-workdir helm helm_diff helm_plugin
|
||||
```
|
||||
@@ -1 +1,4 @@
|
||||
disabled # used by test targets helm_vX_XX_XX
|
||||
helm
|
||||
helm_info
|
||||
helm_plugin
|
||||
helm_template
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
helm_default_archive_name: "helm-{{ helm_version }}-{{ ansible_system | lower }}-amd64.tar.gz"
|
||||
helm_binary: "/tmp/helm/{{ ansible_system | lower }}-amd64/helm"
|
||||
helm_binary: "helm"
|
||||
setup_helm_version_binary_path: "{{ helm_binary }}"
|
||||
|
||||
chart_test: "ingress-nginx"
|
||||
chart_test_oci: "oci://registry-1.docker.io/bitnamicharts/redis"
|
||||
@@ -31,3 +31,4 @@ test_namespace:
|
||||
- "helm-insecure-{{ helm_version | replace('.', '-') }}"
|
||||
- "helm-test-take-ownership-{{ helm_version | replace('.', '-') }}"
|
||||
- "helm-skip-schema-validation-{{ helm_version | replace('.', '-') }}"
|
||||
- "helm-wait-for-jobs-{{ helm_version | replace('.', '-') }}"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: test-chart-job
|
||||
description: A chart with a Job for testing wait_for_jobs
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "default"
|
||||
@@ -0,0 +1,21 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: "{{ .Release.Name }}-job"
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
template:
|
||||
spec:
|
||||
automountServiceAccountToken: false
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: test
|
||||
image: "busybox:1.37"
|
||||
command: ["sh", "-c", "echo done"]
|
||||
resources:
|
||||
requests:
|
||||
cpu: "50m"
|
||||
memory: "32Mi"
|
||||
ephemeral-storage: "16Mi"
|
||||
limits:
|
||||
memory: "64Mi"
|
||||
@@ -1,96 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright: (c) 2021, 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_version
|
||||
short_description: check helm executable version
|
||||
author:
|
||||
- Aubin Bikouo (@abikouo)
|
||||
requirements:
|
||||
- "helm (https://github.com/helm/helm/releases)"
|
||||
description:
|
||||
- validate version of helm binary is lower than the specified version.
|
||||
options:
|
||||
binary_path:
|
||||
description:
|
||||
- The path of a helm binary to use.
|
||||
required: false
|
||||
type: path
|
||||
version:
|
||||
description:
|
||||
- version to test against helm binary.
|
||||
type: str
|
||||
default: 3.7.0
|
||||
"""
|
||||
|
||||
EXAMPLES = r"""
|
||||
- name: validate helm binary version is lower than 3.5.0
|
||||
helm_test_version:
|
||||
binary_path: path/to/helm
|
||||
version: "3.5.0"
|
||||
"""
|
||||
|
||||
RETURN = r"""
|
||||
message:
|
||||
type: str
|
||||
description: Text message describing the test result.
|
||||
returned: always
|
||||
sample: 'version installed: 3.4.5 is lower than version 3.5.0'
|
||||
result:
|
||||
type: bool
|
||||
description: Test result.
|
||||
returned: always
|
||||
sample: 1
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.kubernetes.core.plugins.module_utils.version import (
|
||||
LooseVersion,
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
binary_path=dict(type="path"),
|
||||
version=dict(type="str", default="3.7.0"),
|
||||
),
|
||||
)
|
||||
|
||||
bin_path = module.params.get("binary_path")
|
||||
version = module.params.get("version")
|
||||
|
||||
if bin_path is not None:
|
||||
helm_cmd_common = bin_path
|
||||
else:
|
||||
helm_cmd_common = "helm"
|
||||
|
||||
helm_cmd_common = module.get_bin_path(helm_cmd_common, required=True)
|
||||
rc, out, err = module.run_command([helm_cmd_common, "version"])
|
||||
if rc != 0:
|
||||
module.fail_json(msg="helm version failed.", err=err, out=out, rc=rc)
|
||||
|
||||
m = re.match(r'version.BuildInfo{Version:"v([0-9\.]*)",', out)
|
||||
installed_version = m.group(1)
|
||||
|
||||
message = "version installed: %s" % installed_version
|
||||
if LooseVersion(installed_version) < LooseVersion(version):
|
||||
message += " is lower than version %s" % version
|
||||
module.exit_json(changed=False, result=True, message=message)
|
||||
else:
|
||||
message += " is greater than version %s" % version
|
||||
module.exit_json(changed=False, result=False, message=message)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,3 +1,5 @@
|
||||
---
|
||||
dependencies:
|
||||
- setup_helm_version
|
||||
collections:
|
||||
- kubernetes.core
|
||||
|
||||
@@ -1,22 +1,11 @@
|
||||
---
|
||||
- name: Ensure helm is not installed
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
ansible.builtin.file:
|
||||
path: "/tmp/helm"
|
||||
state: absent
|
||||
with_items:
|
||||
- "/tmp/helm"
|
||||
|
||||
- name: Check failed if helm is not installed
|
||||
include_tasks: test_helm_not_installed.yml
|
||||
|
||||
- name: Install Helm v4
|
||||
ansible.builtin.include_role:
|
||||
name: install_helm
|
||||
vars:
|
||||
helm_version: v3.6.0
|
||||
|
||||
- name: Test helm uninstall
|
||||
ansible.builtin.include_tasks: test_helm_uninstall.yml
|
||||
ansible.builtin.include_tasks: test_helm_not_installed.yml
|
||||
|
||||
- name: Run tests
|
||||
include_tasks: run_test.yml
|
||||
ansible.builtin.include_tasks: run_test.yml
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
---
|
||||
- name: "Install {{ helm_version }}"
|
||||
include_role:
|
||||
name: install_helm
|
||||
|
||||
- name: Main helm tests
|
||||
block:
|
||||
- name: Install helm-diff plugin
|
||||
helm_plugin:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
plugin_path: https://github.com/databus23/helm-diff
|
||||
plugin_version: "{{ helm_version is version('v4.0.0', '>=') | ternary('v3.14.0', 'v3.10.0') }}"
|
||||
plugin_version: "{{ helm_version | string is ansible.builtin.version('4.0.0', '>=') | ternary('v3.14.0', 'v3.10.0') }}"
|
||||
verify: false
|
||||
|
||||
- name: "Ensure we honor the environment variables"
|
||||
include_tasks: test_read_envvars.yml
|
||||
ansible.builtin.include_tasks: test_read_envvars.yml
|
||||
|
||||
- name: Deploy charts
|
||||
include_tasks: "tests_chart/{{ test_chart_type }}.yml"
|
||||
ansible.builtin.include_tasks: "tests_chart/{{ test_chart_type }}.yml"
|
||||
loop_control:
|
||||
loop_var: test_chart_type
|
||||
with_items:
|
||||
@@ -24,30 +20,34 @@
|
||||
- from_repository
|
||||
- from_url
|
||||
|
||||
- name: test helm upgrade with reuse_values
|
||||
include_tasks: test_helm_reuse_values.yml
|
||||
- name: Test helm upgrade with reuse_values
|
||||
ansible.builtin.include_tasks: test_helm_reuse_values.yml
|
||||
|
||||
- name: test helm upgrade with reset_then_reuse_values
|
||||
include_tasks: test_helm_reset_then_reuse_values.yml
|
||||
- name: Test helm upgrade with reset_then_reuse_values
|
||||
ansible.builtin.include_tasks: test_helm_reset_then_reuse_values.yml
|
||||
when: helm_version | string is ansible.builtin.version('3.14.0', '>=')
|
||||
|
||||
- name: test helm dependency update
|
||||
include_tasks: test_up_dep.yml
|
||||
- name: Test helm dependency update
|
||||
ansible.builtin.include_tasks: test_up_dep.yml
|
||||
|
||||
- name: Test helm install with chart name containing space
|
||||
include_tasks: test_helm_with_space_into_chart_name.yml
|
||||
ansible.builtin.include_tasks: test_helm_with_space_into_chart_name.yml
|
||||
|
||||
# https://github.com/ansible-collections/community.kubernetes/issues/296
|
||||
- name: Test Skip CRDS feature in helm chart install
|
||||
include_tasks: test_crds.yml
|
||||
ansible.builtin.include_tasks: test_crds.yml
|
||||
|
||||
- name: Test insecure registry flag feature
|
||||
include_tasks: test_helm_insecure.yml
|
||||
ansible.builtin.include_tasks: test_helm_insecure.yml
|
||||
|
||||
- name: Test take ownership flag feature
|
||||
include_tasks: test_helm_take_ownership.yml
|
||||
ansible.builtin.include_tasks: test_helm_take_ownership.yml
|
||||
|
||||
- name: Test helm skip_schema_validation
|
||||
include_tasks: test_skip_schema_validation.yml
|
||||
ansible.builtin.include_tasks: test_skip_schema_validation.yml
|
||||
|
||||
- name: Test helm wait_for_jobs
|
||||
ansible.builtin.include_tasks: test_helm_wait_for_jobs.yml
|
||||
|
||||
always:
|
||||
- name: Remove helm-diff plugin
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
register: install
|
||||
|
||||
- name: Validate that insecure flag is not set
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
- '"--insecure-skip-tls-verify" not in install.command'
|
||||
@@ -30,18 +30,18 @@
|
||||
ignore_errors: true
|
||||
|
||||
- name: Validate that insecure flag IS set if helm version is >= 3.16.0
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
- '"--insecure-skip-tls-verify" in install.command'
|
||||
when: '"v3.16.0" <= helm_version'
|
||||
when: helm_version | string is ansible.builtin.version("3.16.0", ">=")
|
||||
|
||||
- name: Validate that feature fails for helm < 3.16.0
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is failed
|
||||
- '"insecure_skip_tls_verify requires helm >= 3.16.0" in install.msg'
|
||||
when: 'helm_version < "v3.16.0"'
|
||||
when: helm_version | string is ansible.builtin.version("3.16.0", "<")
|
||||
|
||||
always:
|
||||
- name: Remove helm namespace
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
- name: Failed test when helm is not installed
|
||||
helm:
|
||||
binary_path: "{{ helm_binary}}_fake"
|
||||
binary_path: "{{ helm_binary }}_fake"
|
||||
name: test
|
||||
chart_ref: "{{ chart_test }}"
|
||||
namespace: "helm-test"
|
||||
@@ -9,15 +9,7 @@
|
||||
register: helm_missing_binary
|
||||
|
||||
- name: Assert that helm is not installed
|
||||
assert:
|
||||
that:
|
||||
- helm_missing_binary is failed
|
||||
- "'No such file or directory' in helm_missing_binary.msg"
|
||||
when: ansible_version.full is version('2.20', '<')
|
||||
|
||||
- name: Assert that helm is not installed (ansible 2.20+)
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- helm_missing_binary is failed
|
||||
- "'Error executing command' in helm_missing_binary.msg"
|
||||
when: ansible_version.full is version('2.20', '>=')
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
register: release_value
|
||||
|
||||
- name: Validate that chart values are as expected
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
- '"--reset-then-reuse-values" not in install.command'
|
||||
@@ -80,7 +80,7 @@
|
||||
register: release_value
|
||||
|
||||
- name: Validate that chart values are as expected
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- upgrade is changed
|
||||
- '"--reset-then-reuse-values" in upgrade.command'
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
register: release_value
|
||||
|
||||
- name: Validate that chart values are as expected
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
- '"--reuse-values=True" not in install.command'
|
||||
@@ -72,7 +72,7 @@
|
||||
register: release_value
|
||||
|
||||
- name: Validate that chart values are as expected
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- upgrade is changed
|
||||
- '"--reuse-values=True" in upgrade.command'
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
register: install
|
||||
|
||||
- name: Validate that take-ownership flag is not set
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
- '"--take-ownership" not in install.command'
|
||||
@@ -50,18 +50,18 @@
|
||||
ignore_errors: true
|
||||
|
||||
- name: Validate that take-ownership flag IS set if helm version is >= 3.17.0
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- upgrade is changed
|
||||
- '"--take-ownership" in upgrade.command'
|
||||
when: '"v3.17.0" <= helm_version'
|
||||
when: helm_version | string is ansible.builtin.version("3.17.0", ">=")
|
||||
|
||||
- name: Validate that feature fails for helm < 3.17.0
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- upgrade is failed
|
||||
- '"take_ownership requires helm >= 3.17.0" in upgrade.msg'
|
||||
when: 'helm_version < "v3.17.0"'
|
||||
when: helm_version | string is ansible.builtin.version("3.17.0", "<")
|
||||
|
||||
- name: Upgrade chart (take-onwership flag not set)
|
||||
helm:
|
||||
@@ -79,18 +79,18 @@
|
||||
ignore_errors: true
|
||||
|
||||
- name: Validate that take-ownership flag IS set if helm version is >= 3.17.0
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- upgrade is changed
|
||||
- '"--take-ownership" not in upgrade.command'
|
||||
when: '"v3.17.0" <= helm_version'
|
||||
when: helm_version | string is ansible.builtin.version("3.17.0", ">=")
|
||||
|
||||
- name: Validate that feature fails for helm < 3.17.0
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- upgrade is changed
|
||||
- upgrade.msg is not defined
|
||||
when: 'helm_version < "v3.17.0"'
|
||||
when: helm_version | string is ansible.builtin.version("3.17.0", "<")
|
||||
|
||||
always:
|
||||
- name: Remove helm namespace
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
- name: validate helm version lower than 3.7.0
|
||||
helm_test_version:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
version: "3.7.0"
|
||||
register: test_version
|
||||
|
||||
- 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_name: "test-wait-uninstall"
|
||||
chart_name_pending: "test-uninstall-pending-release"
|
||||
helm_namespace: "{{ test_namespace[1] }}"
|
||||
block:
|
||||
|
||||
- name: Install chart
|
||||
helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
name: "{{ chart_name }}"
|
||||
chart_ref: "{{ chart_source }}"
|
||||
namespace: "{{ helm_namespace }}"
|
||||
create_namespace: true
|
||||
|
||||
- name: Delete chart with wait
|
||||
helm:
|
||||
state: absent
|
||||
binary_path: "{{ helm_binary }}"
|
||||
name: "{{ chart_name }}"
|
||||
namespace: "{{ helm_namespace }}"
|
||||
wait: yes
|
||||
register: uninstall
|
||||
|
||||
- name: assert warning has been raised
|
||||
assert:
|
||||
that:
|
||||
- uninstall.warnings is defined
|
||||
- '"helm uninstall support option --wait for helm release >= 3.7.0" in uninstall.warnings'
|
||||
|
||||
- name: Install Helm v4
|
||||
ansible.builtin.include_role:
|
||||
name: install_helm
|
||||
vars:
|
||||
helm_version: v4.0.0
|
||||
|
||||
- name: Install chart
|
||||
helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
name: "{{ chart_name }}"
|
||||
chart_ref: "{{ chart_source }}"
|
||||
namespace: "{{ helm_namespace }}"
|
||||
create_namespace: true
|
||||
|
||||
- name: uninstall chart again using recent version
|
||||
helm:
|
||||
state: absent
|
||||
binary_path: "{{ helm_binary }}"
|
||||
name: "{{ chart_name }}"
|
||||
namespace: "{{ helm_namespace }}"
|
||||
wait: yes
|
||||
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:
|
||||
- name: Remove namespace
|
||||
k8s:
|
||||
kind: Namespace
|
||||
name: "{{ helm_namespace }}"
|
||||
state: absent
|
||||
ignore_errors: true
|
||||
when: test_version.result
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
- name: Test helm wait_for_jobs
|
||||
vars:
|
||||
helm_namespace: "{{ test_namespace[15] }}"
|
||||
chart_local: "{{ role_path }}/files/test-chart-job"
|
||||
block:
|
||||
|
||||
- name: Install chart with wait and wait_for_jobs
|
||||
helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
chart_ref: "{{ chart_local }}"
|
||||
release_name: test-wait-for-jobs
|
||||
release_namespace: "{{ helm_namespace }}"
|
||||
create_namespace: true
|
||||
wait: true
|
||||
wait_for_jobs: true
|
||||
wait_timeout: "120s"
|
||||
register: install
|
||||
ignore_errors: true
|
||||
|
||||
- name: Validate wait_for_jobs with helm >= 3.5.0 works
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
- "'--wait' in install.command"
|
||||
- "'--wait-for-jobs' in install.command"
|
||||
when: "helm_version | string is ansible.builtin.version('3.5.0', '>=')"
|
||||
|
||||
- name: Validate wait_for_jobs with helm < 3.5.0 fails
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is failed
|
||||
- "'wait_for_jobs requires helm >= 3.5.0' in install.msg"
|
||||
when: "helm_version | string is ansible.builtin.version('3.5.0', '<')"
|
||||
|
||||
- name: Install chart with wait_for_jobs but without wait
|
||||
helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
chart_ref: "{{ chart_local }}"
|
||||
release_name: test-wait-for-jobs-no-wait
|
||||
release_namespace: "{{ helm_namespace }}"
|
||||
create_namespace: true
|
||||
wait_for_jobs: true
|
||||
register: install_no_wait
|
||||
|
||||
- name: Validate wait_for_jobs is ignored without wait
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install_no_wait is changed
|
||||
- "'--wait-for-jobs' not in install_no_wait.command"
|
||||
- "'--wait' not in install_no_wait.command"
|
||||
|
||||
always:
|
||||
- name: Remove helm namespace
|
||||
k8s:
|
||||
api_version: v1
|
||||
kind: Namespace
|
||||
name: "{{ helm_namespace }}"
|
||||
state: absent
|
||||
@@ -27,7 +27,7 @@
|
||||
register: install_chart
|
||||
|
||||
- name: Assert that chart is installed
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install_chart is changed
|
||||
- install_chart.status.status | lower == 'deployed'
|
||||
@@ -40,7 +40,7 @@
|
||||
register: chart_info
|
||||
|
||||
- name: Assert that Chart is installed (using helm_info)
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- chart_info.status.status | lower == 'deployed'
|
||||
|
||||
|
||||
@@ -22,22 +22,22 @@
|
||||
ignore_errors: true
|
||||
|
||||
- name: Debug install result
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: install
|
||||
|
||||
- name: Validate skip_schema_validation with helm >= 3.16.0 works
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
- "'--skip-schema-validation' in install.command"
|
||||
when: "helm_version is ansible.builtin.version('v3.16.0', '>=')"
|
||||
when: "helm_version | string is ansible.builtin.version('3.16.0', '>=')"
|
||||
|
||||
- name: Validate skip_schema_validation with helm < 3.16.0 fails
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is failed
|
||||
- "'skip_schema_validation requires helm >= 3.16.0' in install.msg"
|
||||
when: "helm_version is ansible.builtin.version('v3.16.0', '<')"
|
||||
when: "helm_version | string is ansible.builtin.version('3.16.0', '<')"
|
||||
|
||||
always:
|
||||
- name: Remove helm namespace
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
vars:
|
||||
helm_namespace: "{{ test_namespace[3] }}"
|
||||
block:
|
||||
- name: copy chart
|
||||
copy:
|
||||
- name: Copy chart
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
dest: /tmp
|
||||
loop:
|
||||
@@ -19,16 +19,16 @@
|
||||
chart_version: "{{ chart_source_version | default(omit) }}"
|
||||
namespace: "{{ helm_namespace }}"
|
||||
dependency_update: false
|
||||
create_namespace: yes
|
||||
create_namespace: true
|
||||
register: release
|
||||
|
||||
- name: "Get stats of the subchart"
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "/tmp/test-chart/Chart.lock"
|
||||
register: stat_result
|
||||
|
||||
- name: "Check if the subchart not exist in chart"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- not stat_result.stat.exists
|
||||
success_msg: "subchart not exist in the chart directory"
|
||||
@@ -41,12 +41,12 @@
|
||||
chart_ref: "/tmp/test-chart"
|
||||
chart_version: "{{ chart_source_version | default(omit) }}"
|
||||
namespace: "{{ helm_namespace }}"
|
||||
create_namespace: yes
|
||||
create_namespace: true
|
||||
dependency_update: true
|
||||
ignore_errors: true
|
||||
register: release
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- release.warnings[0] == "There is no dependencies block defined in Chart.yaml. Dependency update will not be performed. Please consider add dependencies block or disable dependency_update to remove this warning."
|
||||
success_msg: "warning when there is no dependencies block with dependency_update enabled"
|
||||
@@ -59,16 +59,16 @@
|
||||
chart_version: "{{ chart_source_version | default(omit) }}"
|
||||
namespace: "{{ helm_namespace }}"
|
||||
dependency_update: true
|
||||
create_namespace: yes
|
||||
create_namespace: true
|
||||
register: release
|
||||
|
||||
- name: "Get stats of the subchart"
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "/tmp/dep-up/Chart.lock"
|
||||
register: stat_result
|
||||
|
||||
- name: "Check if the subchart exists in chart"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- stat_result.stat.exists
|
||||
success_msg: "subchart exist in the chart directory"
|
||||
@@ -82,7 +82,7 @@
|
||||
state: absent
|
||||
|
||||
- name: "Remove charts"
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
state: absent
|
||||
path: "/tmp/{{ item }}"
|
||||
loop:
|
||||
@@ -92,8 +92,8 @@
|
||||
# Helm_template module
|
||||
- name: "Test dependency update for helm_template module"
|
||||
block:
|
||||
- name: copy chart
|
||||
copy:
|
||||
- name: Copy chart
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
dest: /tmp
|
||||
loop:
|
||||
@@ -110,7 +110,7 @@
|
||||
register: result
|
||||
|
||||
- name: "Get stats of the subchart"
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ item }}"
|
||||
register: stat_result
|
||||
loop:
|
||||
@@ -118,7 +118,7 @@
|
||||
- /tmp/dep_up/charts/test-chart/templates/configmap.yaml
|
||||
|
||||
- name: "Check if the subchart exist in chart"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- stat_result.results[0].stat.exists
|
||||
- stat_result.results[1].stat.exists
|
||||
@@ -135,7 +135,7 @@
|
||||
register: result
|
||||
|
||||
- name: "Get stats of the subchart"
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ item }}"
|
||||
register: stat_result
|
||||
loop:
|
||||
@@ -143,7 +143,7 @@
|
||||
- /tmp/test-chart/templates/configmap.yaml
|
||||
|
||||
- name: "Check if the subchart not exist in chart"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- not stat_result.results[0].stat.exists
|
||||
- stat_result.results[1].stat.exists
|
||||
@@ -152,7 +152,7 @@
|
||||
always:
|
||||
|
||||
- name: "Remove charts"
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
state: absent
|
||||
path: "/tmp/{{ item }}"
|
||||
loop:
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
chart_release_replaced_name: "test-{{ chart_name | default(source) }}-001"
|
||||
block:
|
||||
- name: Create temp directory
|
||||
tempfile:
|
||||
ansible.builtin.tempfile:
|
||||
state: directory
|
||||
register: tmpdir
|
||||
|
||||
- name: Set temp directory fact
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
temp_dir: "{{ tmpdir.path }}"
|
||||
|
||||
- name: Check helm_info empty
|
||||
@@ -21,7 +21,7 @@
|
||||
register: empty_info
|
||||
|
||||
- name: "Assert that no charts are installed with helm_info"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- empty_info.status is undefined
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
register: install_fail
|
||||
|
||||
- name: "Assert that Install fail {{ chart_test }} from {{ source }}"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install_fail is failed
|
||||
- "'Error: create: failed to create: namespaces \"' + helm_namespace + '\" not found' in install_fail.stderr"
|
||||
@@ -53,7 +53,7 @@
|
||||
check_mode: true
|
||||
|
||||
- name: "Assert that {{ chart_test }} chart is installed from {{ source }} in check mode"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install_check_mode is changed
|
||||
- install_check_mode.status is defined
|
||||
@@ -70,7 +70,7 @@
|
||||
register: install
|
||||
|
||||
- name: "Assert that {{ chart_test }} chart version {{ chart_test_version }} is installed from {{ source }}"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
- install.status.chart == chart_test+"-"+chart_test_version
|
||||
@@ -94,7 +94,7 @@
|
||||
register: release_state_content_info
|
||||
|
||||
- name: "Assert that {{ chart_test }} chart version {{ chart_test_version }} is installed from {{ source }} with helm_info"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- content_info.status.chart == chart_test+"-"+chart_test_version
|
||||
- content_info.status.status | lower == 'deployed'
|
||||
@@ -111,7 +111,7 @@
|
||||
diff: true
|
||||
|
||||
- name: Assert idempotency
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is not changed
|
||||
- install.status.chart == chart_test+"-"+chart_test_version
|
||||
@@ -128,7 +128,7 @@
|
||||
register: install
|
||||
|
||||
- name: "Assert that {{ chart_test }} chart is upgraded with new var from {{ source }}"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
- install.status.status | lower == 'deployed'
|
||||
@@ -147,7 +147,7 @@
|
||||
diff: true
|
||||
|
||||
- name: Assert idempotency after add vars
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is not changed
|
||||
- install.status.status | lower == 'deployed'
|
||||
@@ -164,7 +164,7 @@
|
||||
register: install
|
||||
|
||||
- name: "Assert that {{ chart_test }} chart is upgraded with new var from {{ source }}"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
- install.status.status | lower == 'deployed'
|
||||
@@ -182,7 +182,7 @@
|
||||
diff: true
|
||||
|
||||
- name: Assert idempotency after removing vars
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is not changed
|
||||
- install.status.status | lower == 'deployed'
|
||||
@@ -199,7 +199,7 @@
|
||||
register: install
|
||||
|
||||
- name: "Assert that {{ chart_test }} chart is upgraded with new version from {{ source }}"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
- install.status.status | lower == 'deployed'
|
||||
@@ -216,7 +216,7 @@
|
||||
diff: true
|
||||
|
||||
- name: Assert idempotency after upgrade
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is not changed
|
||||
- install.status.status | lower == 'deployed'
|
||||
@@ -231,7 +231,7 @@
|
||||
register: install
|
||||
|
||||
- name: "Assert that {{ chart_test }} chart is removed from {{ source }}"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
|
||||
@@ -245,7 +245,7 @@
|
||||
diff: true
|
||||
|
||||
- name: Assert idempotency
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is not changed
|
||||
|
||||
@@ -260,7 +260,7 @@
|
||||
register: install
|
||||
|
||||
- name: "Assert that {{ chart_test }} chart is installed from {{ source }}"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
|
||||
@@ -269,12 +269,12 @@
|
||||
binary_path: "{{ helm_binary }}"
|
||||
state: absent
|
||||
name: "{{ chart_release_replaced_name }}"
|
||||
purge: False
|
||||
purge: false
|
||||
namespace: "{{ helm_namespace }}"
|
||||
register: install
|
||||
|
||||
- name: Check if chart is removed
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
|
||||
@@ -285,11 +285,11 @@
|
||||
chart_ref: "{{ chart_source }}"
|
||||
chart_version: "{{ chart_test_version }}"
|
||||
namespace: "{{ helm_namespace }}"
|
||||
replace: True
|
||||
replace: true
|
||||
register: install
|
||||
|
||||
- name: "Assert that {{ chart_test }} chart is installed from {{ source }}"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
|
||||
@@ -302,7 +302,7 @@
|
||||
register: install
|
||||
|
||||
- name: Check if chart is removed
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
|
||||
@@ -318,7 +318,7 @@
|
||||
register: install
|
||||
|
||||
- name: "Assert that {{ chart_test }} chart has var from {{ source }}"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
- install.status.status | lower == 'deployed'
|
||||
@@ -337,7 +337,7 @@
|
||||
register: install
|
||||
|
||||
- name: "Assert the result is consistent"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- not (install is changed)
|
||||
|
||||
@@ -358,7 +358,7 @@
|
||||
- "{{ role_path }}/files/values.yaml"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result is not failed
|
||||
@@ -366,11 +366,11 @@
|
||||
- result.command is match(helm_binary+" template "+chart_source)
|
||||
|
||||
- name: Check templates created
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ temp_dir }}/{{ chart_test }}/templates"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
result.stat.exists
|
||||
|
||||
@@ -379,7 +379,7 @@
|
||||
binary_path: "{{ helm_binary }}"
|
||||
chart_ref: "{{ chart_source }}"
|
||||
chart_version: "{{ chart_test_version }}"
|
||||
disable_hook: True
|
||||
disable_hook: true
|
||||
release_name: "myrelease"
|
||||
release_namespace: "myreleasenamespace"
|
||||
show_only:
|
||||
@@ -389,7 +389,7 @@
|
||||
register: result
|
||||
when: chart_source is search("test-chart")
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result is not failed
|
||||
@@ -412,14 +412,14 @@
|
||||
register: result
|
||||
|
||||
- name: Assert that release fails with non-existent context
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result is failed
|
||||
- "'context \"does-not-exist\" does not exist' in result.stderr"
|
||||
|
||||
always:
|
||||
- name: Clean up temp dir
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
state: absent
|
||||
path: "{{ temp_dir }}"
|
||||
ignore_errors: true
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
---
|
||||
helm_binary: "/tmp/helm/{{ ansible_system | lower }}-amd64/helm"
|
||||
helm_namespace: helm-diff
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
dependencies:
|
||||
- remove_namespace
|
||||
- install_helm
|
||||
- setup_helm_registry
|
||||
- setup_helm
|
||||
- setup_helm_version
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
---
|
||||
- connection: local
|
||||
gather_facts: true
|
||||
hosts: localhost
|
||||
|
||||
roles:
|
||||
- helm_diff
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eux
|
||||
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
|
||||
export ANSIBLE_ROLES_PATH=../
|
||||
ansible-playbook playbook.yaml "$@"
|
||||
@@ -1,4 +1,8 @@
|
||||
---
|
||||
- name: Define default value for helm binary path
|
||||
ansible.builtin.set_fact:
|
||||
helm_binary: "{{ setup_helm_binary_path | default('helm') }}"
|
||||
|
||||
- name: Test helm diff functionality
|
||||
vars:
|
||||
test_chart_ref: "/tmp/test-chart"
|
||||
@@ -10,10 +14,11 @@
|
||||
binary_path: "{{ helm_binary }}"
|
||||
state: present
|
||||
plugin_path: https://github.com/databus23/helm-diff
|
||||
plugin_version: 3.9.13
|
||||
verify: false
|
||||
plugin_version: "{{ helm_version | string is ansible.builtin.version('4.0.0', '>=') | ternary('3.14.0', '3.10.0') }}"
|
||||
|
||||
- name: Copy test chart
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: "test-chart/"
|
||||
dest: "{{ test_chart_ref }}"
|
||||
|
||||
@@ -26,13 +31,13 @@
|
||||
create_namespace: true
|
||||
register: install
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
|
||||
- name: Modify local chart
|
||||
blockinfile:
|
||||
create: yes
|
||||
ansible.builtin.blockinfile:
|
||||
create: true
|
||||
path: "{{ test_chart_ref }}/templates/anothermap.yaml"
|
||||
block: !unsafe |
|
||||
apiVersion: v1
|
||||
@@ -55,7 +60,7 @@
|
||||
- name: Check if helm diff check is correct
|
||||
vars:
|
||||
foo_bar_value: "+ foo: bar"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- foo_bar_value in diff_result.diff.prepared
|
||||
|
||||
@@ -67,7 +72,7 @@
|
||||
chart_ref: "{{ test_chart_ref }}"
|
||||
register: install
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
|
||||
@@ -77,12 +82,12 @@
|
||||
name: test-chart
|
||||
namespace: "{{ helm_namespace }}"
|
||||
chart_ref: "{{ test_chart_ref }}"
|
||||
check_mode: yes
|
||||
check_mode: true
|
||||
diff: true
|
||||
register: diff_result
|
||||
|
||||
- name: Check if no diff in check mode when no change
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- '"diff" not in diff_result'
|
||||
|
||||
@@ -94,12 +99,12 @@
|
||||
chart_ref: "{{ test_chart_ref }}"
|
||||
register: install
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- install is not changed
|
||||
|
||||
- name: Modify values
|
||||
blockinfile:
|
||||
ansible.builtin.blockinfile:
|
||||
create: true
|
||||
path: "{{ test_chart_ref }}/values.yml"
|
||||
block: |
|
||||
@@ -116,7 +121,7 @@
|
||||
- "{{ test_chart_ref }}/values.yml"
|
||||
register: install
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
|
||||
@@ -130,7 +135,7 @@
|
||||
- "{{ test_chart_ref }}/values.yml"
|
||||
register: install
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- install is not changed
|
||||
|
||||
@@ -146,7 +151,7 @@
|
||||
- "{{ test_chart_ref }}/values.yml"
|
||||
register: install
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
|
||||
@@ -162,7 +167,7 @@
|
||||
- "{{ test_chart_ref }}/values.yml"
|
||||
register: install
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- install is not changed
|
||||
|
||||
@@ -181,7 +186,7 @@
|
||||
value_type: string
|
||||
register: install
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- install is changed
|
||||
|
||||
@@ -200,7 +205,7 @@
|
||||
value_type: string
|
||||
register: install
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- install is not changed
|
||||
|
||||
@@ -213,7 +218,7 @@
|
||||
ignore_errors: true
|
||||
|
||||
- name: Define chart variables
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
test_chart_values:
|
||||
myValue: 'Some ConfigMap data value'
|
||||
myConfigmapName: 'ansible-config-from-url'
|
||||
@@ -247,7 +252,9 @@
|
||||
path: '{{ _tmpd.path }}'
|
||||
|
||||
- name: Log into Helm registry
|
||||
ansible.builtin.command: "{{ helm_binary }} registry login -u testuser -p 'pass123!' localhost:6035"
|
||||
ansible.builtin.shell: >-
|
||||
echo 'pass123!' | {{ helm_binary }} registry login -u testuser --password-stdin localhost:6035
|
||||
{{ helm_version | string is ansible.builtin.version("3.18.0", ">=") | ternary('--plain-http', '--insecure') }}
|
||||
|
||||
- name: Install chart from remote URL
|
||||
helm:
|
||||
@@ -257,6 +264,7 @@
|
||||
namespace: "{{ helm_namespace }}"
|
||||
name: another-chart
|
||||
release_values: "{{ test_chart_values }}"
|
||||
plain_http: "{{ helm_version | string is ansible.builtin.version('3.13.0', '>=') }}"
|
||||
|
||||
- name: Upgrade chart
|
||||
helm:
|
||||
@@ -266,44 +274,21 @@
|
||||
namespace: "{{ helm_namespace }}"
|
||||
name: another-chart
|
||||
release_values: "{{ test_chart_values }}"
|
||||
plain_http: "{{ helm_version | string is ansible.builtin.version('3.13.0', '>=') }}"
|
||||
check_mode: true
|
||||
register: _upgrade
|
||||
|
||||
- name: Assert that module raised a warning
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- not _upgrade.changed
|
||||
- _upgrade.warnings is defined
|
||||
- _upgrade.warnings | length == 1
|
||||
- _upgrade.warnings[0] == "The default idempotency check can fail to report changes in certain cases. Install helm diff >= 3.4.1 for better results."
|
||||
|
||||
- name: Install helm diff (version=3.4.1)
|
||||
helm_plugin:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
state: present
|
||||
plugin_path: https://github.com/databus23/helm-diff
|
||||
plugin_version: 3.4.1
|
||||
|
||||
- name: Upgrade chart once again
|
||||
helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
chart_ref: "{{ test_chart_ref_url }}"
|
||||
chart_version: 0.1.0
|
||||
namespace: "{{ helm_namespace }}"
|
||||
name: another-chart
|
||||
release_values: "{{ test_chart_values }}"
|
||||
check_mode: true
|
||||
register: _upgrade_2
|
||||
|
||||
- name: Assert that module raised a warning
|
||||
assert:
|
||||
that:
|
||||
- _upgrade_2.changed
|
||||
- _upgrade_2.warnings is not defined
|
||||
|
||||
always:
|
||||
- name: Remove chart directory
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ test_chart_ref }}"
|
||||
state: absent
|
||||
ignore_errors: true
|
||||
@@ -324,6 +309,7 @@
|
||||
wait: true
|
||||
ignore_errors: true
|
||||
|
||||
- include_tasks: reuse_values.yml
|
||||
- ansible.builtin.include_tasks: reuse_values.yml
|
||||
|
||||
- include_tasks: reset_then_reuse_values.yml
|
||||
- ansible.builtin.include_tasks: reset_then_reuse_values.yml
|
||||
when: helm_version | string is ansible.builtin.version('3.8.0', '>')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Create temporary directory for helm chart
|
||||
tempfile:
|
||||
ansible.builtin.tempfile:
|
||||
suffix: .helm
|
||||
state: directory
|
||||
register: helm_dir
|
||||
@@ -16,7 +16,8 @@
|
||||
binary_path: "{{ helm_binary }}"
|
||||
state: present
|
||||
plugin_path: https://github.com/databus23/helm-diff
|
||||
plugin_version: 3.9.14
|
||||
verify: false
|
||||
plugin_version: "{{ helm_version | string is ansible.builtin.version('4.0.0', '>=') | ternary('3.14.0', '3.10.0') }}"
|
||||
|
||||
- name: Copy test chart
|
||||
ansible.builtin.copy:
|
||||
@@ -58,7 +59,7 @@
|
||||
register: helm_upgrade
|
||||
|
||||
- name: Ensure task did not reported change
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- helm_upgrade is not changed
|
||||
|
||||
@@ -75,7 +76,7 @@
|
||||
register: helm_upgrade
|
||||
|
||||
- name: Ensure task reported change
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- helm_upgrade is changed
|
||||
|
||||
@@ -88,19 +89,24 @@
|
||||
ignore_errors: true
|
||||
|
||||
- name: Delete Helm folders
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: /tmp/helm/
|
||||
state: absent
|
||||
|
||||
- name: Install old version of helm
|
||||
ansible.builtin.include_role:
|
||||
name: install_helm
|
||||
name: setup_helm
|
||||
vars:
|
||||
helm_version: "v3.8.0"
|
||||
setup_helm_version: "v3.8.0"
|
||||
helm_install_path: "{{ helm_dir.path }}/helm_v3_8_0"
|
||||
|
||||
- name: Set path to helm binary v3.8.0
|
||||
ansible.builtin.set_fact:
|
||||
helm_binary_path_v3_8_0: "{{ helm_dir.path }}/helm_v3_8_0/helm"
|
||||
|
||||
- name: Upgrade helm release (with reset_then_reuse_values=true)
|
||||
kubernetes.core.helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
binary_path: "{{ helm_binary_path_v3_8_0 }}"
|
||||
chart_ref: "{{ test_chart_path }}"
|
||||
reuse_values: false
|
||||
reset_then_reuse_values: true
|
||||
@@ -112,25 +118,26 @@
|
||||
ignore_errors: true
|
||||
|
||||
- name: Debug
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: helm_upgrade
|
||||
|
||||
- name: Ensure warning for Helm version
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- helm_upgrade is failed
|
||||
- '"reset_then_reuse_values requires helm >= 3.14.0, current version is" in helm_upgrade.msg'
|
||||
|
||||
- name: Install helm diff
|
||||
helm_plugin:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
binary_path: "{{ helm_binary_path_v3_8_0 }}"
|
||||
state: present
|
||||
plugin_path: https://github.com/databus23/helm-diff
|
||||
plugin_version: "3.8.0"
|
||||
verify: false
|
||||
|
||||
- name: Upgrade helm release (with reset_then_reuse_values=true)
|
||||
kubernetes.core.helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
binary_path: "{{ helm_binary_path_v3_8_0 }}"
|
||||
chart_ref: "{{ test_chart_path }}"
|
||||
reuse_values: false
|
||||
reset_then_reuse_values: true
|
||||
@@ -142,23 +149,23 @@
|
||||
ignore_errors: true
|
||||
|
||||
- name: Debug
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: helm_upgrade
|
||||
|
||||
- name: Ensure warning for Helm Diff version
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- helm_upgrade is failed
|
||||
- '"reset_then_reuse_values requires helm diff >= 3.9.12, current version is" in helm_upgrade.msg'
|
||||
|
||||
always:
|
||||
- name: Delete Helm folders
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: /tmp/helm/
|
||||
state: absent
|
||||
|
||||
- name: Remove temporary directory
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ helm_dir.path }}"
|
||||
state: absent
|
||||
ignore_errors: true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Create temporary directory for helm chart
|
||||
tempfile:
|
||||
ansible.builtin.tempfile:
|
||||
suffix: .helm
|
||||
state: directory
|
||||
register: helm_dir
|
||||
@@ -17,7 +17,8 @@
|
||||
binary_path: "{{ helm_binary }}"
|
||||
state: present
|
||||
plugin_path: https://github.com/databus23/helm-diff
|
||||
plugin_version: 3.9.4
|
||||
verify: false
|
||||
plugin_version: "{{ helm_version | string is ansible.builtin.version('4.0.0', '>=') | ternary('3.14.0', '3.10.0') }}"
|
||||
|
||||
- name: Copy test chart
|
||||
ansible.builtin.copy:
|
||||
@@ -50,7 +51,7 @@
|
||||
register: helm_upgrade
|
||||
|
||||
- name: Ensure task did not reported change
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- helm_upgrade is not changed
|
||||
|
||||
@@ -66,7 +67,7 @@
|
||||
register: helm_upgrade
|
||||
|
||||
- name: Ensure task reported change
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- helm_upgrade is changed
|
||||
|
||||
|
||||
@@ -4,7 +4,4 @@ test_namespace:
|
||||
- "helm-in-memory-kubeconfig"
|
||||
- "helm-kubeconfig-with-ca-cert"
|
||||
- "helm-kubeconfig-with-insecure-skip-tls-verify"
|
||||
helm_versions:
|
||||
- v3.10.3
|
||||
- v3.16.4
|
||||
- v4.0.0
|
||||
helm_binary: helm
|
||||
|
||||
@@ -1,5 +1,2 @@
|
||||
---
|
||||
- ansible.builtin.include_tasks: run_tests.yml
|
||||
loop: "{{ helm_versions }}"
|
||||
loop_control:
|
||||
loop_var: helm_version
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
---
|
||||
- name: Run tests with helm version "{{ helm_version }}"
|
||||
- name: Run tests
|
||||
block:
|
||||
- name: "Install Helm"
|
||||
ansible.builtin.include_role:
|
||||
name: install_helm
|
||||
|
||||
- name: Test helm with in-memory kubeconfig
|
||||
ansible.builtin.include_tasks: "from_in_memory_kubeconfig.yml"
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
time=10
|
||||
helm
|
||||
helm_template
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
helm_oci_namespace: helm-oci-registry-progress
|
||||
test_namespace: "{{ helm_oci_namespace }}"
|
||||
|
||||
# Matches the registry stood up by the setup_helm_registry role.
|
||||
helm_oci_registry: "localhost:6035"
|
||||
helm_oci_registry_username: testuser
|
||||
helm_oci_registry_password: 'pass123!'
|
||||
helm_oci_repo_path: testing
|
||||
|
||||
helm_oci_chart_name: test-chart-plus-version
|
||||
# '+' is not allowed in an OCI tag, so Helm stores this as '1.0.0_build.1'.
|
||||
helm_oci_chart_version: 1.0.0+build.1
|
||||
# A version without build metadata, to cover the case where the progress messages
|
||||
# happen to be valid YAML and so corrupt the parsed output silently.
|
||||
helm_oci_chart_version_plain: 1.0.1
|
||||
helm_binary: "helm"
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: test-chart-plus-version
|
||||
description: A chart whose version carries semver build metadata
|
||||
type: application
|
||||
version: 1.0.0+build.1
|
||||
appVersion: "default"
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: test-chart-plus-version-configmap
|
||||
data:
|
||||
myValue: test
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
dependencies:
|
||||
- remove_namespace
|
||||
- setup_helm_registry
|
||||
- setup_helm_version
|
||||
@@ -0,0 +1,155 @@
|
||||
---
|
||||
# Regression test for https://github.com/ansible-collections/kubernetes.core/issues/1222
|
||||
#
|
||||
# Helm >= 4.2.1 writes OCI registry progress messages to stdout rather than stderr
|
||||
# (helm/helm#32056): 'Pulled:', 'Digest:' and, when the reference contains an
|
||||
# underscore, a free-text explanation. Helm rewrites '+' to '_' in OCI tags, so a
|
||||
# chart version carrying semver build metadata is what triggers that explanation,
|
||||
# which is not valid YAML.
|
||||
#
|
||||
# The helm module parses the stdout of 'helm show chart', and helm_template returns
|
||||
# the stdout of 'helm template' as its documented result, so both have to skip those
|
||||
# messages. Without the fix, the helm task below fails with
|
||||
# "could not find expected ':'".
|
||||
- name: Test OCI charts whose version contains build metadata
|
||||
# Helm >= 4.2.1 is required for this test to be meaningful: that is the release which
|
||||
# moved the OCI registry progress messages from stderr to stdout (helm/helm#32056).
|
||||
when: helm_version | string is ansible.builtin.version('4.2.1', '>=')
|
||||
vars:
|
||||
chart_ref: "oci://{{ helm_oci_registry }}/{{ helm_oci_repo_path }}/{{ helm_oci_chart_name }}"
|
||||
block:
|
||||
- name: Create temporary directory to hold the chart
|
||||
ansible.builtin.tempfile:
|
||||
state: directory
|
||||
suffix: .chart
|
||||
register: _tmpd
|
||||
|
||||
- name: Copy the test chart
|
||||
ansible.builtin.copy:
|
||||
src: "{{ helm_oci_chart_name }}"
|
||||
dest: "{{ _tmpd.path }}/"
|
||||
|
||||
- name: Log into the helm registry
|
||||
ansible.builtin.command: >-
|
||||
{{ helm_binary }} registry login --plain-http
|
||||
-u {{ helm_oci_registry_username }} -p {{ helm_oci_registry_password }}
|
||||
{{ helm_oci_registry }}
|
||||
|
||||
- name: Package and push both chart versions
|
||||
ansible.builtin.command: "{{ item }}"
|
||||
loop:
|
||||
- >-
|
||||
{{ helm_binary }} package {{ _tmpd.path }}/{{ helm_oci_chart_name }}
|
||||
--version {{ helm_oci_chart_version }} --destination {{ _tmpd.path }}
|
||||
- >-
|
||||
{{ helm_binary }} package {{ _tmpd.path }}/{{ helm_oci_chart_name }}
|
||||
--version {{ helm_oci_chart_version_plain }} --destination {{ _tmpd.path }}
|
||||
- >-
|
||||
{{ helm_binary }} push --plain-http
|
||||
{{ _tmpd.path }}/{{ helm_oci_chart_name }}-{{ helm_oci_chart_version }}.tgz
|
||||
oci://{{ helm_oci_registry }}/{{ helm_oci_repo_path }}
|
||||
- >-
|
||||
{{ helm_binary }} push --plain-http
|
||||
{{ _tmpd.path }}/{{ helm_oci_chart_name }}-{{ helm_oci_chart_version_plain }}.tgz
|
||||
oci://{{ helm_oci_registry }}/{{ helm_oci_repo_path }}
|
||||
register: _push
|
||||
|
||||
- name: Ensure Helm stored the build metadata version with an underscore
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'1.0.0_build.1' in (_push.results[2].stdout + _push.results[2].stderr)"
|
||||
fail_msg: >-
|
||||
Expected Helm to rewrite '+' to '_' when pushing the chart tag. Without
|
||||
that rewrite this target no longer covers the case it was written for.
|
||||
|
||||
# helm - the version with build metadata is the case that failed outright.
|
||||
- name: Install the chart from the OCI registry
|
||||
kubernetes.core.helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
name: "{{ helm_oci_chart_name }}"
|
||||
chart_ref: "{{ chart_ref }}"
|
||||
chart_version: "{{ helm_oci_chart_version }}"
|
||||
release_namespace: "{{ helm_oci_namespace }}"
|
||||
create_namespace: true
|
||||
plain_http: true
|
||||
register: _install
|
||||
|
||||
- name: Ensure the release reports the chart version verbatim
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- _install is changed
|
||||
- _install.status.chart == helm_oci_chart_name ~ '-' ~ helm_oci_chart_version
|
||||
|
||||
- name: Install the same chart again
|
||||
kubernetes.core.helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
name: "{{ helm_oci_chart_name }}"
|
||||
chart_ref: "{{ chart_ref }}"
|
||||
chart_version: "{{ helm_oci_chart_version }}"
|
||||
release_namespace: "{{ helm_oci_namespace }}"
|
||||
plain_http: true
|
||||
register: _reinstall
|
||||
|
||||
- name: Ensure the module is idempotent
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- _reinstall is not changed
|
||||
|
||||
# helm_template - stdout is documented to hold only the rendered templates. Both
|
||||
# chart versions are checked: the plain one covers the case where the progress
|
||||
# messages are valid YAML and would otherwise be parsed as a manifest.
|
||||
- name: Render the chart from the OCI registry
|
||||
kubernetes.core.helm_template:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
chart_ref: "{{ chart_ref }}"
|
||||
chart_version: "{{ item }}"
|
||||
release_name: "{{ helm_oci_chart_name }}"
|
||||
plain_http: true
|
||||
loop:
|
||||
- "{{ helm_oci_chart_version }}"
|
||||
- "{{ helm_oci_chart_version_plain }}"
|
||||
register: _template
|
||||
|
||||
- name: Ensure stdout holds the rendered manifests and nothing else
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'Pulled:' not in item.stdout"
|
||||
- "'Digest:' not in item.stdout"
|
||||
- "'contains an underscore' not in item.stdout"
|
||||
- item.stdout.startswith('---')
|
||||
- (item.stdout | from_yaml_all | list | map(attribute='kind') | list) == ['ConfigMap']
|
||||
fail_msg: "helm_template stdout was not only rendered manifests: {{ item.stdout[:200] }}"
|
||||
loop: "{{ _template.results }}"
|
||||
loop_control:
|
||||
label: "{{ item.item }}"
|
||||
|
||||
always:
|
||||
- name: Uninstall the release
|
||||
kubernetes.core.helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
name: "{{ helm_oci_chart_name }}"
|
||||
release_namespace: "{{ helm_oci_namespace }}"
|
||||
state: absent
|
||||
when: helm_binary is defined
|
||||
ignore_errors: true
|
||||
|
||||
- name: Remove the test namespace
|
||||
kubernetes.core.k8s:
|
||||
api_version: v1
|
||||
kind: Namespace
|
||||
name: "{{ helm_oci_namespace }}"
|
||||
state: absent
|
||||
wait: true
|
||||
ignore_errors: true
|
||||
|
||||
- name: Log out of the helm registry
|
||||
ansible.builtin.command: "{{ helm_binary }} registry logout {{ helm_oci_registry }}"
|
||||
when: helm_binary is defined
|
||||
ignore_errors: true
|
||||
|
||||
- name: Remove the temporary directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ _tmpd.path }}"
|
||||
state: absent
|
||||
when: _tmpd is defined and _tmpd.path is defined
|
||||
ignore_errors: true
|
||||
@@ -1 +0,0 @@
|
||||
redis*
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
helm_binary: helm
|
||||
setup_helm_version_binary_path: "{{ helm_binary }}"
|
||||
test_namespace: helm-plain-http
|
||||
|
||||
# Matches the plain-HTTP registry stood up by the setup_helm_registry role.
|
||||
registry_host: "localhost:6035"
|
||||
registry_username: testuser
|
||||
registry_password: 'pass123!'
|
||||
registry_repo_path: testing
|
||||
chart_name: test-chart-plain-http
|
||||
chart_version: "0.1.0"
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: test-chart-plain-http
|
||||
description: A minimal chart used to exercise plain_http against a plain-HTTP OCI registry
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "default"
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: test-chart-plain-http-configmap
|
||||
data:
|
||||
myValue: test
|
||||
@@ -1,4 +0,0 @@
|
||||
[all]
|
||||
helm-3.12.3 helm_version=v3.12.3 test_namespace=helm-plain-http-v3-12-3 tests_should_failed=true
|
||||
helm-3.18.2 helm_version=v3.18.2 test_namespace=helm-plain-http-v3-18-2 tests_should_failed=false
|
||||
helm-4.0.0 helm_version=v4.0.0 test_namespace=helm-plain-http-v4-0-0 tests_should_failed=false
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
dependencies:
|
||||
- setup_namespace
|
||||
- setup_helm_registry
|
||||
- setup_helm_version
|
||||
@@ -1,15 +0,0 @@
|
||||
- name: Run test for helm plain http option
|
||||
hosts: all
|
||||
gather_facts: true
|
||||
strategy: free
|
||||
|
||||
vars:
|
||||
ansible_connection: local
|
||||
ansible_python_interpreter: "{{ ansible_playbook_python }}"
|
||||
chart_test_oci: "oci://registry-1.docker.io/bitnamicharts/redis"
|
||||
|
||||
roles:
|
||||
- role: setup_namespace
|
||||
|
||||
tasks:
|
||||
- ansible.builtin.include_tasks: tasks/test.yaml
|
||||
@@ -1,95 +0,0 @@
|
||||
---
|
||||
- name: Run test for helm
|
||||
block:
|
||||
- name: Create temporary directory to install chart In
|
||||
ansible.builtin.tempfile:
|
||||
state: directory
|
||||
suffix: .helm
|
||||
register: install_path
|
||||
|
||||
- name: Install required helm version
|
||||
ansible.builtin.include_role:
|
||||
name: install_helm
|
||||
vars:
|
||||
helm_install_path: "{{ install_path.path }}"
|
||||
|
||||
# helm
|
||||
- name: Run helm with plain_http
|
||||
kubernetes.core.helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
chart_ref: "{{ chart_test_oci }}"
|
||||
release_name: test-secure
|
||||
release_namespace: "{{ test_namespace }}"
|
||||
create_namespace: true
|
||||
plain_http: true
|
||||
register: install_chart
|
||||
ignore_errors: true
|
||||
|
||||
- name: Ensure module failed as expected
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install_chart is failed
|
||||
- '"plain_http requires helm >= 3.13.0" in install_chart.msg'
|
||||
when: tests_should_failed | bool
|
||||
|
||||
- name: Ensure the result command contains the expected option
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install_chart is not failed
|
||||
- '"--plain-http" in install_chart.command'
|
||||
when: not (tests_should_failed | bool)
|
||||
|
||||
# helm_pull
|
||||
- name: Trying to download helm chart with option plain_http
|
||||
kubernetes.core.helm_pull:
|
||||
chart_ref: "{{ chart_test_oci }}"
|
||||
destination: "{{ playbook_dir }}"
|
||||
binary_path: "{{ helm_binary }}"
|
||||
plain_http: true
|
||||
register: pull_chart
|
||||
ignore_errors: true
|
||||
|
||||
- name: Ensure module failed as expected
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- pull_chart is failed
|
||||
- '"plain_http requires helm >= 3.13.0" in pull_chart.msg'
|
||||
when: tests_should_failed | bool
|
||||
|
||||
- name: Ensure the result command contains the expected option
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- pull_chart is not failed
|
||||
- '"--plain-http" in pull_chart.command'
|
||||
when: not (tests_should_failed | bool)
|
||||
|
||||
# helm_template
|
||||
- name: Test helm render template
|
||||
kubernetes.core.helm_template:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
chart_ref: "{{ chart_test_oci }}"
|
||||
output_dir: "{{ playbook_dir }}"
|
||||
plain_http: true
|
||||
register: template
|
||||
ignore_errors: true
|
||||
|
||||
- name: Ensure module failed as expected
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- template is failed
|
||||
- '"plain_http requires helm >= 3.13.0" in template.msg'
|
||||
when: tests_should_failed | bool
|
||||
|
||||
- name: Ensure the result command contains the expected option
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- template is not failed
|
||||
- '"--plain-http" in template.command'
|
||||
when: not (tests_should_failed | bool)
|
||||
|
||||
always:
|
||||
- name: Delete temporary file
|
||||
ansible.builtin.file:
|
||||
path: "{{ install_path.path }}"
|
||||
state: absent
|
||||
ignore_errors: true
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eux
|
||||
export ANSIBLE_ROLES_PATH=../
|
||||
ansible-playbook playbooks/play.yaml -i inventory.ini "$@"
|
||||
@@ -0,0 +1,167 @@
|
||||
---
|
||||
- name: Test plain_http against a plain-HTTP OCI registry
|
||||
vars:
|
||||
plain_http_supported: "{{ helm_version | string is ansible.builtin.version('3.13.0', '>=') }}"
|
||||
chart_ref_oci: "oci://{{ registry_host }}/{{ registry_repo_path }}/{{ chart_name }}"
|
||||
block:
|
||||
- name: Create a temporary directory to hold the chart
|
||||
ansible.builtin.tempfile:
|
||||
state: directory
|
||||
suffix: .chart
|
||||
register: _tmpd
|
||||
|
||||
# helm < 3.13.0 cannot talk to a plain-HTTP OCI registry: the modules reject
|
||||
# plain_http before issuing any helm command, so no chart has to be present.
|
||||
- name: Ensure plain_http is rejected on unsupported helm versions
|
||||
when: not (plain_http_supported | bool)
|
||||
block:
|
||||
- name: Attempt helm install with plain_http
|
||||
kubernetes.core.helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
chart_ref: "{{ chart_ref_oci }}"
|
||||
chart_version: "{{ chart_version }}"
|
||||
release_name: test-secure
|
||||
release_namespace: "{{ test_namespace }}"
|
||||
create_namespace: true
|
||||
plain_http: true
|
||||
register: install_chart
|
||||
ignore_errors: true
|
||||
|
||||
- name: Ensure helm failed with the version error
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install_chart is failed
|
||||
- '"plain_http requires helm >= 3.13.0" in install_chart.msg'
|
||||
|
||||
- name: Attempt helm_pull with plain_http
|
||||
kubernetes.core.helm_pull:
|
||||
chart_ref: "{{ chart_ref_oci }}"
|
||||
chart_version: "{{ chart_version }}"
|
||||
destination: "{{ _tmpd.path }}"
|
||||
binary_path: "{{ helm_binary }}"
|
||||
plain_http: true
|
||||
register: pull_chart
|
||||
ignore_errors: true
|
||||
|
||||
- name: Ensure helm_pull failed with the version error
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- pull_chart is failed
|
||||
- '"plain_http requires helm >= 3.13.0" in pull_chart.msg'
|
||||
|
||||
- name: Attempt helm_template with plain_http
|
||||
kubernetes.core.helm_template:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
chart_ref: "{{ chart_ref_oci }}"
|
||||
chart_version: "{{ chart_version }}"
|
||||
plain_http: true
|
||||
register: template
|
||||
ignore_errors: true
|
||||
|
||||
- name: Ensure helm_template failed with the version error
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- template is failed
|
||||
- '"plain_http requires helm >= 3.13.0" in template.msg'
|
||||
|
||||
# helm >= 3.13.0 exercises plain HTTP end to end against the registry stood up
|
||||
# by the setup_helm_registry role, so the assertions prove the flag actually
|
||||
# reaches a plain-HTTP registry rather than just appearing in the command.
|
||||
- name: Exercise plain_http end to end
|
||||
when: plain_http_supported | bool
|
||||
block:
|
||||
- name: Copy the test chart
|
||||
ansible.builtin.copy:
|
||||
src: "{{ chart_name }}"
|
||||
dest: "{{ _tmpd.path }}/"
|
||||
|
||||
- name: Push the chart to the plain-HTTP registry
|
||||
ansible.builtin.include_role:
|
||||
name: push_to_helm_registry
|
||||
vars:
|
||||
chart_local_path: "{{ _tmpd.path }}/{{ chart_name }}"
|
||||
chart_repo_path: "{{ registry_repo_path }}"
|
||||
helm_binary_path: "{{ helm_binary }}"
|
||||
|
||||
- name: Log into the helm registry
|
||||
ansible.builtin.shell: >-
|
||||
echo '{{ registry_password }}' | {{ helm_binary }} registry login
|
||||
-u {{ registry_username }} --password-stdin {{ registry_host }}
|
||||
{{ helm_version | string is ansible.builtin.version('3.18.0', '>=') | ternary('--plain-http', '') }}
|
||||
|
||||
- name: Install the chart over plain HTTP
|
||||
kubernetes.core.helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
chart_ref: "{{ chart_ref_oci }}"
|
||||
chart_version: "{{ chart_version }}"
|
||||
release_name: test-secure
|
||||
release_namespace: "{{ test_namespace }}"
|
||||
create_namespace: true
|
||||
plain_http: true
|
||||
register: install_chart
|
||||
|
||||
- name: Ensure the release installed over plain HTTP
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- install_chart is changed
|
||||
- '"--plain-http" in install_chart.command'
|
||||
|
||||
- name: Pull the chart over plain HTTP
|
||||
kubernetes.core.helm_pull:
|
||||
chart_ref: "{{ chart_ref_oci }}"
|
||||
chart_version: "{{ chart_version }}"
|
||||
destination: "{{ _tmpd.path }}"
|
||||
binary_path: "{{ helm_binary }}"
|
||||
plain_http: true
|
||||
register: pull_chart
|
||||
|
||||
- name: Ensure the chart was pulled over plain HTTP
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- pull_chart is not failed
|
||||
- '"--plain-http" in pull_chart.command'
|
||||
|
||||
- name: Render the chart over plain HTTP
|
||||
kubernetes.core.helm_template:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
chart_ref: "{{ chart_ref_oci }}"
|
||||
chart_version: "{{ chart_version }}"
|
||||
plain_http: true
|
||||
register: template
|
||||
|
||||
- name: Ensure the chart rendered over plain HTTP
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- template is not failed
|
||||
- '"--plain-http" in template.command'
|
||||
- "'kind: ConfigMap' in template.stdout"
|
||||
|
||||
always:
|
||||
- name: Uninstall the release
|
||||
kubernetes.core.helm:
|
||||
binary_path: "{{ helm_binary }}"
|
||||
release_name: test-secure
|
||||
release_namespace: "{{ test_namespace }}"
|
||||
state: absent
|
||||
when: plain_http_supported | bool
|
||||
ignore_errors: true
|
||||
|
||||
- name: Remove the test namespace
|
||||
kubernetes.core.k8s:
|
||||
api_version: v1
|
||||
kind: Namespace
|
||||
name: "{{ test_namespace }}"
|
||||
state: absent
|
||||
wait: true
|
||||
ignore_errors: true
|
||||
|
||||
- name: Log out of the helm registry
|
||||
ansible.builtin.command: "{{ helm_binary }} registry logout {{ registry_host }}"
|
||||
when: plain_http_supported | bool
|
||||
ignore_errors: true
|
||||
|
||||
- name: Remove the temporary directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ _tmpd.path }}"
|
||||
state: absent
|
||||
ignore_errors: true
|
||||
@@ -1,2 +1,2 @@
|
||||
---
|
||||
helm_binary: "/tmp/helm/{{ ansible_system | lower }}-amd64/helm"
|
||||
helm_binary: "helm"
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
---
|
||||
- connection: local
|
||||
gather_facts: true
|
||||
hosts: localhost
|
||||
|
||||
roles:
|
||||
- helm_plugin
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user