mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-11-21 22:50:20 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e5f3198fc | ||
|
|
819adf3e4b | ||
|
|
e91b3171ea | ||
|
|
693e80389b | ||
|
|
53cb65a740 | ||
|
|
a2803df8e8 | ||
|
|
1016f80aee | ||
|
|
90e868aa37 | ||
|
|
864c7addd1 | ||
|
|
021ffbfec2 | ||
|
|
b40a401ec2 | ||
|
|
e620b92b49 | ||
|
|
40123060c1 | ||
|
|
d44a8501e6 | ||
|
|
c3f7a453fd | ||
|
|
5c06a554a8 | ||
|
|
20b9c3fb7f | ||
|
|
7b17313ace | ||
|
|
569bae6593 | ||
|
|
da42348358 | ||
|
|
79e98c3d6e | ||
|
|
477bb79305 | ||
|
|
fd65a4f09e | ||
|
|
b9749c94f9 | ||
|
|
0f472b53e2 | ||
|
|
a1cd39a71f | ||
|
|
6742eaa725 | ||
|
|
5c98d5696e | ||
|
|
78b82c74f7 | ||
|
|
42963f0536 | ||
|
|
9c3988689f | ||
|
|
08143fc16f | ||
|
|
457a7dc534 | ||
|
|
edee5c994d | ||
|
|
a523a195cb | ||
|
|
7f5c2183c0 | ||
|
|
294c2fce4a | ||
|
|
ebc015955e | ||
|
|
57f4bf76cd | ||
|
|
63f490d123 | ||
|
|
1d49a942d9 | ||
|
|
d8ae230bcf | ||
|
|
71e9aba89c | ||
|
|
fdebba58bc | ||
|
|
e87fe77453 | ||
|
|
714c2f6711 | ||
|
|
2fb6546b03 | ||
|
|
ef9fb67688 | ||
|
|
90bc4c4b3b | ||
|
|
1590c6a4cc | ||
|
|
76eccacab6 | ||
|
|
620abbac26 | ||
|
|
66a820e03a | ||
|
|
a3f2438e9d | ||
|
|
0709ea31c9 | ||
|
|
44ab1fc478 | ||
|
|
80c33c5573 | ||
|
|
73dc94be68 | ||
|
|
1bc65230bb | ||
|
|
91427a5b6a | ||
|
|
1d1a23b1ab | ||
|
|
6edc84678d | ||
|
|
66bd8620e4 | ||
|
|
94b43dc582 | ||
|
|
3c4f9cee60 | ||
|
|
a54b4a13b6 | ||
|
|
e16b3c46b0 | ||
|
|
bc60523372 | ||
|
|
64f3f07c5a | ||
|
|
d6492b66d9 | ||
|
|
4d5388ddf8 | ||
|
|
6dadd06252 | ||
|
|
69dc7d5c5d | ||
|
|
2fa1c2c6e5 | ||
|
|
f2623dd3cf | ||
|
|
8772d8c997 | ||
|
|
a32108f64f | ||
|
|
365e5e9159 | ||
|
|
448a68da3d | ||
|
|
46acab9c4c | ||
|
|
fdb77182c8 | ||
|
|
fa3d94f793 | ||
|
|
9ec27cf37c | ||
|
|
10cb241256 | ||
|
|
92e1f581fe | ||
|
|
7f69aff0d6 | ||
|
|
8c65ac066d | ||
|
|
1d962fb932 | ||
|
|
27ce23aa72 | ||
|
|
993652b581 | ||
|
|
9bd9d22db3 | ||
|
|
0593426918 | ||
|
|
8fa5b201a4 |
@@ -1,9 +1,6 @@
|
|||||||
---
|
---
|
||||||
profile: production
|
profile: production
|
||||||
|
|
||||||
warn_list:
|
|
||||||
- no-log-password
|
|
||||||
|
|
||||||
exclude_paths:
|
exclude_paths:
|
||||||
- .ansible/
|
- .ansible/
|
||||||
- .github/
|
- .github/
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
# https://docs.ansible.com/ansible-lint/docs/rules/
|
# 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]
|
plugins/connection/kubectl.py jinja[invalid]
|
||||||
# collection EE metadata is not an ansible-builder definition file
|
# collection EE metadata is not an ansible-builder definition file
|
||||||
meta/execution-environment.yml schema[execution-environment]
|
meta/execution-environment.yml schema[execution-environment]
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- run: |
|
- run: |
|
||||||
python -c "
|
python -c "
|
||||||
|
import sys
|
||||||
|
|
||||||
required = ['sanity', 'units', 'coverage']
|
required = ['sanity', 'units', 'coverage']
|
||||||
if '${{ github.event_name }}' == 'pull_request':
|
if '${{ github.event_name }}' == 'pull_request':
|
||||||
required = ['security-check', 'linters', 'sanity', 'units', 'coverage']
|
required = ['security-check', 'linters', 'sanity', 'units', 'coverage']
|
||||||
@@ -91,7 +93,29 @@ jobs:
|
|||||||
'units': '${{ needs.units.result }}',
|
'units': '${{ needs.units.result }}',
|
||||||
'coverage': '${{ needs.coverage.result }}',
|
'coverage': '${{ needs.coverage.result }}',
|
||||||
}
|
}
|
||||||
ok = all(results[j] == 'success' for j in required)
|
|
||||||
skipped_ok = all(results[j] in ('success', 'skipped') for j in results)
|
for name in required:
|
||||||
assert ok and skipped_ok, f'required={required} results={results}'
|
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)
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -1,210 +0,0 @@
|
|||||||
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,8 +17,9 @@ jobs:
|
|||||||
source_dir: "./source"
|
source_dir: "./source"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
test_targets: ${{ steps.select-targets.outputs.targets }}
|
test_targets: ${{ steps.splitter.outputs.test_targets }}
|
||||||
test_jobs: ${{ steps.select-targets.outputs.jobs }}
|
test_targets_json: ${{ steps.splitter.outputs.test_targets_json }}
|
||||||
|
test_jobs: ${{ steps.splitter.outputs.test_jobs }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the collection repository
|
- name: Checkout the collection repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -34,40 +35,18 @@ jobs:
|
|||||||
collections_to_test: ${{ env.source_dir }}
|
collections_to_test: ${{ env.source_dir }}
|
||||||
total_jobs: 8
|
total_jobs: 8
|
||||||
|
|
||||||
- name: Remove all Helm related 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")
|
|
||||||
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
|
- name: Display splitter output
|
||||||
env:
|
|
||||||
TARGETS: ${{ steps.select-targets.outputs.targets }}
|
|
||||||
JOBS: ${{ steps.select-targets.outputs.jobs }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "targets => $TARGETS"
|
echo "test_targets=${{ steps.splitter.outputs.test_targets }}"
|
||||||
echo "jobs => $JOBS"
|
echo "test_targets_json=${{ steps.splitter.outputs.test_targets_json }}"
|
||||||
|
echo "test_jobs=${{ steps.splitter.outputs.test_jobs }}"
|
||||||
shell: bash
|
shell: bash
|
||||||
integration:
|
integration:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
needs:
|
needs:
|
||||||
- splitter
|
- splitter
|
||||||
if: ${{ needs.splitter.outputs.test_jobs != '' && needs.splitter.outputs.test_jobs != '[]' }}
|
if: ${{ needs.splitter.outputs.test_targets != '' }}
|
||||||
env:
|
env:
|
||||||
source: "./source"
|
source: "./source"
|
||||||
cloud_common: "./cloudcommon"
|
cloud_common: "./cloudcommon"
|
||||||
@@ -108,14 +87,12 @@ jobs:
|
|||||||
fh.write(f'ansible_test_targets={json.loads(os.environ.get("ALL_TEST_TARGETS")).get(os.environ.get("WORKFLOW_ID"))}\n')
|
fh.write(f'ansible_test_targets={json.loads(os.environ.get("ALL_TEST_TARGETS")).get(os.environ.get("WORKFLOW_ID"))}\n')
|
||||||
shell: python
|
shell: python
|
||||||
env:
|
env:
|
||||||
ALL_TEST_TARGETS: ${{ needs.splitter.outputs.test_targets }}
|
ALL_TEST_TARGETS: ${{ needs.splitter.outputs.test_targets_json }}
|
||||||
WORKFLOW_ID: ${{ matrix.workflow-id }}
|
WORKFLOW_ID: ${{ matrix.workflow-id }}
|
||||||
|
|
||||||
- name: Display ansible test targets
|
- name: Display ansible test targets
|
||||||
env:
|
|
||||||
ANSIBLE_TEST_TARGETS: ${{ steps.read-targets.outputs.ansible_test_targets }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "ansible_test_targets -> $ANSIBLE_TEST_TARGETS"
|
echo "ansible_test_targets -> ${{ steps.read-targets.outputs.ansible_test_targets }}"
|
||||||
|
|
||||||
- name: Checkout kubernetes.core repository
|
- name: Checkout kubernetes.core repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
---
|
|
||||||
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
|
|
||||||
+1
-2
@@ -16,13 +16,12 @@ tests/integration/cloud-config-*
|
|||||||
.ansible
|
.ansible
|
||||||
|
|
||||||
# Helm charts
|
# Helm charts
|
||||||
tests/integration/*.tgz
|
tests/integration/*-chart-*.tgz
|
||||||
tests/integration/targets/*/*.tgz
|
tests/integration/targets/*/*.tgz
|
||||||
|
|
||||||
# ansible-test generated file
|
# ansible-test generated file
|
||||||
tests/integration/inventory
|
tests/integration/inventory
|
||||||
tests/integration/*-*.yml
|
tests/integration/*-*.yml
|
||||||
tests/integration/integration_config.yml
|
|
||||||
|
|
||||||
# IDE and editor settings
|
# IDE and editor settings
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/ansible/cloud-content-ci-automation
|
- repo: https://github.com/ansible/cloud-content-ci-automation
|
||||||
rev: 77f45b0357b6b3c27b04e934f0f51c9b50b7aa25
|
rev: precommit_hook
|
||||||
hooks:
|
hooks:
|
||||||
- id: block-ide-ai-files
|
- id: block-ide-ai-files
|
||||||
always_run: true
|
always_run: true
|
||||||
|
|||||||
+3
-103
@@ -184,112 +184,12 @@ Bugfixes
|
|||||||
v6.0.0
|
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
|
Breaking Changes / Porting Guide
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
- Remove deprecated ``k8s`` invetory plugin (https://github.com/ansible-collections/kubernetes.core/pull/867).
|
- 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).
|
- 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
|
v5.4.1
|
||||||
======
|
======
|
||||||
|
|
||||||
@@ -329,15 +229,15 @@ This release includes minor changes, bug fixes and also bumps ``ansible-lint`` v
|
|||||||
Minor Changes
|
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).
|
- 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 ``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
|
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
|
v5.2.0
|
||||||
======
|
======
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Also needs to be updated in galaxy.yml
|
# Also needs to be updated in galaxy.yml
|
||||||
VERSION = 7.0.0-dev0
|
VERSION = 6.6.0
|
||||||
|
|
||||||
TEST_ARGS ?= ""
|
TEST_ARGS ?= ""
|
||||||
PYTHON_VERSION ?= `python -c 'import platform; print(".".join(platform.python_version_tuple()[0:2]))'`
|
PYTHON_VERSION ?= `python -c 'import platform; print(".".join(platform.python_version_tuple()[0:2]))'`
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ Click on the name of a plugin or module to view that content's documentation:
|
|||||||
### Connection plugins
|
### Connection plugins
|
||||||
Name | Description
|
Name | Description
|
||||||
--- | ---
|
--- | ---
|
||||||
[kubernetes.core.kubectl](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.kubectl_connection.rst)|Execute tasks in pods running on Kubernetes.
|
[kubernetes.core.kubectl](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.kubectl_connection.rst)|Execute tasks in pods running on Kubernetes.
|
||||||
|
|
||||||
### K8s filter plugins
|
### K8s filter plugins
|
||||||
Name | Description
|
Name | Description
|
||||||
@@ -32,33 +32,33 @@ kubernetes.core.k8s_config_resource_name|Generate resource name for the given re
|
|||||||
### Lookup plugins
|
### Lookup plugins
|
||||||
Name | Description
|
Name | Description
|
||||||
--- | ---
|
--- | ---
|
||||||
[kubernetes.core.k8s](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_lookup.rst)|Query the K8s API
|
[kubernetes.core.k8s](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.k8s_lookup.rst)|Query the K8s API
|
||||||
[kubernetes.core.kustomize](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.kustomize_lookup.rst)|Build a set of kubernetes resources using a 'kustomization.yaml' file.
|
[kubernetes.core.kustomize](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.kustomize_lookup.rst)|Build a set of kubernetes resources using a 'kustomization.yaml' file.
|
||||||
|
|
||||||
### Modules
|
### Modules
|
||||||
Name | Description
|
Name | Description
|
||||||
--- | ---
|
--- | ---
|
||||||
[kubernetes.core.helm](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.helm_module.rst)|Manages Kubernetes packages with the Helm package manager
|
[kubernetes.core.helm](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.helm_module.rst)|Manages Kubernetes packages with the Helm package manager
|
||||||
[kubernetes.core.helm_info](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.helm_info_module.rst)|Get information from Helm package deployed inside the cluster
|
[kubernetes.core.helm_info](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.helm_info_module.rst)|Get information from Helm package deployed inside the cluster
|
||||||
[kubernetes.core.helm_plugin](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.helm_plugin_module.rst)|Manage Helm plugins
|
[kubernetes.core.helm_plugin](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.helm_plugin_module.rst)|Manage Helm plugins
|
||||||
[kubernetes.core.helm_plugin_info](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.helm_plugin_info_module.rst)|Gather information about Helm plugins
|
[kubernetes.core.helm_plugin_info](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.helm_plugin_info_module.rst)|Gather information about Helm plugins
|
||||||
[kubernetes.core.helm_pull](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.helm_pull_module.rst)|download a chart from a repository and (optionally) unpack it in local directory.
|
[kubernetes.core.helm_pull](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.helm_pull_module.rst)|download a chart from a repository and (optionally) unpack it in local directory.
|
||||||
[kubernetes.core.helm_registry_auth](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.helm_registry_auth_module.rst)|Helm registry authentication module
|
[kubernetes.core.helm_registry_auth](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.helm_registry_auth_module.rst)|Helm registry authentication module
|
||||||
[kubernetes.core.helm_repository](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.helm_repository_module.rst)|Manage Helm repositories.
|
[kubernetes.core.helm_repository](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.helm_repository_module.rst)|Manage Helm repositories.
|
||||||
[kubernetes.core.helm_template](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.helm_template_module.rst)|Render chart templates
|
[kubernetes.core.helm_template](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.helm_template_module.rst)|Render chart templates
|
||||||
[kubernetes.core.k8s](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_module.rst)|Manage Kubernetes (K8s) objects
|
[kubernetes.core.k8s](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.k8s_module.rst)|Manage Kubernetes (K8s) objects
|
||||||
[kubernetes.core.k8s_cluster_info](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_cluster_info_module.rst)|Describe Kubernetes (K8s) cluster, APIs available and their respective versions
|
[kubernetes.core.k8s_cluster_info](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.k8s_cluster_info_module.rst)|Describe Kubernetes (K8s) cluster, APIs available and their respective versions
|
||||||
[kubernetes.core.k8s_cp](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_cp_module.rst)|Copy files and directories to and from pod.
|
[kubernetes.core.k8s_cp](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.k8s_cp_module.rst)|Copy files and directories to and from pod.
|
||||||
[kubernetes.core.k8s_drain](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_drain_module.rst)|Drain, Cordon, or Uncordon node in k8s cluster
|
[kubernetes.core.k8s_drain](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.k8s_drain_module.rst)|Drain, Cordon, or Uncordon node in k8s cluster
|
||||||
[kubernetes.core.k8s_exec](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_exec_module.rst)|Execute command in Pod
|
[kubernetes.core.k8s_exec](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.k8s_exec_module.rst)|Execute command in Pod
|
||||||
[kubernetes.core.k8s_info](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_info_module.rst)|Describe Kubernetes (K8s) objects
|
[kubernetes.core.k8s_info](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.k8s_info_module.rst)|Describe Kubernetes (K8s) objects
|
||||||
[kubernetes.core.k8s_json_patch](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_json_patch_module.rst)|Apply JSON patch operations to existing objects
|
[kubernetes.core.k8s_json_patch](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.k8s_json_patch_module.rst)|Apply JSON patch operations to existing objects
|
||||||
[kubernetes.core.k8s_log](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_log_module.rst)|Fetch logs from Kubernetes resources
|
[kubernetes.core.k8s_log](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.k8s_log_module.rst)|Fetch logs from Kubernetes resources
|
||||||
[kubernetes.core.k8s_rollback](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_rollback_module.rst)|Rollback Kubernetes (K8S) Deployments and DaemonSets
|
[kubernetes.core.k8s_rollback](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.k8s_rollback_module.rst)|Rollback Kubernetes (K8S) Deployments and DaemonSets
|
||||||
[kubernetes.core.k8s_scale](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_scale_module.rst)|Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job.
|
[kubernetes.core.k8s_scale](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.k8s_scale_module.rst)|Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job.
|
||||||
[kubernetes.core.k8s_service](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_service_module.rst)|Manage Services on Kubernetes
|
[kubernetes.core.k8s_service](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.k8s_service_module.rst)|Manage Services on Kubernetes
|
||||||
[kubernetes.core.k8s_taint](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_taint_module.rst)|Taint a node in a Kubernetes/OpenShift cluster
|
[kubernetes.core.k8s_taint](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.k8s_taint_module.rst)|Taint a node in a Kubernetes/OpenShift cluster
|
||||||
[kubernetes.core.kubeconfig](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.kubeconfig_module.rst)|Generate, update, and optionally write Kubernetes kubeconfig files
|
[kubernetes.core.kubeconfig](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/kubernetes.core.kubeconfig_module.rst)|Generate, update, and optionally write Kubernetes kubeconfig files
|
||||||
|
|
||||||
<!--end collection content-->
|
<!--end collection content-->
|
||||||
|
|
||||||
@@ -94,8 +94,6 @@ Before using the Kubernetes collection, you need to install it with the Ansible
|
|||||||
|
|
||||||
ansible-galaxy collection install kubernetes.core
|
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:
|
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
|
```yaml
|
||||||
@@ -107,14 +105,12 @@ collections:
|
|||||||
|
|
||||||
### Installing the Kubernetes Python Library
|
### Installing the Kubernetes Python Library
|
||||||
|
|
||||||
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:
|
Content in this collection requires the [Kubernetes Python client](https://pypi.org/project/kubernetes/) to interact with Kubernetes' APIs. You can install it with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip3 install kubernetes
|
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
|
## Use Cases
|
||||||
|
|
||||||
It's preferable to use content in this collection using their Fully Qualified Collection Namespace (FQCN), for example `kubernetes.core.k8s_info`:
|
It's preferable to use content in this collection using their Fully Qualified Collection Namespace (FQCN), for example `kubernetes.core.k8s_info`:
|
||||||
@@ -203,7 +199,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
|
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`.
|
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/main/docs/ansible_turbo_mode.rst).
|
Please read more about Ansible Turbo mode - [here](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/ansible_turbo_mode.rst).
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
@@ -219,8 +215,6 @@ You can run the collection's test suites with the commands:
|
|||||||
make test-integration
|
make test-integration
|
||||||
make test-unit
|
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`
|
### 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:
|
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:
|
||||||
@@ -232,7 +226,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.
|
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/main/CONTRIBUTING.md).
|
See [Contributing to kubernetes.core](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/CONTRIBUTING.md).
|
||||||
|
|
||||||
Join the Ansible community:
|
Join the Ansible community:
|
||||||
|
|
||||||
@@ -249,8 +243,6 @@ This project follows the [Ansible Code of Conduct](https://docs.ansible.com/ansi
|
|||||||
|
|
||||||
## Support
|
## 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/).
|
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`.
|
> **Note:** The `stable-4` branch (all `4.x.y` releases) is no longer supported. No backports or releases are performed on `stable-4`.
|
||||||
@@ -259,7 +251,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.
|
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/main/README.md#release-notes-and-roadmap).
|
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).
|
||||||
|
|
||||||
Report bugs, request features, or ask questions by opening an issue in the [GitHub repository](https://github.com/ansible-collections/kubernetes.core/).
|
Report bugs, request features, or ask questions by opening an issue in the [GitHub repository](https://github.com/ansible-collections/kubernetes.core/).
|
||||||
|
|
||||||
@@ -271,7 +263,7 @@ Releases are automatically built and pushed to Ansible Galaxy for any new tag. B
|
|||||||
1. The `version` in `galaxy.yml`
|
1. The `version` in `galaxy.yml`
|
||||||
2. This README's `requirements.yml` example
|
2. This README's `requirements.yml` example
|
||||||
3. The `VERSION` in `Makefile`
|
3. The `VERSION` in `Makefile`
|
||||||
2. Update the [CHANGELOG](CHANGELOG.rst):
|
2. Update the CHANGELOG:
|
||||||
1. Make sure you have [`antsibull-changelog`](https://pypi.org/project/antsibull-changelog/) installed.
|
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`.
|
2. Make sure there are fragments for all known changes in `changelogs/fragments`.
|
||||||
3. Run `antsibull-changelog release`.
|
3. Run `antsibull-changelog release`.
|
||||||
@@ -286,9 +278,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)
|
* [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)
|
* [Ansible communication guide](https://docs.ansible.com/ansible/devel/community/communication.html)
|
||||||
* [Continuous integration (CI) overview](https://github.com/ansible-collections/kubernetes.core/blob/main/CI.md)
|
* [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/main/SONARCLOUD.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/main/docs/ansible_turbo_mode.rst)
|
* [Ansible Turbo mode (tech preview)](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/docs/ansible_turbo_mode.rst)
|
||||||
|
|
||||||
### Code of conduct
|
### Code of conduct
|
||||||
|
|
||||||
@@ -300,4 +292,4 @@ If you encounter abusive behavior, please refer to the [policy violations](https
|
|||||||
|
|
||||||
GNU General Public License v3.0 or later
|
GNU General Public License v3.0 or later
|
||||||
|
|
||||||
See [LICENSE](https://github.com/ansible-collections/kubernetes.core/blob/main/LICENSE) to see the full text.
|
See [LICENSE](https://github.com/ansible-collections/kubernetes.core/blob/stable-6/LICENSE) to see the full text.
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ Workflow files:
|
|||||||
|
|
||||||
Scanner configuration lives in [sonar-project.properties](sonar-project.properties).
|
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`**), 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`**) 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.
|
||||||
|
|
||||||
**`sonarcloud.yml`** declares a required secret **`ANSIBLE_COLLECTIONS_ORG_SONAR_TOKEN_CICD_BOT`** and **`permissions: contents: read`**, **`pull-requests: read`**.
|
**`sonarcloud.yml`** declares a required secret **`ANSIBLE_COLLECTIONS_ORG_SONAR_TOKEN_CICD_BOT`** and **`permissions: contents: read`**, **`pull-requests: read`**.
|
||||||
|
|
||||||
|
|||||||
@@ -1073,132 +1073,6 @@ releases:
|
|||||||
- 20250922-remove-ansible-six-imports.yaml
|
- 20250922-remove-ansible-six-imports.yaml
|
||||||
- 5.4.1.yml
|
- 5.4.1.yml
|
||||||
release_date: '2025-10-07'
|
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:
|
6.0.0:
|
||||||
changes:
|
changes:
|
||||||
breaking_changes:
|
breaking_changes:
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
---
|
|
||||||
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).
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
---
|
|
||||||
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).
|
|
||||||
@@ -427,23 +427,6 @@ Common return values are documented `here <https://docs.ansible.com/projects/ans
|
|||||||
<br/>
|
<br/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</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>
|
<tr>
|
||||||
<td class="elbow-placeholder"> </td>
|
<td class="elbow-placeholder"> </td>
|
||||||
<td colspan="1">
|
<td colspan="1">
|
||||||
|
|||||||
@@ -1035,7 +1035,6 @@ Examples
|
|||||||
Return Values
|
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:
|
||||||
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
|
.. raw:: html
|
||||||
|
|
||||||
|
|||||||
@@ -813,7 +813,7 @@ Parameters
|
|||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<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, 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>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><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>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -509,7 +509,7 @@ Parameters
|
|||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<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, 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>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>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ tags:
|
|||||||
- openshift
|
- openshift
|
||||||
- okd
|
- okd
|
||||||
- cluster
|
- cluster
|
||||||
version: 7.0.0-dev0
|
version: 6.6.0
|
||||||
build_ignore:
|
build_ignore:
|
||||||
- .DS_Store
|
- .DS_Store
|
||||||
- "*.tar.gz"
|
- "*.tar.gz"
|
||||||
|
|||||||
@@ -228,13 +228,13 @@ EXAMPLES = r"""
|
|||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
kubeconfig: /root/.kube/config
|
kubeconfig: /root/.kube/config
|
||||||
k8s_namespace: my-namespace
|
namespace: my-namespace
|
||||||
my_app: my-app
|
my_app: my-app
|
||||||
tasks:
|
tasks:
|
||||||
- name: Get My App pod info based on label
|
- name: Get My App pod info based on label
|
||||||
kubernetes.core.k8s_info:
|
kubernetes.core.k8s_info:
|
||||||
kubeconfig: "{{ kubeconfig }}"
|
kubeconfig: "{{ kubeconfig }}"
|
||||||
namespace: "{{ k8s_namespace }}"
|
namespace: "{{ namespace }}"
|
||||||
kind: Pod
|
kind: Pod
|
||||||
label_selectors: app.kubernetes.io/name = "{{ my_app }}"
|
label_selectors: app.kubernetes.io/name = "{{ my_app }}"
|
||||||
register: my_app_pod
|
register: my_app_pod
|
||||||
@@ -249,7 +249,7 @@ EXAMPLES = r"""
|
|||||||
ansible_connection: kubernetes.core.kubectl
|
ansible_connection: kubernetes.core.kubectl
|
||||||
ansible_kubectl_kubeconfig: "{{ kubeconfig }}"
|
ansible_kubectl_kubeconfig: "{{ kubeconfig }}"
|
||||||
ansible_kubectl_pod: "{{ my_app_pod_name }}"
|
ansible_kubectl_pod: "{{ my_app_pod_name }}"
|
||||||
ansible_kubectl_namespace: "{{ k8s_namespace }}"
|
ansible_kubectl_namespace: "{{ namespace }}"
|
||||||
|
|
||||||
- name: Run a command in My App pod
|
- name: Run a command in My App pod
|
||||||
# be aware that the command is executed as the user that started the container
|
# be aware that the command is executed as the user that started the container
|
||||||
|
|||||||
@@ -16,8 +16,9 @@ options:
|
|||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Determines if an object should be created, patched, or deleted. When set to C(present), an object will be
|
- 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, and an existing object will be patched if its attributes differ from
|
created, if it does not already exist. If set to C(absent), an existing object will be deleted. If set to
|
||||||
those specified using I(resource_definition) or I(src). If set to C(absent), an existing object will be deleted.
|
C(present), an existing object will be patched, if its attributes differ from those specified using
|
||||||
|
I(resource_definition) or I(src).
|
||||||
type: str
|
type: str
|
||||||
default: present
|
default: present
|
||||||
choices: [ absent, present ]
|
choices: [ absent, present ]
|
||||||
|
|||||||
@@ -92,10 +92,10 @@ def run_module(module) -> None:
|
|||||||
|
|
||||||
for definition in definitions:
|
for definition in definitions:
|
||||||
result = {"changed": False, "result": {}}
|
result = {"changed": False, "result": {}}
|
||||||
|
warnings = []
|
||||||
|
|
||||||
if module.params.get("validate") is not None:
|
if module.params.get("validate") is not None:
|
||||||
for warning in validate(client, module, definition):
|
warnings = validate(client, module, definition)
|
||||||
module.warn(warning)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = perform_action(svc, definition, module.params)
|
result = perform_action(svc, definition, module.params)
|
||||||
@@ -109,12 +109,16 @@ def run_module(module) -> None:
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
error["msg"] = to_native(e)
|
error["msg"] = to_native(e)
|
||||||
|
if warnings:
|
||||||
|
error.setdefault("warnings", []).extend(warnings)
|
||||||
|
|
||||||
if module.params.get("continue_on_error"):
|
if module.params.get("continue_on_error"):
|
||||||
result["error"] = error
|
result["error"] = error
|
||||||
else:
|
else:
|
||||||
module.fail_json(**error)
|
module.fail_json(**error)
|
||||||
|
|
||||||
|
if warnings:
|
||||||
|
result.setdefault("warnings", []).extend(warnings)
|
||||||
changed |= result["changed"]
|
changed |= result["changed"]
|
||||||
results.append(result)
|
results.append(result)
|
||||||
|
|
||||||
@@ -173,7 +177,7 @@ def perform_action(svc, definition: Dict, params: Dict) -> Dict:
|
|||||||
result["method"] = "apply"
|
result["method"] = "apply"
|
||||||
elif not existing:
|
elif not existing:
|
||||||
if state == "patched":
|
if state == "patched":
|
||||||
svc.module.warn(
|
result.setdefault("warnings", []).append(
|
||||||
"resource 'kind={kind},name={name}' was not found but will not be "
|
"resource 'kind={kind},name={name}' was not found but will not be "
|
||||||
"created as 'state' parameter has been set to '{state}'".format(
|
"created as 'state' parameter has been set to '{state}'".format(
|
||||||
kind=kind, name=definition["metadata"].get("name"), state=state
|
kind=kind, name=definition["metadata"].get("name"), state=state
|
||||||
@@ -190,8 +194,8 @@ def perform_action(svc, definition: Dict, params: Dict) -> Dict:
|
|||||||
instance, warnings = svc.update(resource, definition, existing)
|
instance, warnings = svc.update(resource, definition, existing)
|
||||||
result["method"] = "update"
|
result["method"] = "update"
|
||||||
|
|
||||||
for warning in warnings:
|
if warnings:
|
||||||
svc.module.warn(warning)
|
result["warnings"] = warnings
|
||||||
|
|
||||||
# If needed, wait and/or create diff
|
# If needed, wait and/or create diff
|
||||||
success = True
|
success = True
|
||||||
@@ -213,7 +217,7 @@ def perform_action(svc, definition: Dict, params: Dict) -> Dict:
|
|||||||
existing = {}
|
existing = {}
|
||||||
match, diffs = diff_objects(existing, instance, hidden_fields)
|
match, diffs = diff_objects(existing, instance, hidden_fields)
|
||||||
if match and diffs:
|
if match and diffs:
|
||||||
svc.module.warn(
|
result.setdefault("warnings", []).append(
|
||||||
"No meaningful diff was generated, but the API may not be idempotent "
|
"No meaningful diff was generated, but the API may not be idempotent "
|
||||||
"(only metadata.generation or metadata.resourceVersion were changed)"
|
"(only metadata.generation or metadata.resourceVersion were changed)"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -956,6 +956,7 @@ def helmdiff_check(
|
|||||||
reset_values=True,
|
reset_values=True,
|
||||||
reset_then_reuse_values=False,
|
reset_then_reuse_values=False,
|
||||||
insecure_skip_tls_verify=False,
|
insecure_skip_tls_verify=False,
|
||||||
|
plain_http=False,
|
||||||
skip_schema_validation=False,
|
skip_schema_validation=False,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
@@ -1023,6 +1024,17 @@ def helmdiff_check(
|
|||||||
else:
|
else:
|
||||||
cmd += " --skip-schema-validation"
|
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)
|
rc, out, err = module.run_helm_command(cmd)
|
||||||
return (len(out.strip()) > 0, out.strip())
|
return (len(out.strip()) > 0, out.strip())
|
||||||
|
|
||||||
@@ -1350,6 +1362,7 @@ def main():
|
|||||||
reset_values=reset_values,
|
reset_values=reset_values,
|
||||||
reset_then_reuse_values=reset_then_reuse_values,
|
reset_then_reuse_values=reset_then_reuse_values,
|
||||||
insecure_skip_tls_verify=insecure_skip_tls_verify,
|
insecure_skip_tls_verify=insecure_skip_tls_verify,
|
||||||
|
plain_http=plain_http,
|
||||||
skip_schema_validation=skip_schema_validation,
|
skip_schema_validation=skip_schema_validation,
|
||||||
)
|
)
|
||||||
if would_change and module._diff:
|
if would_change and module._diff:
|
||||||
|
|||||||
@@ -40,8 +40,9 @@ options:
|
|||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Determines if an object should be created, patched, or deleted. When set to C(present), an object will be
|
- 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, and an existing object will be patched if its attributes differ from
|
created, if it does not already exist. If set to C(absent), an existing object will be deleted. If set to
|
||||||
those specified using I(resource_definition) or I(src). If set to C(absent), an existing object will be deleted.
|
C(present), an existing object will be patched, if its attributes differ from those specified using
|
||||||
|
I(resource_definition) or I(src).
|
||||||
- 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).
|
- 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
|
type: str
|
||||||
default: present
|
default: present
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ sonar.python.coverage.reportPaths=coverage.xml
|
|||||||
|
|
||||||
sonar.tests=tests/unit,tests/integration
|
sonar.tests=tests/unit,tests/integration
|
||||||
sonar.python.version=3.12
|
sonar.python.version=3.12
|
||||||
sonar.newCode.referenceBranch=main
|
sonar.newCode.referenceBranch=stable-6
|
||||||
|
|
||||||
sonar.exclusions=tests/**,.tox/**
|
sonar.exclusions=tests/**,.tox/**
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ sonar.cpd.exclusions=tests/**
|
|||||||
# constructor (not {...} literals) for readability and consistency across the
|
# constructor (not {...} literals) for readability and consistency across the
|
||||||
# collection. Suppress python:S7498 ("prefer literal syntax"), which conflicts
|
# collection. Suppress python:S7498 ("prefer literal syntax"), which conflicts
|
||||||
# with that convention and otherwise re-fires on every new module argument.
|
# with that convention and otherwise re-fires on every new module argument.
|
||||||
sonar.issue.ignore.multicriteria=e1,e2,e3,e4,e5
|
sonar.issue.ignore.multicriteria=e1,e2,e3
|
||||||
sonar.issue.ignore.multicriteria.e1.ruleKey=python:S7498
|
sonar.issue.ignore.multicriteria.e1.ruleKey=python:S7498
|
||||||
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.py
|
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.py
|
||||||
|
|
||||||
@@ -45,24 +45,3 @@ sonar.issue.ignore.multicriteria.e2.resourceKey=tests/**/*.py
|
|||||||
# to simplify maintenance. Suppress githubactions:S7637 ("use full commit SHA").
|
# to simplify maintenance. Suppress githubactions:S7637 ("use full commit SHA").
|
||||||
sonar.issue.ignore.multicriteria.e3.ruleKey=githubactions:S7637
|
sonar.issue.ignore.multicriteria.e3.ruleKey=githubactions:S7637
|
||||||
sonar.issue.ignore.multicriteria.e3.resourceKey=.github/workflows/**/*.yaml
|
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,46 +0,0 @@
|
|||||||
# 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,4 +1 @@
|
|||||||
helm
|
disabled # used by test targets helm_vX_XX_XX
|
||||||
helm_info
|
|
||||||
helm_plugin
|
|
||||||
helm_template
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
helm_binary: "helm"
|
helm_default_archive_name: "helm-{{ helm_version }}-{{ ansible_system | lower }}-amd64.tar.gz"
|
||||||
setup_helm_version_binary_path: "{{ helm_binary }}"
|
helm_binary: "/tmp/helm/{{ ansible_system | lower }}-amd64/helm"
|
||||||
|
|
||||||
chart_test: "ingress-nginx"
|
chart_test: "ingress-nginx"
|
||||||
chart_test_oci: "oci://registry-1.docker.io/bitnamicharts/redis"
|
chart_test_oci: "oci://registry-1.docker.io/bitnamicharts/redis"
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
#!/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,5 +1,3 @@
|
|||||||
---
|
---
|
||||||
dependencies:
|
|
||||||
- setup_helm_version
|
|
||||||
collections:
|
collections:
|
||||||
- kubernetes.core
|
- kubernetes.core
|
||||||
|
|||||||
@@ -1,11 +1,22 @@
|
|||||||
---
|
---
|
||||||
- name: Ensure helm is not installed
|
- name: Ensure helm is not installed
|
||||||
ansible.builtin.file:
|
file:
|
||||||
path: "/tmp/helm"
|
path: "{{ item }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
with_items:
|
||||||
|
- "/tmp/helm"
|
||||||
|
|
||||||
- name: Check failed if helm is not installed
|
- name: Check failed if helm is not installed
|
||||||
ansible.builtin.include_tasks: test_helm_not_installed.yml
|
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
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
ansible.builtin.include_tasks: run_test.yml
|
include_tasks: run_test.yml
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
---
|
---
|
||||||
|
- name: "Install {{ helm_version }}"
|
||||||
|
include_role:
|
||||||
|
name: install_helm
|
||||||
|
|
||||||
- name: Main helm tests
|
- name: Main helm tests
|
||||||
block:
|
block:
|
||||||
- name: Install helm-diff plugin
|
- name: Install helm-diff plugin
|
||||||
helm_plugin:
|
helm_plugin:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
plugin_path: https://github.com/databus23/helm-diff
|
plugin_path: https://github.com/databus23/helm-diff
|
||||||
plugin_version: "{{ helm_version | string is ansible.builtin.version('4.0.0', '>=') | ternary('v3.14.0', 'v3.10.0') }}"
|
plugin_version: "{{ helm_version is version('v4.0.0', '>=') | ternary('v3.14.0', 'v3.10.0') }}"
|
||||||
verify: false
|
verify: false
|
||||||
|
|
||||||
- name: "Ensure we honor the environment variables"
|
- name: "Ensure we honor the environment variables"
|
||||||
ansible.builtin.include_tasks: test_read_envvars.yml
|
include_tasks: test_read_envvars.yml
|
||||||
|
|
||||||
- name: Deploy charts
|
- name: Deploy charts
|
||||||
ansible.builtin.include_tasks: "tests_chart/{{ test_chart_type }}.yml"
|
include_tasks: "tests_chart/{{ test_chart_type }}.yml"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: test_chart_type
|
loop_var: test_chart_type
|
||||||
with_items:
|
with_items:
|
||||||
@@ -20,34 +24,33 @@
|
|||||||
- from_repository
|
- from_repository
|
||||||
- from_url
|
- from_url
|
||||||
|
|
||||||
- name: Test helm upgrade with reuse_values
|
- name: test helm upgrade with reuse_values
|
||||||
ansible.builtin.include_tasks: test_helm_reuse_values.yml
|
include_tasks: test_helm_reuse_values.yml
|
||||||
|
|
||||||
- name: Test helm upgrade with reset_then_reuse_values
|
- name: test helm upgrade with reset_then_reuse_values
|
||||||
ansible.builtin.include_tasks: test_helm_reset_then_reuse_values.yml
|
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
|
- name: test helm dependency update
|
||||||
ansible.builtin.include_tasks: test_up_dep.yml
|
include_tasks: test_up_dep.yml
|
||||||
|
|
||||||
- name: Test helm install with chart name containing space
|
- name: Test helm install with chart name containing space
|
||||||
ansible.builtin.include_tasks: test_helm_with_space_into_chart_name.yml
|
include_tasks: test_helm_with_space_into_chart_name.yml
|
||||||
|
|
||||||
# https://github.com/ansible-collections/community.kubernetes/issues/296
|
# https://github.com/ansible-collections/community.kubernetes/issues/296
|
||||||
- name: Test Skip CRDS feature in helm chart install
|
- name: Test Skip CRDS feature in helm chart install
|
||||||
ansible.builtin.include_tasks: test_crds.yml
|
include_tasks: test_crds.yml
|
||||||
|
|
||||||
- name: Test insecure registry flag feature
|
- name: Test insecure registry flag feature
|
||||||
ansible.builtin.include_tasks: test_helm_insecure.yml
|
include_tasks: test_helm_insecure.yml
|
||||||
|
|
||||||
- name: Test take ownership flag feature
|
- name: Test take ownership flag feature
|
||||||
ansible.builtin.include_tasks: test_helm_take_ownership.yml
|
include_tasks: test_helm_take_ownership.yml
|
||||||
|
|
||||||
- name: Test helm skip_schema_validation
|
- name: Test helm skip_schema_validation
|
||||||
ansible.builtin.include_tasks: test_skip_schema_validation.yml
|
include_tasks: test_skip_schema_validation.yml
|
||||||
|
|
||||||
- name: Test helm wait_for_jobs
|
- name: Test helm wait_for_jobs
|
||||||
ansible.builtin.include_tasks: test_helm_wait_for_jobs.yml
|
include_tasks: test_helm_wait_for_jobs.yml
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Remove helm-diff plugin
|
- name: Remove helm-diff plugin
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
register: install
|
register: install
|
||||||
|
|
||||||
- name: Validate that insecure flag is not set
|
- name: Validate that insecure flag is not set
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- '"--insecure-skip-tls-verify" not in install.command'
|
- '"--insecure-skip-tls-verify" not in install.command'
|
||||||
@@ -30,18 +30,18 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Validate that insecure flag IS set if helm version is >= 3.16.0
|
- name: Validate that insecure flag IS set if helm version is >= 3.16.0
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- '"--insecure-skip-tls-verify" in install.command'
|
- '"--insecure-skip-tls-verify" in install.command'
|
||||||
when: helm_version | string is ansible.builtin.version("3.16.0", ">=")
|
when: '"v3.16.0" <= helm_version'
|
||||||
|
|
||||||
- name: Validate that feature fails for helm < 3.16.0
|
- name: Validate that feature fails for helm < 3.16.0
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is failed
|
- install is failed
|
||||||
- '"insecure_skip_tls_verify requires helm >= 3.16.0" in install.msg'
|
- '"insecure_skip_tls_verify requires helm >= 3.16.0" in install.msg'
|
||||||
when: helm_version | string is ansible.builtin.version("3.16.0", "<")
|
when: 'helm_version < "v3.16.0"'
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Remove helm namespace
|
- name: Remove helm namespace
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Failed test when helm is not installed
|
- name: Failed test when helm is not installed
|
||||||
helm:
|
helm:
|
||||||
binary_path: "{{ helm_binary }}_fake"
|
binary_path: "{{ helm_binary}}_fake"
|
||||||
name: test
|
name: test
|
||||||
chart_ref: "{{ chart_test }}"
|
chart_ref: "{{ chart_test }}"
|
||||||
namespace: "helm-test"
|
namespace: "helm-test"
|
||||||
@@ -9,7 +9,15 @@
|
|||||||
register: helm_missing_binary
|
register: helm_missing_binary
|
||||||
|
|
||||||
- name: Assert that helm is not installed
|
- name: Assert that helm is not installed
|
||||||
ansible.builtin.assert:
|
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:
|
||||||
that:
|
that:
|
||||||
- helm_missing_binary is failed
|
- helm_missing_binary is failed
|
||||||
- "'Error executing command' in helm_missing_binary.msg"
|
- "'Error executing command' in helm_missing_binary.msg"
|
||||||
|
when: ansible_version.full is version('2.20', '>=')
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
register: release_value
|
register: release_value
|
||||||
|
|
||||||
- name: Validate that chart values are as expected
|
- name: Validate that chart values are as expected
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- '"--reset-then-reuse-values" not in install.command'
|
- '"--reset-then-reuse-values" not in install.command'
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
register: release_value
|
register: release_value
|
||||||
|
|
||||||
- name: Validate that chart values are as expected
|
- name: Validate that chart values are as expected
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- upgrade is changed
|
- upgrade is changed
|
||||||
- '"--reset-then-reuse-values" in upgrade.command'
|
- '"--reset-then-reuse-values" in upgrade.command'
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
register: release_value
|
register: release_value
|
||||||
|
|
||||||
- name: Validate that chart values are as expected
|
- name: Validate that chart values are as expected
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- '"--reuse-values=True" not in install.command'
|
- '"--reuse-values=True" not in install.command'
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
register: release_value
|
register: release_value
|
||||||
|
|
||||||
- name: Validate that chart values are as expected
|
- name: Validate that chart values are as expected
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- upgrade is changed
|
- upgrade is changed
|
||||||
- '"--reuse-values=True" in upgrade.command'
|
- '"--reuse-values=True" in upgrade.command'
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
register: install
|
register: install
|
||||||
|
|
||||||
- name: Validate that take-ownership flag is not set
|
- name: Validate that take-ownership flag is not set
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- '"--take-ownership" not in install.command'
|
- '"--take-ownership" not in install.command'
|
||||||
@@ -50,18 +50,18 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Validate that take-ownership flag IS set if helm version is >= 3.17.0
|
- name: Validate that take-ownership flag IS set if helm version is >= 3.17.0
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- upgrade is changed
|
- upgrade is changed
|
||||||
- '"--take-ownership" in upgrade.command'
|
- '"--take-ownership" in upgrade.command'
|
||||||
when: helm_version | string is ansible.builtin.version("3.17.0", ">=")
|
when: '"v3.17.0" <= helm_version'
|
||||||
|
|
||||||
- name: Validate that feature fails for helm < 3.17.0
|
- name: Validate that feature fails for helm < 3.17.0
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- upgrade is failed
|
- upgrade is failed
|
||||||
- '"take_ownership requires helm >= 3.17.0" in upgrade.msg'
|
- '"take_ownership requires helm >= 3.17.0" in upgrade.msg'
|
||||||
when: helm_version | string is ansible.builtin.version("3.17.0", "<")
|
when: 'helm_version < "v3.17.0"'
|
||||||
|
|
||||||
- name: Upgrade chart (take-onwership flag not set)
|
- name: Upgrade chart (take-onwership flag not set)
|
||||||
helm:
|
helm:
|
||||||
@@ -79,18 +79,18 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Validate that take-ownership flag IS set if helm version is >= 3.17.0
|
- name: Validate that take-ownership flag IS set if helm version is >= 3.17.0
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- upgrade is changed
|
- upgrade is changed
|
||||||
- '"--take-ownership" not in upgrade.command'
|
- '"--take-ownership" not in upgrade.command'
|
||||||
when: helm_version | string is ansible.builtin.version("3.17.0", ">=")
|
when: '"v3.17.0" <= helm_version'
|
||||||
|
|
||||||
- name: Validate that feature fails for helm < 3.17.0
|
- name: Validate that feature fails for helm < 3.17.0
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- upgrade is changed
|
- upgrade is changed
|
||||||
- upgrade.msg is not defined
|
- upgrade.msg is not defined
|
||||||
when: helm_version | string is ansible.builtin.version("3.17.0", "<")
|
when: 'helm_version < "v3.17.0"'
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Remove helm namespace
|
- name: Remove helm namespace
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
- 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
|
||||||
@@ -19,19 +19,19 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Validate wait_for_jobs with helm >= 3.5.0 works
|
- name: Validate wait_for_jobs with helm >= 3.5.0 works
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- "'--wait' in install.command"
|
- "'--wait' in install.command"
|
||||||
- "'--wait-for-jobs' in install.command"
|
- "'--wait-for-jobs' in install.command"
|
||||||
when: "helm_version | string is ansible.builtin.version('3.5.0', '>=')"
|
when: "helm_version is ansible.builtin.version('v3.5.0', '>=')"
|
||||||
|
|
||||||
- name: Validate wait_for_jobs with helm < 3.5.0 fails
|
- name: Validate wait_for_jobs with helm < 3.5.0 fails
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is failed
|
- install is failed
|
||||||
- "'wait_for_jobs requires helm >= 3.5.0' in install.msg"
|
- "'wait_for_jobs requires helm >= 3.5.0' in install.msg"
|
||||||
when: "helm_version | string is ansible.builtin.version('3.5.0', '<')"
|
when: "helm_version is ansible.builtin.version('v3.5.0', '<')"
|
||||||
|
|
||||||
- name: Install chart with wait_for_jobs but without wait
|
- name: Install chart with wait_for_jobs but without wait
|
||||||
helm:
|
helm:
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
register: install_no_wait
|
register: install_no_wait
|
||||||
|
|
||||||
- name: Validate wait_for_jobs is ignored without wait
|
- name: Validate wait_for_jobs is ignored without wait
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install_no_wait is changed
|
- install_no_wait is changed
|
||||||
- "'--wait-for-jobs' not in install_no_wait.command"
|
- "'--wait-for-jobs' not in install_no_wait.command"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
register: install_chart
|
register: install_chart
|
||||||
|
|
||||||
- name: Assert that chart is installed
|
- name: Assert that chart is installed
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install_chart is changed
|
- install_chart is changed
|
||||||
- install_chart.status.status | lower == 'deployed'
|
- install_chart.status.status | lower == 'deployed'
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
register: chart_info
|
register: chart_info
|
||||||
|
|
||||||
- name: Assert that Chart is installed (using helm_info)
|
- name: Assert that Chart is installed (using helm_info)
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- chart_info.status.status | lower == 'deployed'
|
- chart_info.status.status | lower == 'deployed'
|
||||||
|
|
||||||
|
|||||||
@@ -22,22 +22,22 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Debug install result
|
- name: Debug install result
|
||||||
ansible.builtin.debug:
|
debug:
|
||||||
var: install
|
var: install
|
||||||
|
|
||||||
- name: Validate skip_schema_validation with helm >= 3.16.0 works
|
- name: Validate skip_schema_validation with helm >= 3.16.0 works
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- "'--skip-schema-validation' in install.command"
|
- "'--skip-schema-validation' in install.command"
|
||||||
when: "helm_version | string is ansible.builtin.version('3.16.0', '>=')"
|
when: "helm_version is ansible.builtin.version('v3.16.0', '>=')"
|
||||||
|
|
||||||
- name: Validate skip_schema_validation with helm < 3.16.0 fails
|
- name: Validate skip_schema_validation with helm < 3.16.0 fails
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is failed
|
- install is failed
|
||||||
- "'skip_schema_validation requires helm >= 3.16.0' in install.msg"
|
- "'skip_schema_validation requires helm >= 3.16.0' in install.msg"
|
||||||
when: "helm_version | string is ansible.builtin.version('3.16.0', '<')"
|
when: "helm_version is ansible.builtin.version('v3.16.0', '<')"
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Remove helm namespace
|
- name: Remove helm namespace
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
vars:
|
vars:
|
||||||
helm_namespace: "{{ test_namespace[3] }}"
|
helm_namespace: "{{ test_namespace[3] }}"
|
||||||
block:
|
block:
|
||||||
- name: Copy chart
|
- name: copy chart
|
||||||
ansible.builtin.copy:
|
copy:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
dest: /tmp
|
dest: /tmp
|
||||||
loop:
|
loop:
|
||||||
@@ -19,16 +19,16 @@
|
|||||||
chart_version: "{{ chart_source_version | default(omit) }}"
|
chart_version: "{{ chart_source_version | default(omit) }}"
|
||||||
namespace: "{{ helm_namespace }}"
|
namespace: "{{ helm_namespace }}"
|
||||||
dependency_update: false
|
dependency_update: false
|
||||||
create_namespace: true
|
create_namespace: yes
|
||||||
register: release
|
register: release
|
||||||
|
|
||||||
- name: "Get stats of the subchart"
|
- name: "Get stats of the subchart"
|
||||||
ansible.builtin.stat:
|
stat:
|
||||||
path: "/tmp/test-chart/Chart.lock"
|
path: "/tmp/test-chart/Chart.lock"
|
||||||
register: stat_result
|
register: stat_result
|
||||||
|
|
||||||
- name: "Check if the subchart not exist in chart"
|
- name: "Check if the subchart not exist in chart"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- not stat_result.stat.exists
|
- not stat_result.stat.exists
|
||||||
success_msg: "subchart not exist in the chart directory"
|
success_msg: "subchart not exist in the chart directory"
|
||||||
@@ -41,12 +41,12 @@
|
|||||||
chart_ref: "/tmp/test-chart"
|
chart_ref: "/tmp/test-chart"
|
||||||
chart_version: "{{ chart_source_version | default(omit) }}"
|
chart_version: "{{ chart_source_version | default(omit) }}"
|
||||||
namespace: "{{ helm_namespace }}"
|
namespace: "{{ helm_namespace }}"
|
||||||
create_namespace: true
|
create_namespace: yes
|
||||||
dependency_update: true
|
dependency_update: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: release
|
register: release
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
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."
|
- 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"
|
success_msg: "warning when there is no dependencies block with dependency_update enabled"
|
||||||
@@ -59,16 +59,16 @@
|
|||||||
chart_version: "{{ chart_source_version | default(omit) }}"
|
chart_version: "{{ chart_source_version | default(omit) }}"
|
||||||
namespace: "{{ helm_namespace }}"
|
namespace: "{{ helm_namespace }}"
|
||||||
dependency_update: true
|
dependency_update: true
|
||||||
create_namespace: true
|
create_namespace: yes
|
||||||
register: release
|
register: release
|
||||||
|
|
||||||
- name: "Get stats of the subchart"
|
- name: "Get stats of the subchart"
|
||||||
ansible.builtin.stat:
|
stat:
|
||||||
path: "/tmp/dep-up/Chart.lock"
|
path: "/tmp/dep-up/Chart.lock"
|
||||||
register: stat_result
|
register: stat_result
|
||||||
|
|
||||||
- name: "Check if the subchart exists in chart"
|
- name: "Check if the subchart exists in chart"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- stat_result.stat.exists
|
- stat_result.stat.exists
|
||||||
success_msg: "subchart exist in the chart directory"
|
success_msg: "subchart exist in the chart directory"
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: "Remove charts"
|
- name: "Remove charts"
|
||||||
ansible.builtin.file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
path: "/tmp/{{ item }}"
|
path: "/tmp/{{ item }}"
|
||||||
loop:
|
loop:
|
||||||
@@ -92,8 +92,8 @@
|
|||||||
# Helm_template module
|
# Helm_template module
|
||||||
- name: "Test dependency update for helm_template module"
|
- name: "Test dependency update for helm_template module"
|
||||||
block:
|
block:
|
||||||
- name: Copy chart
|
- name: copy chart
|
||||||
ansible.builtin.copy:
|
copy:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
dest: /tmp
|
dest: /tmp
|
||||||
loop:
|
loop:
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: "Get stats of the subchart"
|
- name: "Get stats of the subchart"
|
||||||
ansible.builtin.stat:
|
stat:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
register: stat_result
|
register: stat_result
|
||||||
loop:
|
loop:
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
- /tmp/dep_up/charts/test-chart/templates/configmap.yaml
|
- /tmp/dep_up/charts/test-chart/templates/configmap.yaml
|
||||||
|
|
||||||
- name: "Check if the subchart exist in chart"
|
- name: "Check if the subchart exist in chart"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- stat_result.results[0].stat.exists
|
- stat_result.results[0].stat.exists
|
||||||
- stat_result.results[1].stat.exists
|
- stat_result.results[1].stat.exists
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: "Get stats of the subchart"
|
- name: "Get stats of the subchart"
|
||||||
ansible.builtin.stat:
|
stat:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
register: stat_result
|
register: stat_result
|
||||||
loop:
|
loop:
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
- /tmp/test-chart/templates/configmap.yaml
|
- /tmp/test-chart/templates/configmap.yaml
|
||||||
|
|
||||||
- name: "Check if the subchart not exist in chart"
|
- name: "Check if the subchart not exist in chart"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- not stat_result.results[0].stat.exists
|
- not stat_result.results[0].stat.exists
|
||||||
- stat_result.results[1].stat.exists
|
- stat_result.results[1].stat.exists
|
||||||
@@ -152,7 +152,7 @@
|
|||||||
always:
|
always:
|
||||||
|
|
||||||
- name: "Remove charts"
|
- name: "Remove charts"
|
||||||
ansible.builtin.file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
path: "/tmp/{{ item }}"
|
path: "/tmp/{{ item }}"
|
||||||
loop:
|
loop:
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
chart_release_replaced_name: "test-{{ chart_name | default(source) }}-001"
|
chart_release_replaced_name: "test-{{ chart_name | default(source) }}-001"
|
||||||
block:
|
block:
|
||||||
- name: Create temp directory
|
- name: Create temp directory
|
||||||
ansible.builtin.tempfile:
|
tempfile:
|
||||||
state: directory
|
state: directory
|
||||||
register: tmpdir
|
register: tmpdir
|
||||||
|
|
||||||
- name: Set temp directory fact
|
- name: Set temp directory fact
|
||||||
ansible.builtin.set_fact:
|
set_fact:
|
||||||
temp_dir: "{{ tmpdir.path }}"
|
temp_dir: "{{ tmpdir.path }}"
|
||||||
|
|
||||||
- name: Check helm_info empty
|
- name: Check helm_info empty
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
register: empty_info
|
register: empty_info
|
||||||
|
|
||||||
- name: "Assert that no charts are installed with helm_info"
|
- name: "Assert that no charts are installed with helm_info"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- empty_info.status is undefined
|
- empty_info.status is undefined
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
register: install_fail
|
register: install_fail
|
||||||
|
|
||||||
- name: "Assert that Install fail {{ chart_test }} from {{ source }}"
|
- name: "Assert that Install fail {{ chart_test }} from {{ source }}"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install_fail is failed
|
- install_fail is failed
|
||||||
- "'Error: create: failed to create: namespaces \"' + helm_namespace + '\" not found' in install_fail.stderr"
|
- "'Error: create: failed to create: namespaces \"' + helm_namespace + '\" not found' in install_fail.stderr"
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
check_mode: true
|
check_mode: true
|
||||||
|
|
||||||
- name: "Assert that {{ chart_test }} chart is installed from {{ source }} in check mode"
|
- name: "Assert that {{ chart_test }} chart is installed from {{ source }} in check mode"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install_check_mode is changed
|
- install_check_mode is changed
|
||||||
- install_check_mode.status is defined
|
- install_check_mode.status is defined
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
register: install
|
register: install
|
||||||
|
|
||||||
- name: "Assert that {{ chart_test }} chart version {{ chart_test_version }} is installed from {{ source }}"
|
- name: "Assert that {{ chart_test }} chart version {{ chart_test_version }} is installed from {{ source }}"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- install.status.chart == chart_test+"-"+chart_test_version
|
- install.status.chart == chart_test+"-"+chart_test_version
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
register: release_state_content_info
|
register: release_state_content_info
|
||||||
|
|
||||||
- name: "Assert that {{ chart_test }} chart version {{ chart_test_version }} is installed from {{ source }} with helm_info"
|
- name: "Assert that {{ chart_test }} chart version {{ chart_test_version }} is installed from {{ source }} with helm_info"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- content_info.status.chart == chart_test+"-"+chart_test_version
|
- content_info.status.chart == chart_test+"-"+chart_test_version
|
||||||
- content_info.status.status | lower == 'deployed'
|
- content_info.status.status | lower == 'deployed'
|
||||||
@@ -111,7 +111,7 @@
|
|||||||
diff: true
|
diff: true
|
||||||
|
|
||||||
- name: Assert idempotency
|
- name: Assert idempotency
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is not changed
|
- install is not changed
|
||||||
- install.status.chart == chart_test+"-"+chart_test_version
|
- install.status.chart == chart_test+"-"+chart_test_version
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
register: install
|
register: install
|
||||||
|
|
||||||
- name: "Assert that {{ chart_test }} chart is upgraded with new var from {{ source }}"
|
- name: "Assert that {{ chart_test }} chart is upgraded with new var from {{ source }}"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
@@ -147,7 +147,7 @@
|
|||||||
diff: true
|
diff: true
|
||||||
|
|
||||||
- name: Assert idempotency after add vars
|
- name: Assert idempotency after add vars
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is not changed
|
- install is not changed
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
@@ -164,7 +164,7 @@
|
|||||||
register: install
|
register: install
|
||||||
|
|
||||||
- name: "Assert that {{ chart_test }} chart is upgraded with new var from {{ source }}"
|
- name: "Assert that {{ chart_test }} chart is upgraded with new var from {{ source }}"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
@@ -182,7 +182,7 @@
|
|||||||
diff: true
|
diff: true
|
||||||
|
|
||||||
- name: Assert idempotency after removing vars
|
- name: Assert idempotency after removing vars
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is not changed
|
- install is not changed
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
@@ -199,7 +199,7 @@
|
|||||||
register: install
|
register: install
|
||||||
|
|
||||||
- name: "Assert that {{ chart_test }} chart is upgraded with new version from {{ source }}"
|
- name: "Assert that {{ chart_test }} chart is upgraded with new version from {{ source }}"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
@@ -216,7 +216,7 @@
|
|||||||
diff: true
|
diff: true
|
||||||
|
|
||||||
- name: Assert idempotency after upgrade
|
- name: Assert idempotency after upgrade
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is not changed
|
- install is not changed
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
@@ -231,7 +231,7 @@
|
|||||||
register: install
|
register: install
|
||||||
|
|
||||||
- name: "Assert that {{ chart_test }} chart is removed from {{ source }}"
|
- name: "Assert that {{ chart_test }} chart is removed from {{ source }}"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@
|
|||||||
diff: true
|
diff: true
|
||||||
|
|
||||||
- name: Assert idempotency
|
- name: Assert idempotency
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is not changed
|
- install is not changed
|
||||||
|
|
||||||
@@ -260,7 +260,7 @@
|
|||||||
register: install
|
register: install
|
||||||
|
|
||||||
- name: "Assert that {{ chart_test }} chart is installed from {{ source }}"
|
- name: "Assert that {{ chart_test }} chart is installed from {{ source }}"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
|
|
||||||
@@ -269,12 +269,12 @@
|
|||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
state: absent
|
state: absent
|
||||||
name: "{{ chart_release_replaced_name }}"
|
name: "{{ chart_release_replaced_name }}"
|
||||||
purge: false
|
purge: False
|
||||||
namespace: "{{ helm_namespace }}"
|
namespace: "{{ helm_namespace }}"
|
||||||
register: install
|
register: install
|
||||||
|
|
||||||
- name: Check if chart is removed
|
- name: Check if chart is removed
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
|
|
||||||
@@ -285,11 +285,11 @@
|
|||||||
chart_ref: "{{ chart_source }}"
|
chart_ref: "{{ chart_source }}"
|
||||||
chart_version: "{{ chart_test_version }}"
|
chart_version: "{{ chart_test_version }}"
|
||||||
namespace: "{{ helm_namespace }}"
|
namespace: "{{ helm_namespace }}"
|
||||||
replace: true
|
replace: True
|
||||||
register: install
|
register: install
|
||||||
|
|
||||||
- name: "Assert that {{ chart_test }} chart is installed from {{ source }}"
|
- name: "Assert that {{ chart_test }} chart is installed from {{ source }}"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
|
|
||||||
@@ -302,7 +302,7 @@
|
|||||||
register: install
|
register: install
|
||||||
|
|
||||||
- name: Check if chart is removed
|
- name: Check if chart is removed
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
|
|
||||||
@@ -318,7 +318,7 @@
|
|||||||
register: install
|
register: install
|
||||||
|
|
||||||
- name: "Assert that {{ chart_test }} chart has var from {{ source }}"
|
- name: "Assert that {{ chart_test }} chart has var from {{ source }}"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
- install.status.status | lower == 'deployed'
|
- install.status.status | lower == 'deployed'
|
||||||
@@ -337,7 +337,7 @@
|
|||||||
register: install
|
register: install
|
||||||
|
|
||||||
- name: "Assert the result is consistent"
|
- name: "Assert the result is consistent"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- not (install is changed)
|
- not (install is changed)
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@
|
|||||||
- "{{ role_path }}/files/values.yaml"
|
- "{{ role_path }}/files/values.yaml"
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
- result is not failed
|
- result is not failed
|
||||||
@@ -366,11 +366,11 @@
|
|||||||
- result.command is match(helm_binary+" template "+chart_source)
|
- result.command is match(helm_binary+" template "+chart_source)
|
||||||
|
|
||||||
- name: Check templates created
|
- name: Check templates created
|
||||||
ansible.builtin.stat:
|
stat:
|
||||||
path: "{{ temp_dir }}/{{ chart_test }}/templates"
|
path: "{{ temp_dir }}/{{ chart_test }}/templates"
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
result.stat.exists
|
result.stat.exists
|
||||||
|
|
||||||
@@ -379,7 +379,7 @@
|
|||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
chart_ref: "{{ chart_source }}"
|
chart_ref: "{{ chart_source }}"
|
||||||
chart_version: "{{ chart_test_version }}"
|
chart_version: "{{ chart_test_version }}"
|
||||||
disable_hook: true
|
disable_hook: True
|
||||||
release_name: "myrelease"
|
release_name: "myrelease"
|
||||||
release_namespace: "myreleasenamespace"
|
release_namespace: "myreleasenamespace"
|
||||||
show_only:
|
show_only:
|
||||||
@@ -389,7 +389,7 @@
|
|||||||
register: result
|
register: result
|
||||||
when: chart_source is search("test-chart")
|
when: chart_source is search("test-chart")
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
- result is not failed
|
- result is not failed
|
||||||
@@ -412,14 +412,14 @@
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Assert that release fails with non-existent context
|
- name: Assert that release fails with non-existent context
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is failed
|
- result is failed
|
||||||
- "'context \"does-not-exist\" does not exist' in result.stderr"
|
- "'context \"does-not-exist\" does not exist' in result.stderr"
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Clean up temp dir
|
- name: Clean up temp dir
|
||||||
ansible.builtin.file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
path: "{{ temp_dir }}"
|
path: "{{ temp_dir }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
---
|
---
|
||||||
|
helm_binary: "/tmp/helm/{{ ansible_system | lower }}-amd64/helm"
|
||||||
helm_namespace: helm-diff
|
helm_namespace: helm-diff
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
---
|
---
|
||||||
dependencies:
|
dependencies:
|
||||||
- remove_namespace
|
- remove_namespace
|
||||||
|
- install_helm
|
||||||
- setup_helm_registry
|
- setup_helm_registry
|
||||||
- setup_helm
|
|
||||||
- setup_helm_version
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- connection: local
|
||||||
|
gather_facts: true
|
||||||
|
hosts: localhost
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- helm_diff
|
||||||
Executable
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eux
|
||||||
|
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
|
||||||
|
export ANSIBLE_ROLES_PATH=../
|
||||||
|
ansible-playbook playbook.yaml "$@"
|
||||||
@@ -1,8 +1,4 @@
|
|||||||
---
|
---
|
||||||
- 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
|
- name: Test helm diff functionality
|
||||||
vars:
|
vars:
|
||||||
test_chart_ref: "/tmp/test-chart"
|
test_chart_ref: "/tmp/test-chart"
|
||||||
@@ -14,11 +10,10 @@
|
|||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
state: present
|
state: present
|
||||||
plugin_path: https://github.com/databus23/helm-diff
|
plugin_path: https://github.com/databus23/helm-diff
|
||||||
verify: false
|
plugin_version: 3.9.13
|
||||||
plugin_version: "{{ helm_version | string is ansible.builtin.version('4.0.0', '>=') | ternary('3.14.0', '3.10.0') }}"
|
|
||||||
|
|
||||||
- name: Copy test chart
|
- name: Copy test chart
|
||||||
ansible.builtin.copy:
|
copy:
|
||||||
src: "test-chart/"
|
src: "test-chart/"
|
||||||
dest: "{{ test_chart_ref }}"
|
dest: "{{ test_chart_ref }}"
|
||||||
|
|
||||||
@@ -31,13 +26,13 @@
|
|||||||
create_namespace: true
|
create_namespace: true
|
||||||
register: install
|
register: install
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
|
|
||||||
- name: Modify local chart
|
- name: Modify local chart
|
||||||
ansible.builtin.blockinfile:
|
blockinfile:
|
||||||
create: true
|
create: yes
|
||||||
path: "{{ test_chart_ref }}/templates/anothermap.yaml"
|
path: "{{ test_chart_ref }}/templates/anothermap.yaml"
|
||||||
block: !unsafe |
|
block: !unsafe |
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
@@ -60,7 +55,7 @@
|
|||||||
- name: Check if helm diff check is correct
|
- name: Check if helm diff check is correct
|
||||||
vars:
|
vars:
|
||||||
foo_bar_value: "+ foo: bar"
|
foo_bar_value: "+ foo: bar"
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- foo_bar_value in diff_result.diff.prepared
|
- foo_bar_value in diff_result.diff.prepared
|
||||||
|
|
||||||
@@ -72,7 +67,7 @@
|
|||||||
chart_ref: "{{ test_chart_ref }}"
|
chart_ref: "{{ test_chart_ref }}"
|
||||||
register: install
|
register: install
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
|
|
||||||
@@ -82,12 +77,12 @@
|
|||||||
name: test-chart
|
name: test-chart
|
||||||
namespace: "{{ helm_namespace }}"
|
namespace: "{{ helm_namespace }}"
|
||||||
chart_ref: "{{ test_chart_ref }}"
|
chart_ref: "{{ test_chart_ref }}"
|
||||||
check_mode: true
|
check_mode: yes
|
||||||
diff: true
|
diff: true
|
||||||
register: diff_result
|
register: diff_result
|
||||||
|
|
||||||
- name: Check if no diff in check mode when no change
|
- name: Check if no diff in check mode when no change
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- '"diff" not in diff_result'
|
- '"diff" not in diff_result'
|
||||||
|
|
||||||
@@ -99,12 +94,12 @@
|
|||||||
chart_ref: "{{ test_chart_ref }}"
|
chart_ref: "{{ test_chart_ref }}"
|
||||||
register: install
|
register: install
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- install is not changed
|
- install is not changed
|
||||||
|
|
||||||
- name: Modify values
|
- name: Modify values
|
||||||
ansible.builtin.blockinfile:
|
blockinfile:
|
||||||
create: true
|
create: true
|
||||||
path: "{{ test_chart_ref }}/values.yml"
|
path: "{{ test_chart_ref }}/values.yml"
|
||||||
block: |
|
block: |
|
||||||
@@ -121,7 +116,7 @@
|
|||||||
- "{{ test_chart_ref }}/values.yml"
|
- "{{ test_chart_ref }}/values.yml"
|
||||||
register: install
|
register: install
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
|
|
||||||
@@ -135,7 +130,7 @@
|
|||||||
- "{{ test_chart_ref }}/values.yml"
|
- "{{ test_chart_ref }}/values.yml"
|
||||||
register: install
|
register: install
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- install is not changed
|
- install is not changed
|
||||||
|
|
||||||
@@ -151,7 +146,7 @@
|
|||||||
- "{{ test_chart_ref }}/values.yml"
|
- "{{ test_chart_ref }}/values.yml"
|
||||||
register: install
|
register: install
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
|
|
||||||
@@ -167,7 +162,7 @@
|
|||||||
- "{{ test_chart_ref }}/values.yml"
|
- "{{ test_chart_ref }}/values.yml"
|
||||||
register: install
|
register: install
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- install is not changed
|
- install is not changed
|
||||||
|
|
||||||
@@ -186,7 +181,7 @@
|
|||||||
value_type: string
|
value_type: string
|
||||||
register: install
|
register: install
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- install is changed
|
- install is changed
|
||||||
|
|
||||||
@@ -205,7 +200,7 @@
|
|||||||
value_type: string
|
value_type: string
|
||||||
register: install
|
register: install
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- install is not changed
|
- install is not changed
|
||||||
|
|
||||||
@@ -218,7 +213,7 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Define chart variables
|
- name: Define chart variables
|
||||||
ansible.builtin.set_fact:
|
set_fact:
|
||||||
test_chart_values:
|
test_chart_values:
|
||||||
myValue: 'Some ConfigMap data value'
|
myValue: 'Some ConfigMap data value'
|
||||||
myConfigmapName: 'ansible-config-from-url'
|
myConfigmapName: 'ansible-config-from-url'
|
||||||
@@ -252,9 +247,7 @@
|
|||||||
path: '{{ _tmpd.path }}'
|
path: '{{ _tmpd.path }}'
|
||||||
|
|
||||||
- name: Log into Helm registry
|
- name: Log into Helm registry
|
||||||
ansible.builtin.shell: >-
|
ansible.builtin.command: "{{ helm_binary }} registry login -u testuser -p 'pass123!' localhost:6035"
|
||||||
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
|
- name: Install chart from remote URL
|
||||||
helm:
|
helm:
|
||||||
@@ -264,7 +257,6 @@
|
|||||||
namespace: "{{ helm_namespace }}"
|
namespace: "{{ helm_namespace }}"
|
||||||
name: another-chart
|
name: another-chart
|
||||||
release_values: "{{ test_chart_values }}"
|
release_values: "{{ test_chart_values }}"
|
||||||
plain_http: "{{ helm_version | string is ansible.builtin.version('3.13.0', '>=') }}"
|
|
||||||
|
|
||||||
- name: Upgrade chart
|
- name: Upgrade chart
|
||||||
helm:
|
helm:
|
||||||
@@ -274,21 +266,44 @@
|
|||||||
namespace: "{{ helm_namespace }}"
|
namespace: "{{ helm_namespace }}"
|
||||||
name: another-chart
|
name: another-chart
|
||||||
release_values: "{{ test_chart_values }}"
|
release_values: "{{ test_chart_values }}"
|
||||||
plain_http: "{{ helm_version | string is ansible.builtin.version('3.13.0', '>=') }}"
|
|
||||||
check_mode: true
|
check_mode: true
|
||||||
register: _upgrade
|
register: _upgrade
|
||||||
|
|
||||||
- name: Assert that module raised a warning
|
- name: Assert that module raised a warning
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- not _upgrade.changed
|
- not _upgrade.changed
|
||||||
- _upgrade.warnings is defined
|
- _upgrade.warnings is defined
|
||||||
- _upgrade.warnings | length == 1
|
- _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."
|
- _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:
|
always:
|
||||||
- name: Remove chart directory
|
- name: Remove chart directory
|
||||||
ansible.builtin.file:
|
file:
|
||||||
path: "{{ test_chart_ref }}"
|
path: "{{ test_chart_ref }}"
|
||||||
state: absent
|
state: absent
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
@@ -309,7 +324,6 @@
|
|||||||
wait: true
|
wait: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- ansible.builtin.include_tasks: reuse_values.yml
|
- include_tasks: reuse_values.yml
|
||||||
|
|
||||||
- ansible.builtin.include_tasks: reset_then_reuse_values.yml
|
- 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
|
- name: Create temporary directory for helm chart
|
||||||
ansible.builtin.tempfile:
|
tempfile:
|
||||||
suffix: .helm
|
suffix: .helm
|
||||||
state: directory
|
state: directory
|
||||||
register: helm_dir
|
register: helm_dir
|
||||||
@@ -16,8 +16,7 @@
|
|||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
state: present
|
state: present
|
||||||
plugin_path: https://github.com/databus23/helm-diff
|
plugin_path: https://github.com/databus23/helm-diff
|
||||||
verify: false
|
plugin_version: 3.9.14
|
||||||
plugin_version: "{{ helm_version | string is ansible.builtin.version('4.0.0', '>=') | ternary('3.14.0', '3.10.0') }}"
|
|
||||||
|
|
||||||
- name: Copy test chart
|
- name: Copy test chart
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
@@ -59,7 +58,7 @@
|
|||||||
register: helm_upgrade
|
register: helm_upgrade
|
||||||
|
|
||||||
- name: Ensure task did not reported change
|
- name: Ensure task did not reported change
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- helm_upgrade is not changed
|
- helm_upgrade is not changed
|
||||||
|
|
||||||
@@ -76,7 +75,7 @@
|
|||||||
register: helm_upgrade
|
register: helm_upgrade
|
||||||
|
|
||||||
- name: Ensure task reported change
|
- name: Ensure task reported change
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- helm_upgrade is changed
|
- helm_upgrade is changed
|
||||||
|
|
||||||
@@ -89,24 +88,19 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Delete Helm folders
|
- name: Delete Helm folders
|
||||||
ansible.builtin.file:
|
file:
|
||||||
path: /tmp/helm/
|
path: /tmp/helm/
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Install old version of helm
|
- name: Install old version of helm
|
||||||
ansible.builtin.include_role:
|
ansible.builtin.include_role:
|
||||||
name: setup_helm
|
name: install_helm
|
||||||
vars:
|
vars:
|
||||||
setup_helm_version: "v3.8.0"
|
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)
|
- name: Upgrade helm release (with reset_then_reuse_values=true)
|
||||||
kubernetes.core.helm:
|
kubernetes.core.helm:
|
||||||
binary_path: "{{ helm_binary_path_v3_8_0 }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
chart_ref: "{{ test_chart_path }}"
|
chart_ref: "{{ test_chart_path }}"
|
||||||
reuse_values: false
|
reuse_values: false
|
||||||
reset_then_reuse_values: true
|
reset_then_reuse_values: true
|
||||||
@@ -118,26 +112,25 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Debug
|
- name: Debug
|
||||||
ansible.builtin.debug:
|
debug:
|
||||||
var: helm_upgrade
|
var: helm_upgrade
|
||||||
|
|
||||||
- name: Ensure warning for Helm version
|
- name: Ensure warning for Helm version
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- helm_upgrade is failed
|
- helm_upgrade is failed
|
||||||
- '"reset_then_reuse_values requires helm >= 3.14.0, current version is" in helm_upgrade.msg'
|
- '"reset_then_reuse_values requires helm >= 3.14.0, current version is" in helm_upgrade.msg'
|
||||||
|
|
||||||
- name: Install helm diff
|
- name: Install helm diff
|
||||||
helm_plugin:
|
helm_plugin:
|
||||||
binary_path: "{{ helm_binary_path_v3_8_0 }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
state: present
|
state: present
|
||||||
plugin_path: https://github.com/databus23/helm-diff
|
plugin_path: https://github.com/databus23/helm-diff
|
||||||
plugin_version: "3.8.0"
|
plugin_version: "3.8.0"
|
||||||
verify: false
|
|
||||||
|
|
||||||
- name: Upgrade helm release (with reset_then_reuse_values=true)
|
- name: Upgrade helm release (with reset_then_reuse_values=true)
|
||||||
kubernetes.core.helm:
|
kubernetes.core.helm:
|
||||||
binary_path: "{{ helm_binary_path_v3_8_0 }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
chart_ref: "{{ test_chart_path }}"
|
chart_ref: "{{ test_chart_path }}"
|
||||||
reuse_values: false
|
reuse_values: false
|
||||||
reset_then_reuse_values: true
|
reset_then_reuse_values: true
|
||||||
@@ -149,23 +142,23 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Debug
|
- name: Debug
|
||||||
ansible.builtin.debug:
|
debug:
|
||||||
var: helm_upgrade
|
var: helm_upgrade
|
||||||
|
|
||||||
- name: Ensure warning for Helm Diff version
|
- name: Ensure warning for Helm Diff version
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- helm_upgrade is failed
|
- helm_upgrade is failed
|
||||||
- '"reset_then_reuse_values requires helm diff >= 3.9.12, current version is" in helm_upgrade.msg'
|
- '"reset_then_reuse_values requires helm diff >= 3.9.12, current version is" in helm_upgrade.msg'
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Delete Helm folders
|
- name: Delete Helm folders
|
||||||
ansible.builtin.file:
|
file:
|
||||||
path: /tmp/helm/
|
path: /tmp/helm/
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Remove temporary directory
|
- name: Remove temporary directory
|
||||||
ansible.builtin.file:
|
file:
|
||||||
path: "{{ helm_dir.path }}"
|
path: "{{ helm_dir.path }}"
|
||||||
state: absent
|
state: absent
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Create temporary directory for helm chart
|
- name: Create temporary directory for helm chart
|
||||||
ansible.builtin.tempfile:
|
tempfile:
|
||||||
suffix: .helm
|
suffix: .helm
|
||||||
state: directory
|
state: directory
|
||||||
register: helm_dir
|
register: helm_dir
|
||||||
@@ -17,8 +17,7 @@
|
|||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
state: present
|
state: present
|
||||||
plugin_path: https://github.com/databus23/helm-diff
|
plugin_path: https://github.com/databus23/helm-diff
|
||||||
verify: false
|
plugin_version: 3.9.4
|
||||||
plugin_version: "{{ helm_version | string is ansible.builtin.version('4.0.0', '>=') | ternary('3.14.0', '3.10.0') }}"
|
|
||||||
|
|
||||||
- name: Copy test chart
|
- name: Copy test chart
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
@@ -51,7 +50,7 @@
|
|||||||
register: helm_upgrade
|
register: helm_upgrade
|
||||||
|
|
||||||
- name: Ensure task did not reported change
|
- name: Ensure task did not reported change
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- helm_upgrade is not changed
|
- helm_upgrade is not changed
|
||||||
|
|
||||||
@@ -67,7 +66,7 @@
|
|||||||
register: helm_upgrade
|
register: helm_upgrade
|
||||||
|
|
||||||
- name: Ensure task reported change
|
- name: Ensure task reported change
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- helm_upgrade is changed
|
- helm_upgrade is changed
|
||||||
|
|
||||||
|
|||||||
@@ -4,4 +4,7 @@ test_namespace:
|
|||||||
- "helm-in-memory-kubeconfig"
|
- "helm-in-memory-kubeconfig"
|
||||||
- "helm-kubeconfig-with-ca-cert"
|
- "helm-kubeconfig-with-ca-cert"
|
||||||
- "helm-kubeconfig-with-insecure-skip-tls-verify"
|
- "helm-kubeconfig-with-insecure-skip-tls-verify"
|
||||||
helm_binary: helm
|
helm_versions:
|
||||||
|
- v3.10.3
|
||||||
|
- v3.16.4
|
||||||
|
- v4.0.0
|
||||||
|
|||||||
@@ -1,2 +1,5 @@
|
|||||||
---
|
---
|
||||||
- ansible.builtin.include_tasks: run_tests.yml
|
- ansible.builtin.include_tasks: run_tests.yml
|
||||||
|
loop: "{{ helm_versions }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: helm_version
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
---
|
---
|
||||||
- name: Run tests
|
- name: Run tests with helm version "{{ helm_version }}"
|
||||||
block:
|
block:
|
||||||
|
- name: "Install Helm"
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: install_helm
|
||||||
|
|
||||||
- name: Test helm with in-memory kubeconfig
|
- name: Test helm with in-memory kubeconfig
|
||||||
ansible.builtin.include_tasks: "from_in_memory_kubeconfig.yml"
|
ansible.builtin.include_tasks: "from_in_memory_kubeconfig.yml"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
---
|
---
|
||||||
|
# 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).
|
||||||
|
helm_oci_version: v4.2.4
|
||||||
|
|
||||||
helm_oci_namespace: helm-oci-registry-progress
|
helm_oci_namespace: helm-oci-registry-progress
|
||||||
test_namespace: "{{ helm_oci_namespace }}"
|
test_namespace: "{{ helm_oci_namespace }}"
|
||||||
|
|
||||||
@@ -14,4 +18,3 @@ helm_oci_chart_version: 1.0.0+build.1
|
|||||||
# A version without build metadata, to cover the case where the progress messages
|
# 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.
|
# happen to be valid YAML and so corrupt the parsed output silently.
|
||||||
helm_oci_chart_version_plain: 1.0.1
|
helm_oci_chart_version_plain: 1.0.1
|
||||||
helm_binary: "helm"
|
|
||||||
|
|||||||
@@ -2,4 +2,3 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
- remove_namespace
|
- remove_namespace
|
||||||
- setup_helm_registry
|
- setup_helm_registry
|
||||||
- setup_helm_version
|
|
||||||
|
|||||||
@@ -12,12 +12,15 @@
|
|||||||
# messages. Without the fix, the helm task below fails with
|
# messages. Without the fix, the helm task below fails with
|
||||||
# "could not find expected ':'".
|
# "could not find expected ':'".
|
||||||
- name: Test OCI charts whose version contains build metadata
|
- 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:
|
vars:
|
||||||
chart_ref: "oci://{{ helm_oci_registry }}/{{ helm_oci_repo_path }}/{{ helm_oci_chart_name }}"
|
chart_ref: "oci://{{ helm_oci_registry }}/{{ helm_oci_repo_path }}/{{ helm_oci_chart_name }}"
|
||||||
block:
|
block:
|
||||||
|
- name: "Install Helm {{ helm_oci_version }}"
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: install_helm
|
||||||
|
vars:
|
||||||
|
helm_version: "{{ helm_oci_version }}"
|
||||||
|
|
||||||
- name: Create temporary directory to hold the chart
|
- name: Create temporary directory to hold the chart
|
||||||
ansible.builtin.tempfile:
|
ansible.builtin.tempfile:
|
||||||
state: directory
|
state: directory
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
redis*
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
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"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
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
@@ -1,6 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: test-chart-plain-http-configmap
|
|
||||||
data:
|
|
||||||
myValue: test
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
[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
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
dependencies:
|
|
||||||
- setup_namespace
|
|
||||||
- setup_helm_registry
|
|
||||||
- setup_helm_version
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
- 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
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
---
|
||||||
|
- 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
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eux
|
||||||
|
export ANSIBLE_ROLES_PATH=../
|
||||||
|
ansible-playbook playbooks/play.yaml -i inventory.ini "$@"
|
||||||
@@ -1,167 +0,0 @@
|
|||||||
---
|
|
||||||
- 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: "helm"
|
helm_binary: "/tmp/helm/{{ ansible_system | lower }}-amd64/helm"
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- connection: local
|
||||||
|
gather_facts: true
|
||||||
|
hosts: localhost
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- helm_plugin
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eux
|
||||||
|
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
|
||||||
|
export ANSIBLE_ROLES_PATH=../
|
||||||
|
ansible-playbook playbook.yaml "$@"
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
---
|
---
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
ansible.builtin.include_tasks: run_tests.yml
|
include_tasks: run_tests.yml
|
||||||
|
loop_control:
|
||||||
|
loop_var: helm_version
|
||||||
|
with_items:
|
||||||
|
- "v3.17.0"
|
||||||
|
- "v4.0.0"
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
---
|
---
|
||||||
|
- name: "Install {{ helm_version }}"
|
||||||
|
include_role:
|
||||||
|
name: install_helm
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Install env plugin in check mode
|
- name: Install env plugin in check mode
|
||||||
helm_plugin:
|
helm_plugin:
|
||||||
@@ -9,7 +13,7 @@
|
|||||||
register: check_install_env
|
register: check_install_env
|
||||||
check_mode: true
|
check_mode: true
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- check_install_env.changed
|
- check_install_env.changed
|
||||||
|
|
||||||
@@ -21,7 +25,7 @@
|
|||||||
verify: false
|
verify: false
|
||||||
register: install_env
|
register: install_env
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- install_env.changed
|
- install_env.changed
|
||||||
|
|
||||||
@@ -30,7 +34,7 @@
|
|||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
register: plugin_info
|
register: plugin_info
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- plugin_info.plugin_list is defined
|
- plugin_info.plugin_list is defined
|
||||||
|
|
||||||
@@ -42,7 +46,7 @@
|
|||||||
verify: false
|
verify: false
|
||||||
register: install_env
|
register: install_env
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- not install_env.changed
|
- not install_env.changed
|
||||||
|
|
||||||
@@ -55,7 +59,7 @@
|
|||||||
register: check_uninstall_env
|
register: check_uninstall_env
|
||||||
check_mode: true
|
check_mode: true
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- check_uninstall_env.changed
|
- check_uninstall_env.changed
|
||||||
|
|
||||||
@@ -66,7 +70,7 @@
|
|||||||
plugin_name: env
|
plugin_name: env
|
||||||
register: uninstall_env
|
register: uninstall_env
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- uninstall_env.changed
|
- uninstall_env.changed
|
||||||
|
|
||||||
@@ -77,7 +81,7 @@
|
|||||||
plugin_name: env
|
plugin_name: env
|
||||||
register: uninstall_env
|
register: uninstall_env
|
||||||
|
|
||||||
- ansible.builtin.assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- not uninstall_env.changed
|
- not uninstall_env.changed
|
||||||
|
|
||||||
@@ -91,7 +95,7 @@
|
|||||||
# https://github.com/ansible-collections/community.kubernetes/issues/399
|
# https://github.com/ansible-collections/community.kubernetes/issues/399
|
||||||
- block:
|
- block:
|
||||||
- name: Copy required plugin files
|
- name: Copy required plugin files
|
||||||
ansible.builtin.copy:
|
copy:
|
||||||
src: "files/sample_plugin"
|
src: "files/sample_plugin"
|
||||||
dest: "/tmp/helm_plugin_test/"
|
dest: "/tmp/helm_plugin_test/"
|
||||||
|
|
||||||
@@ -103,7 +107,7 @@
|
|||||||
register: sample_plugin_output
|
register: sample_plugin_output
|
||||||
|
|
||||||
- name: Assert that sample_plugin is installed or not
|
- name: Assert that sample_plugin is installed or not
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- sample_plugin_output.changed
|
- sample_plugin_output.changed
|
||||||
|
|
||||||
@@ -113,13 +117,13 @@
|
|||||||
register: r
|
register: r
|
||||||
|
|
||||||
- name: Set sample_plugin version
|
- name: Set sample_plugin version
|
||||||
ansible.builtin.set_fact:
|
set_fact:
|
||||||
plugin_version: "{{ ( r.plugin_list | selectattr('name', 'equalto', plugin_name) | list )[0].version }}"
|
plugin_version: "{{ ( r.plugin_list | selectattr('name', 'equalto', plugin_name) | list )[0].version }}"
|
||||||
vars:
|
vars:
|
||||||
plugin_name: "sample_plugin"
|
plugin_name: "sample_plugin"
|
||||||
|
|
||||||
- name: Assert if sample_plugin with multiline comment is installed
|
- name: Assert if sample_plugin with multiline comment is installed
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- plugin_version == "0.0.1"
|
- plugin_version == "0.0.1"
|
||||||
always:
|
always:
|
||||||
@@ -152,7 +156,7 @@
|
|||||||
register: plugin_list
|
register: plugin_list
|
||||||
|
|
||||||
- name: assert that unittest has been installed with specified version
|
- name: assert that unittest has been installed with specified version
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- plugin_list.plugin_list[0].version == "1.0.1"
|
- plugin_list.plugin_list[0].version == "1.0.1"
|
||||||
|
|
||||||
@@ -165,7 +169,7 @@
|
|||||||
check_mode: true
|
check_mode: true
|
||||||
|
|
||||||
- name: Assert that module reported change while running in check mode
|
- name: Assert that module reported change while running in check mode
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- _update_checkmode.changed
|
- _update_checkmode.changed
|
||||||
- '"Updated plugin: unittest" not in _update_checkmode.stdout'
|
- '"Updated plugin: unittest" not in _update_checkmode.stdout'
|
||||||
@@ -177,8 +181,8 @@
|
|||||||
state: latest
|
state: latest
|
||||||
register: _update
|
register: _update
|
||||||
|
|
||||||
- name: Assert update was performed
|
- name: assert update was performed
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- _update.changed
|
- _update.changed
|
||||||
- '"Updated plugin: unittest" in _update.stdout'
|
- '"Updated plugin: unittest" in _update.stdout'
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
helm_binary: helm
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
---
|
|
||||||
dependencies:
|
|
||||||
- setup_helm_version
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- connection: local
|
||||||
|
gather_facts: true
|
||||||
|
hosts: localhost
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- helm_pull
|
||||||
Executable
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eux
|
||||||
|
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
|
||||||
|
export ANSIBLE_ROLES_PATH=../
|
||||||
|
ansible-playbook playbook.yaml "$@"
|
||||||
@@ -1,83 +1,101 @@
|
|||||||
---
|
---
|
||||||
|
- name: Define helm versions to test
|
||||||
|
set_fact:
|
||||||
|
helm_versions:
|
||||||
|
- 3.8.0
|
||||||
|
- 3.1.0
|
||||||
|
- 3.0.0
|
||||||
|
- 4.0.0
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Create temp directory for helm tests
|
- name: Create temp directory for helm tests
|
||||||
ansible.builtin.tempfile:
|
tempfile:
|
||||||
state: directory
|
state: directory
|
||||||
register: tmpdir
|
register: tmpdir
|
||||||
|
|
||||||
- name: Set temp directory fact
|
- name: Set temp directory fact
|
||||||
ansible.builtin.set_fact:
|
set_fact:
|
||||||
temp_dir: "{{ tmpdir.path }}"
|
temp_dir: "{{ tmpdir.path }}"
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
destination: "{{ temp_dir }}"
|
||||||
|
|
||||||
|
- name: Install Helm versions
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: install_helm
|
||||||
|
loop: "{{ helm_versions }}"
|
||||||
|
vars:
|
||||||
|
helm_version: "v{{ item }}"
|
||||||
|
helm_install_path: "{{ temp_dir }}/{{ item }}"
|
||||||
|
|
||||||
# Testing helm pull with helm version == 3.0.0
|
# Testing helm pull with helm version == 3.0.0
|
||||||
- name: Run test with helm version '3.0.0'
|
- block:
|
||||||
when: helm_version | string is ansible.builtin.version('3.0.0', "==")
|
|
||||||
block:
|
|
||||||
- name: Download chart using chart_ssl_cert_file
|
- name: Download chart using chart_ssl_cert_file
|
||||||
helm_pull:
|
helm_pull:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_path }}"
|
||||||
chart_ref: https://github.com/grafana/helm-charts/releases/download/grafana-5.6.0/grafana-5.6.0.tgz
|
chart_ref: https://github.com/grafana/helm-charts/releases/download/grafana-5.6.0/grafana-5.6.0.tgz
|
||||||
destination: "{{ temp_dir }}"
|
destination: "{{ destination }}"
|
||||||
chart_ssl_cert_file: ssl_cert_file
|
chart_ssl_cert_file: ssl_cert_file
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
check_mode: true
|
check_mode: true
|
||||||
register: _result
|
register: _result
|
||||||
|
|
||||||
- name: Assert that module failed with proper message
|
- name: assert that module failed with proper message
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- _result is failed
|
- _result is failed
|
||||||
- _result.msg == "Parameter chart_ssl_cert_file requires helm >= 3.1.0, current version is 3.0.0"
|
- _result.msg == "Parameter chart_ssl_cert_file requires helm >= 3.1.0, current version is 3.0.0"
|
||||||
|
|
||||||
- name: Download chart using chart_ssl_key_file
|
- name: Download chart using chart_ssl_key_file
|
||||||
helm_pull:
|
helm_pull:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_path }}"
|
||||||
chart_ref: https://github.com/grafana/helm-charts/releases/download/grafana-5.6.0/grafana-5.6.0.tgz
|
chart_ref: https://github.com/grafana/helm-charts/releases/download/grafana-5.6.0/grafana-5.6.0.tgz
|
||||||
destination: "{{ temp_dir }}"
|
destination: "{{ destination }}"
|
||||||
chart_ssl_key_file: ssl_key_file
|
chart_ssl_key_file: ssl_key_file
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
check_mode: true
|
check_mode: true
|
||||||
register: _result
|
register: _result
|
||||||
|
|
||||||
- name: assert that module failed with proper message
|
- name: assert that module failed with proper message
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- _result is failed
|
- _result is failed
|
||||||
- _result.msg == "Parameter chart_ssl_key_file requires helm >= 3.1.0, current version is 3.0.0"
|
- _result.msg == "Parameter chart_ssl_key_file requires helm >= 3.1.0, current version is 3.0.0"
|
||||||
|
|
||||||
- name: Download chart using chart_ca_cert
|
- name: Download chart using chart_ca_cert
|
||||||
helm_pull:
|
helm_pull:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_path }}"
|
||||||
chart_ref: https://github.com/grafana/helm-charts/releases/download/grafana-5.6.0/grafana-5.6.0.tgz
|
chart_ref: https://github.com/grafana/helm-charts/releases/download/grafana-5.6.0/grafana-5.6.0.tgz
|
||||||
destination: "{{ temp_dir }}"
|
destination: "{{ destination }}"
|
||||||
chart_ca_cert: ca_cert_file
|
chart_ca_cert: ca_cert_file
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
check_mode: true
|
check_mode: true
|
||||||
register: _result
|
register: _result
|
||||||
|
|
||||||
- name: Assert that module failed with proper message
|
- name: assert that module failed with proper message
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- _result is failed
|
- _result is failed
|
||||||
- _result.msg == "Parameter chart_ca_cert requires helm >= 3.1.0, current version is 3.0.0"
|
- _result.msg == "Parameter chart_ca_cert requires helm >= 3.1.0, current version is 3.0.0"
|
||||||
|
|
||||||
|
vars:
|
||||||
|
helm_path: "{{ temp_dir }}/3.0.0/helm"
|
||||||
|
|
||||||
# Testing helm pull with helm version == 3.1.0
|
# Testing helm pull with helm version == 3.1.0
|
||||||
- name: Run test with helm version '3.1.0'
|
- block:
|
||||||
when: helm_version | string is ansible.builtin.version('3.1.0', "==")
|
|
||||||
block:
|
|
||||||
- name: Download chart using chart_ssl_cert_file, chart_ca_cert, chart_ssl_key_file
|
- name: Download chart using chart_ssl_cert_file, chart_ca_cert, chart_ssl_key_file
|
||||||
helm_pull:
|
helm_pull:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_path }}"
|
||||||
chart_ref: https://github.com/grafana/helm-charts/releases/download/grafana-5.6.0/grafana-5.6.0.tgz
|
chart_ref: https://github.com/grafana/helm-charts/releases/download/grafana-5.6.0/grafana-5.6.0.tgz
|
||||||
destination: "{{ temp_dir }}"
|
destination: "{{ destination }}"
|
||||||
chart_ssl_cert_file: ssl_cert_file
|
chart_ssl_cert_file: ssl_cert_file
|
||||||
chart_ssl_key_file: ssl_key_file
|
chart_ssl_key_file: ssl_key_file
|
||||||
chart_ca_cert: ca_cert_file
|
chart_ca_cert: ca_cert_file
|
||||||
check_mode: true
|
check_mode: true
|
||||||
register: _result
|
register: _result
|
||||||
|
|
||||||
- name: Assert that module failed with proper message
|
- name: assert that module failed with proper message
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- _result is changed
|
- _result is changed
|
||||||
- '"--ca-file ca_cert_file" in _result.command'
|
- '"--ca-file ca_cert_file" in _result.command'
|
||||||
@@ -86,31 +104,32 @@
|
|||||||
|
|
||||||
- name: Download chart using skip_tls_certs_check
|
- name: Download chart using skip_tls_certs_check
|
||||||
helm_pull:
|
helm_pull:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_path }}"
|
||||||
chart_ref: https://github.com/grafana/helm-charts/releases/download/grafana-5.6.0/grafana-5.6.0.tgz
|
chart_ref: https://github.com/grafana/helm-charts/releases/download/grafana-5.6.0/grafana-5.6.0.tgz
|
||||||
destination: "{{ temp_dir }}"
|
destination: "{{ destination }}"
|
||||||
skip_tls_certs_check: true
|
skip_tls_certs_check: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
check_mode: true
|
check_mode: true
|
||||||
register: _result
|
register: _result
|
||||||
|
|
||||||
- name: Assert that module failed with proper message
|
- name: assert that module failed with proper message
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- _result is failed
|
- _result is failed
|
||||||
- _result.msg == "Parameter skip_tls_certs_check requires helm >= 3.3.0, current version is 3.1.0"
|
- _result.msg == "Parameter skip_tls_certs_check requires helm >= 3.3.0, current version is 3.1.0"
|
||||||
|
|
||||||
|
vars:
|
||||||
|
helm_path: "{{ temp_dir }}/3.1.0/helm"
|
||||||
|
|
||||||
# Testing helm pull with helm version == 3.8.0
|
# Testing helm pull with helm version == 3.8.0
|
||||||
- name: Run test with helm version '3.8.0'
|
- block:
|
||||||
when: helm_version | string is ansible.builtin.version('3.8.0', "==")
|
|
||||||
block:
|
|
||||||
# Test options chart_version, verify, pass-credentials, provenance, untar_chart
|
# Test options chart_version, verify, pass-credentials, provenance, untar_chart
|
||||||
# skip_tls_certs_check, repo_url, repo_username, repo_password
|
# skip_tls_certs_check, repo_url, repo_username, repo_password
|
||||||
- name: Testing chart version
|
- name: Testing chart version
|
||||||
helm_pull:
|
helm_pull:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_path }}"
|
||||||
chart_ref: redis
|
chart_ref: redis
|
||||||
destination: "{{ temp_dir }}"
|
destination: "{{ destination }}"
|
||||||
chart_version: "0.2.1"
|
chart_version: "0.2.1"
|
||||||
verify_chart: true
|
verify_chart: true
|
||||||
pass_credentials: true
|
pass_credentials: true
|
||||||
@@ -124,8 +143,7 @@
|
|||||||
check_mode: true
|
check_mode: true
|
||||||
register: _result
|
register: _result
|
||||||
|
|
||||||
- name: Validate module results
|
- assert:
|
||||||
ansible.builtin.assert:
|
|
||||||
that:
|
that:
|
||||||
- _result is changed
|
- _result is changed
|
||||||
- '"--version 0.2.1" in _result.command'
|
- '"--version 0.2.1" in _result.command'
|
||||||
@@ -136,24 +154,24 @@
|
|||||||
- '"--insecure-skip-tls-verify" in _result.command'
|
- '"--insecure-skip-tls-verify" in _result.command'
|
||||||
- '"--repo https://charts.bitnami.com/bitnami" in _result.command'
|
- '"--repo https://charts.bitnami.com/bitnami" in _result.command'
|
||||||
- '"--username ansible" in _result.command'
|
- '"--username ansible" in _result.command'
|
||||||
- '"--password " in _result.command' # can be followed by '***' or '$REDACTED$'
|
- '"--password ***" in _result.command'
|
||||||
- '"--keyring pubring.gpg" in _result.command'
|
- '"--keyring pubring.gpg" in _result.command'
|
||||||
- '"Module did not set no_log for pass_credentials" not in _result.stderr'
|
- '"Module did not set no_log for pass_credentials" not in _result.stderr'
|
||||||
|
|
||||||
- name: Download chart using chart_ref
|
- name: Download chart using chart_ref
|
||||||
helm_pull:
|
helm_pull:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_path }}"
|
||||||
chart_ref: https://github.com/grafana/helm-charts/releases/download/grafana-5.6.0/grafana-5.6.0.tgz
|
chart_ref: https://github.com/grafana/helm-charts/releases/download/grafana-5.6.0/grafana-5.6.0.tgz
|
||||||
destination: "{{ temp_dir }}"
|
destination: "{{ destination }}"
|
||||||
register: _result
|
register: _result
|
||||||
|
|
||||||
- name: Check chart on local filesystem
|
- name: Check chart on local filesystem
|
||||||
ansible.builtin.stat:
|
stat:
|
||||||
path: "{{ temp_dir }}/grafana-5.6.0.tgz"
|
path: "{{ destination }}/grafana-5.6.0.tgz"
|
||||||
register: _chart
|
register: _chart
|
||||||
|
|
||||||
- name: Validate that chart was downloaded
|
- name: Validate that chart was downloaded
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- _result is changed
|
- _result is changed
|
||||||
- _chart.stat.exists
|
- _chart.stat.exists
|
||||||
@@ -161,19 +179,19 @@
|
|||||||
|
|
||||||
- name: Download chart using untar_chart
|
- name: Download chart using untar_chart
|
||||||
helm_pull:
|
helm_pull:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_path }}"
|
||||||
chart_ref: "oci://registry-1.docker.io/bitnamicharts/redis"
|
chart_ref: "oci://registry-1.docker.io/bitnamicharts/redis"
|
||||||
destination: "{{ temp_dir }}"
|
destination: "{{ destination }}"
|
||||||
untar_chart: true
|
untar_chart: true
|
||||||
register: _result
|
register: _result
|
||||||
|
|
||||||
- name: Check chart on local filesystem
|
- name: Check chart on local filesystem
|
||||||
ansible.builtin.stat:
|
stat:
|
||||||
path: "{{ temp_dir }}/redis"
|
path: "{{ destination }}/redis"
|
||||||
register: _chart
|
register: _chart
|
||||||
|
|
||||||
- name: Validate that chart was downloaded
|
- name: Validate that chart was downloaded
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- _result is changed
|
- _result is changed
|
||||||
- _chart.stat.exists
|
- _chart.stat.exists
|
||||||
@@ -182,22 +200,22 @@
|
|||||||
# Test idempotency with tarred chart
|
# Test idempotency with tarred chart
|
||||||
- name: Download chart with version (first time)
|
- name: Download chart with version (first time)
|
||||||
helm_pull:
|
helm_pull:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_path }}"
|
||||||
chart_ref: "oci://registry-1.docker.io/bitnamicharts/redis"
|
chart_ref: "oci://registry-1.docker.io/bitnamicharts/redis"
|
||||||
destination: "{{ temp_dir }}"
|
destination: "{{ destination }}"
|
||||||
chart_version: "24.1.0"
|
chart_version: "24.1.0"
|
||||||
register: _result_first
|
register: _result_first
|
||||||
|
|
||||||
- name: Download chart with version (second time - should be idempotent)
|
- name: Download chart with version (second time - should be idempotent)
|
||||||
helm_pull:
|
helm_pull:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_path }}"
|
||||||
chart_ref: "oci://registry-1.docker.io/bitnamicharts/redis"
|
chart_ref: "oci://registry-1.docker.io/bitnamicharts/redis"
|
||||||
destination: "{{ temp_dir }}"
|
destination: "{{ destination }}"
|
||||||
chart_version: "24.1.0"
|
chart_version: "24.1.0"
|
||||||
register: _result_second
|
register: _result_second
|
||||||
|
|
||||||
- name: Validate idempotency for tarred chart
|
- name: Validate idempotency for tarred chart
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- _result_first is changed
|
- _result_first is changed
|
||||||
- _result_second is not changed
|
- _result_second is not changed
|
||||||
@@ -205,77 +223,81 @@
|
|||||||
# Test force parameter with tarred chart
|
# Test force parameter with tarred chart
|
||||||
- name: Download chart with force=true (should always download)
|
- name: Download chart with force=true (should always download)
|
||||||
helm_pull:
|
helm_pull:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_path }}"
|
||||||
chart_ref: "oci://registry-1.docker.io/bitnamicharts/redis"
|
chart_ref: "oci://registry-1.docker.io/bitnamicharts/redis"
|
||||||
destination: "{{ temp_dir }}"
|
destination: "{{ destination }}"
|
||||||
chart_version: "24.1.0"
|
chart_version: "24.1.0"
|
||||||
force: true
|
force: true
|
||||||
register: _result_force
|
register: _result_force
|
||||||
|
|
||||||
- name: Validate force parameter causes download
|
- name: Validate force parameter causes download
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- _result_force is changed
|
- _result_force is changed
|
||||||
|
|
||||||
# Test idempotency with untarred chart in the separate folder
|
# Test idempotency with untarred chart in the separate folder
|
||||||
- name: Create separate directory for untar test under {{ temp_dir }}
|
- name: Create separate directory for untar test under {{ temp_dir }}
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ temp_dir }}/untar_test"
|
path: "{{ destination }}/untar_test"
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
|
|
||||||
- name: Download and untar chart (first time)
|
- name: Download and untar chart (first time)
|
||||||
helm_pull:
|
helm_pull:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_path }}"
|
||||||
chart_ref: "oci://registry-1.docker.io/bitnamicharts/redis"
|
chart_ref: "oci://registry-1.docker.io/bitnamicharts/redis"
|
||||||
destination: "{{ temp_dir }}/untar_test"
|
destination: "{{ destination }}/untar_test"
|
||||||
chart_version: "24.0.0"
|
chart_version: "24.0.0"
|
||||||
untar_chart: true
|
untar_chart: true
|
||||||
register: _result_untar_first
|
register: _result_untar_first
|
||||||
|
|
||||||
- name: Download and untar chart (second time - should be idempotent)
|
- name: Download and untar chart (second time - should be idempotent)
|
||||||
helm_pull:
|
helm_pull:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_path }}"
|
||||||
chart_ref: "oci://registry-1.docker.io/bitnamicharts/redis"
|
chart_ref: "oci://registry-1.docker.io/bitnamicharts/redis"
|
||||||
destination: "{{ temp_dir }}/untar_test"
|
destination: "{{ destination }}/untar_test"
|
||||||
chart_version: "24.0.0"
|
chart_version: "24.0.0"
|
||||||
untar_chart: true
|
untar_chart: true
|
||||||
register: _result_untar_second
|
register: _result_untar_second
|
||||||
|
|
||||||
- name: Validate idempotency for untarred chart
|
- name: Validate idempotency for untarred chart
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- _result_untar_first is changed
|
- _result_untar_first is changed
|
||||||
- _result_untar_second is not changed
|
- _result_untar_second is not changed
|
||||||
|
|
||||||
- name: Download and untar chart with force=true (should remove existing directory and re-extract)
|
- name: Download and untar chart with force=true (should remove existing directory and re-extract)
|
||||||
helm_pull:
|
helm_pull:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_path }}"
|
||||||
chart_ref: "oci://registry-1.docker.io/bitnamicharts/redis"
|
chart_ref: "oci://registry-1.docker.io/bitnamicharts/redis"
|
||||||
destination: "{{ temp_dir }}/untar_test"
|
destination: "{{ destination }}/untar_test"
|
||||||
chart_version: "24.0.0"
|
chart_version: "24.0.0"
|
||||||
untar_chart: true
|
untar_chart: true
|
||||||
force: true
|
force: true
|
||||||
register: _result_untar_force
|
register: _result_untar_force
|
||||||
|
|
||||||
- name: Validate first force extraction works
|
- name: Validate first force extraction works
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- _result_untar_force is changed
|
- _result_untar_force is changed
|
||||||
|
|
||||||
- name: Verify chart directory still exists after force re-extraction
|
- name: Verify chart directory still exists after force re-extraction
|
||||||
ansible.builtin.stat:
|
stat:
|
||||||
path: "{{ temp_dir }}/untar_test/redis"
|
path: "{{ destination }}/untar_test/redis"
|
||||||
register: _chart_after_force
|
register: _chart_after_force
|
||||||
|
|
||||||
- name: Validate chart directory exists
|
- name: Validate chart directory exists
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- _chart_after_force.stat.exists
|
- _chart_after_force.stat.exists
|
||||||
- _chart_after_force.stat.isdir
|
- _chart_after_force.stat.isdir
|
||||||
|
|
||||||
|
vars:
|
||||||
|
helm_path: "{{ temp_dir }}/3.8.0/helm"
|
||||||
|
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Delete temp directory
|
- name: Delete temp directory
|
||||||
ansible.builtin.file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
path: "{{ temp_dir }}"
|
path: "{{ temp_dir }}"
|
||||||
|
|||||||
@@ -7,4 +7,7 @@ wrong_password: 'WrongPassword'
|
|||||||
registry_name: oci_registry
|
registry_name: oci_registry
|
||||||
registry_port: 5002
|
registry_port: 5002
|
||||||
test_chart: https://github.com/grafana/helm-charts/releases/download/k8s-monitoring-1.6.8/k8s-monitoring-1.6.8.tgz
|
test_chart: https://github.com/grafana/helm-charts/releases/download/k8s-monitoring-1.6.8/k8s-monitoring-1.6.8.tgz
|
||||||
helm_binary: helm
|
helm_versions:
|
||||||
|
- v3.17.0
|
||||||
|
- v3.20.0
|
||||||
|
- v4.0.0
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
---
|
|
||||||
dependencies:
|
|
||||||
- setup_helm_version
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: Test helm_registry_auth module
|
||||||
|
hosts: localhost
|
||||||
|
connection: local
|
||||||
|
gather_facts: true
|
||||||
|
roles:
|
||||||
|
- helm_registry_auth
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eux
|
||||||
|
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
|
||||||
|
export ANSIBLE_ROLES_PATH=../
|
||||||
|
ansible-playbook playbook.yaml "$@"
|
||||||
@@ -44,6 +44,9 @@
|
|||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
ansible.builtin.include_tasks: run_tests.yml
|
ansible.builtin.include_tasks: run_tests.yml
|
||||||
|
loop: "{{ helm_versions }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: helm_version
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Stop and remove the registry
|
- name: Stop and remove the registry
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
---
|
---
|
||||||
- block:
|
- block:
|
||||||
|
- name: Install helm versions
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: install_helm
|
||||||
|
|
||||||
# - name: Test the registry with correct credentials to ensure that the registry is running
|
# - name: Test the registry with correct credentials to ensure that the registry is running
|
||||||
# ansible.builtin.shell: >-
|
# ansible.builtin.shell: >-
|
||||||
# echo {{ password | quote }} | {{ helm_binary }} registry login localhost:{{ registry_port }}
|
# echo {{ password | quote }} | {{ helm_binary }} registry login localhost:{{ registry_port }}
|
||||||
@@ -27,7 +31,7 @@
|
|||||||
# Helm < 4.2.1 prints success messages to stderr (https://github.com/helm/helm/issues/13464),
|
# Helm < 4.2.1 prints success messages to stderr (https://github.com/helm/helm/issues/13464),
|
||||||
# Helm >= 4.2.1 moves them to stdout (https://github.com/helm/helm/pull/32056).
|
# Helm >= 4.2.1 moves them to stdout (https://github.com/helm/helm/pull/32056).
|
||||||
# Check both streams to stay version-agnostic.
|
# Check both streams to stay version-agnostic.
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'Login Succeeded' in _helm_registry_auth_correct.stdout_lines + _helm_registry_auth_correct.stderr_lines"
|
- "'Login Succeeded' in _helm_registry_auth_correct.stdout_lines + _helm_registry_auth_correct.stderr_lines"
|
||||||
- password not in _helm_registry_auth_correct.command
|
- password not in _helm_registry_auth_correct.command
|
||||||
@@ -44,7 +48,7 @@
|
|||||||
# Helm < 4.2.1 prints success messages to stderr (https://github.com/helm/helm/issues/13464),
|
# Helm < 4.2.1 prints success messages to stderr (https://github.com/helm/helm/issues/13464),
|
||||||
# Helm >= 4.2.1 moves them to stdout (https://github.com/helm/helm/pull/32056).
|
# Helm >= 4.2.1 moves them to stdout (https://github.com/helm/helm/pull/32056).
|
||||||
# Check both streams to stay version-agnostic.
|
# Check both streams to stay version-agnostic.
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that: "'Pushed: localhost:' + registry_port | string + '/test/k8s-monitoring' in _save_chart.stdout + _save_chart.stderr"
|
that: "'Pushed: localhost:' + registry_port | string + '/test/k8s-monitoring' in _save_chart.stdout + _save_chart.stderr"
|
||||||
|
|
||||||
- name: Test logout
|
- name: Test logout
|
||||||
@@ -58,7 +62,7 @@
|
|||||||
# Helm < 4.2.1 prints success messages to stderr (https://github.com/helm/helm/issues/13464),
|
# Helm < 4.2.1 prints success messages to stderr (https://github.com/helm/helm/issues/13464),
|
||||||
# Helm >= 4.2.1 moves them to stdout (https://github.com/helm/helm/pull/32056).
|
# Helm >= 4.2.1 moves them to stdout (https://github.com/helm/helm/pull/32056).
|
||||||
# Check both streams to stay version-agnostic.
|
# Check both streams to stay version-agnostic.
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that: "'Removing login credentials' in _helm_registry_auth_logout.stdout + _helm_registry_auth_logout.stderr"
|
that: "'Removing login credentials' in _helm_registry_auth_logout.stdout + _helm_registry_auth_logout.stderr"
|
||||||
|
|
||||||
- name: Ensure that not able to push to the registry
|
- name: Ensure that not able to push to the registry
|
||||||
@@ -75,7 +79,7 @@
|
|||||||
- "_save_chart.rc != 0"
|
- "_save_chart.rc != 0"
|
||||||
|
|
||||||
- name: Test idempotency of logout with helm < 3.18.0
|
- name: Test idempotency of logout with helm < 3.18.0
|
||||||
when: helm_version | string is ansible.builtin.version('3.18.0', '<')
|
when: helm_version is ansible.builtin.version('v3.18.0', '<')
|
||||||
block:
|
block:
|
||||||
|
|
||||||
- name: Test logout idempotency
|
- name: Test logout idempotency
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
---
|
---
|
||||||
chart_test_repo: "https://kubernetes.github.io/ingress-nginx"
|
chart_test_repo: "https://kubernetes.github.io/ingress-nginx"
|
||||||
helm_binary: helm
|
helm_versions:
|
||||||
|
- v3.20.0
|
||||||
|
- v4.0.0
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- connection: local
|
||||||
|
gather_facts: true
|
||||||
|
hosts: localhost
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- helm_repository
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eux
|
||||||
|
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
|
||||||
|
export ANSIBLE_ROLES_PATH=../
|
||||||
|
ansible-playbook playbook.yaml "$@"
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Run test for helm_repository module
|
- name: Run test for helm_repository module
|
||||||
ansible.builtin.include_tasks: run_tests.yml
|
ansible.builtin.include_tasks: run_tests.yml
|
||||||
|
loop: "{{ helm_versions }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: helm_version
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
---
|
---
|
||||||
|
- name: "Install helm version {{ helm_version }}"
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: install_helm
|
||||||
|
|
||||||
- name: "Ensure test_helm_repo doesn't exist"
|
- name: "Ensure test_helm_repo doesn't exist"
|
||||||
helm_repository:
|
helm_repository:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
@@ -13,7 +17,7 @@
|
|||||||
register: repository
|
register: repository
|
||||||
|
|
||||||
- name: Assert that test_helm_repo repository is added
|
- name: Assert that test_helm_repo repository is added
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- repository is changed
|
- repository is changed
|
||||||
- '"--insecure-skip-tls-verify" not in repository.command'
|
- '"--insecure-skip-tls-verify" not in repository.command'
|
||||||
@@ -26,7 +30,7 @@
|
|||||||
register: repository
|
register: repository
|
||||||
|
|
||||||
- name: Assert idempotency
|
- name: Assert idempotency
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- repository is not changed
|
- repository is not changed
|
||||||
|
|
||||||
@@ -39,7 +43,7 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Assert that adding repository with the same name failed
|
- name: Assert that adding repository with the same name failed
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- repository_errors is failed
|
- repository_errors is failed
|
||||||
|
|
||||||
@@ -52,7 +56,7 @@
|
|||||||
register: repository
|
register: repository
|
||||||
|
|
||||||
- name: Assert that test_helm_repo repository is changed
|
- name: Assert that test_helm_repo repository is changed
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- repository is changed
|
- repository is changed
|
||||||
|
|
||||||
@@ -64,7 +68,7 @@
|
|||||||
register: repository
|
register: repository
|
||||||
|
|
||||||
- name: Assert that test_helm_repo repository is removed
|
- name: Assert that test_helm_repo repository is removed
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- repository is changed
|
- repository is changed
|
||||||
|
|
||||||
@@ -76,7 +80,7 @@
|
|||||||
register: repository
|
register: repository
|
||||||
|
|
||||||
- name: Assert idempotency
|
- name: Assert idempotency
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- repository is not changed
|
- repository is not changed
|
||||||
|
|
||||||
@@ -89,7 +93,7 @@
|
|||||||
register: repository
|
register: repository
|
||||||
|
|
||||||
- name: Assert that repository added and flag set
|
- name: Assert that repository added and flag set
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- repository is changed
|
- repository is changed
|
||||||
- '"--insecure-skip-tls-verify" in repository.command'
|
- '"--insecure-skip-tls-verify" in repository.command'
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
---
|
---
|
||||||
helm_namespace: helm-set-values
|
helm_namespace: helm-set-values
|
||||||
helm_binary: helm
|
helm_versions:
|
||||||
|
- v3.10.3
|
||||||
|
- v4.0.0
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
---
|
---
|
||||||
dependencies:
|
dependencies:
|
||||||
- remove_namespace
|
- remove_namespace
|
||||||
|
- install_helm
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- connection: local
|
||||||
|
gather_facts: true
|
||||||
|
hosts: localhost
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- helm_set_values
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eux
|
||||||
|
export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
|
||||||
|
export ANSIBLE_ROLES_PATH=../
|
||||||
|
ansible-playbook playbook.yaml "$@"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
- name: Install helm chart using set_values parameters
|
- name: Install helm using set_values parameters
|
||||||
helm:
|
helm:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
chart_ref: oci://registry-1.docker.io/bitnamicharts/mariadb
|
chart_ref: oci://registry-1.docker.io/bitnamicharts/mariadb
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
register: user_values
|
register: user_values
|
||||||
|
|
||||||
- name: Assert that release was created with user-defined variables
|
- name: Assert that release was created with user-defined variables
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- '"phase" in user_values.status["release_values"]'
|
- '"phase" in user_values.status["release_values"]'
|
||||||
- '"versioned" in user_values.status["release_values"]'
|
- '"versioned" in user_values.status["release_values"]'
|
||||||
@@ -27,15 +27,16 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: create temporary file to save values in
|
- name: create temporary file to save values in
|
||||||
ansible.builtin.tempfile:
|
tempfile:
|
||||||
suffix: .yml
|
suffix: .yml
|
||||||
register: ymlfile
|
register: ymlfile
|
||||||
|
|
||||||
- ansible.builtin.include_tasks: run_tests.yml
|
- ansible.builtin.include_tasks: run_tests.yml
|
||||||
|
loop: "{{ helm_versions }}"
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Delete temporary file
|
- name: Delete temporary file
|
||||||
ansible.builtin.file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
path: "{{ ymlfile.path }}"
|
path: "{{ ymlfile.path }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
---
|
---
|
||||||
- name: Install helm chart using set_values parameters
|
# install chart using set_values and release_values
|
||||||
|
- name: 'Install helm binary (> 3.10.0) requires to use set-json (helm_version={{ item }})'
|
||||||
|
include_role:
|
||||||
|
name: install_helm
|
||||||
|
vars:
|
||||||
|
helm_version: "{{ item }}"
|
||||||
|
|
||||||
|
- name: Install helm using set_values parameters
|
||||||
helm:
|
helm:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
chart_ref: oci://registry-1.docker.io/bitnamicharts/apache
|
chart_ref: oci://registry-1.docker.io/bitnamicharts/apache
|
||||||
release_name: 'test-apache'
|
release_name: 'test-apache-{{ item }}'
|
||||||
release_namespace: "{{ helm_namespace }}"
|
release_namespace: "{{ helm_namespace }}"
|
||||||
create_namespace: true
|
create_namespace: true
|
||||||
set_values:
|
set_values:
|
||||||
@@ -15,12 +22,12 @@
|
|||||||
- name: Get release info
|
- name: Get release info
|
||||||
helm_info:
|
helm_info:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
release_name: 'test-apache'
|
release_name: 'test-apache-{{ item }}'
|
||||||
release_namespace: "{{ helm_namespace }}"
|
release_namespace: "{{ helm_namespace }}"
|
||||||
register: values
|
register: values
|
||||||
|
|
||||||
- name: Assert that release was created with user-defined variables
|
- name: Assert that release was created with user-defined variables
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- values.status["release_values"].replicaCount == 3
|
- values.status["release_values"].replicaCount == 3
|
||||||
- values.status["release_values"].master.image.registry == "docker.io"
|
- values.status["release_values"].master.image.registry == "docker.io"
|
||||||
@@ -28,8 +35,8 @@
|
|||||||
- values.status["release_values"].master.image.tag == "2.4.54-debian-11-r74"
|
- values.status["release_values"].master.image.tag == "2.4.54-debian-11-r74"
|
||||||
|
|
||||||
# install chart using set_values and values_files
|
# install chart using set_values and values_files
|
||||||
- name: Copy content into values file
|
- name: copy content into values file
|
||||||
ansible.builtin.copy:
|
copy:
|
||||||
content: |
|
content: |
|
||||||
---
|
---
|
||||||
mode: distributed
|
mode: distributed
|
||||||
@@ -39,7 +46,7 @@
|
|||||||
helm:
|
helm:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
chart_ref: oci://registry-1.docker.io/bitnamicharts/minio
|
chart_ref: oci://registry-1.docker.io/bitnamicharts/minio
|
||||||
release_name: 'test-minio'
|
release_name: 'test-minio-{{ item }}'
|
||||||
release_namespace: "{{ helm_namespace }}"
|
release_namespace: "{{ helm_namespace }}"
|
||||||
create_namespace: true
|
create_namespace: true
|
||||||
set_values:
|
set_values:
|
||||||
@@ -50,12 +57,12 @@
|
|||||||
- name: Get release info
|
- name: Get release info
|
||||||
helm_info:
|
helm_info:
|
||||||
binary_path: "{{ helm_binary }}"
|
binary_path: "{{ helm_binary }}"
|
||||||
release_name: 'test-minio'
|
release_name: 'test-minio-{{ item }}'
|
||||||
release_namespace: "{{ helm_namespace }}"
|
release_namespace: "{{ helm_namespace }}"
|
||||||
register: values
|
register: values
|
||||||
|
|
||||||
- name: Assert that release was created with user-defined variables
|
- name: Assert that release was created with user-defined variables
|
||||||
ansible.builtin.assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- values.status["release_values"].mode == "distributed"
|
- values.status["release_values"].mode == "distributed"
|
||||||
- values.status["release_values"].disableWebUI is true
|
- values.status["release_values"].disableWebUI is true
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
time=40
|
|
||||||
helm
|
|
||||||
helm_info
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
---
|
|
||||||
helm_binary: helm
|
|
||||||
helm_namespace: helm-uninstall
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
---
|
|
||||||
dependencies:
|
|
||||||
- remove_namespace
|
|
||||||
- setup_helm_version
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
- 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"
|
|
||||||
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: true
|
|
||||||
register: uninstall
|
|
||||||
|
|
||||||
- name: Assert chart was uninstalled
|
|
||||||
ansible.builtin.assert:
|
|
||||||
that:
|
|
||||||
- uninstall is changed
|
|
||||||
|
|
||||||
- when: helm_version | string is ansible.builtin.version('4.0.0', '<')
|
|
||||||
block:
|
|
||||||
- name: Install Helm v4
|
|
||||||
ansible.builtin.include_role:
|
|
||||||
name: setup_helm
|
|
||||||
vars:
|
|
||||||
setup_helm_version: v4.0.0
|
|
||||||
|
|
||||||
- name: Install chart
|
|
||||||
helm:
|
|
||||||
binary_path: "{{ setup_helm_binary_path }}"
|
|
||||||
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: "{{ setup_helm_binary_path }}"
|
|
||||||
name: "{{ chart_name }}"
|
|
||||||
namespace: "{{ helm_namespace }}"
|
|
||||||
wait: true
|
|
||||||
register: uninstall
|
|
||||||
|
|
||||||
# Test uninstall chart release with 'pending-install' status
|
|
||||||
- name: Create chart release with 'pending-install' status
|
|
||||||
helm_test_pending:
|
|
||||||
binary_path: "{{ setup_helm_binary_path }}"
|
|
||||||
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: "{{ setup_helm_binary_path }}"
|
|
||||||
release_name: "{{ chart_name_pending }}"
|
|
||||||
namespace: "{{ helm_namespace }}"
|
|
||||||
release_state: absent
|
|
||||||
register: _uninstall
|
|
||||||
|
|
||||||
- name: Get Helm release details
|
|
||||||
helm_info:
|
|
||||||
binary_path: "{{ setup_helm_binary_path }}"
|
|
||||||
release_namespace: "{{ helm_namespace }}"
|
|
||||||
release_state: pending
|
|
||||||
release_name: "{{ chart_name_pending }}"
|
|
||||||
register: _info
|
|
||||||
|
|
||||||
- name: Assert release does not exist anymore
|
|
||||||
ansible.builtin.assert:
|
|
||||||
that:
|
|
||||||
- _uninstall is changed
|
|
||||||
- _info.status is undefined
|
|
||||||
|
|
||||||
always:
|
|
||||||
- name: Remove namespace
|
|
||||||
k8s:
|
|
||||||
kind: Namespace
|
|
||||||
name: "{{ helm_namespace }}"
|
|
||||||
state: absent
|
|
||||||
ignore_errors: true
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
helm
|
||||||
|
helm_template
|
||||||
|
helm_info
|
||||||
|
helm_repository
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user