summaryrefslogtreecommitdiffstats
path: root/ansible_collections/kubernetes/core/tests/integration/targets
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/kubernetes/core/tests/integration/targets')
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm/defaults/main.yml2
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm/library/helm_test_pending.py130
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm/library/helm_test_version.py4
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm/playbook.yaml7
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/helm/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/run_test.yml6
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/test_helm_reuse_values.yml75
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/test_helm_uninstall.yml31
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/test_helm_with_space_into_chart_name.yml58
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/files/test-chart-reuse-values/Chart.yaml24
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/files/test-chart-reuse-values/templates/configmap.yaml7
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/files/test-chart-reuse-values/values.yaml2
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/playbook.yaml7
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/helm_diff/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/tasks/main.yml45
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/tasks/reuse_values.yml93
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/meta/main.yml1
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/playbook.yaml7
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm_plugin/playbook.yaml7
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/helm_plugin/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm_pull/playbook.yaml7
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/helm_pull/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm_repository/playbook.yaml7
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/helm_repository/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm_set_values/meta/main.yml1
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/helm_set_values/playbook.yaml7
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/helm_set_values/runme.sh5
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/inventory_k8s/runme.sh1
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_access_review/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_access_review/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_append_hash/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_append_hash/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_apply/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_apply/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_check_mode/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_check_mode/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_cluster_info/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_cluster_info/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/library/k8s_create_file.py93
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/library/kubectl_file_compare.py5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/tasks/test_copy_large_file.yml15
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_crd/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_crd/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/files/deployments.yaml70
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/tasks/main.yml71
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_diff/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_diff/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_drain/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_drain/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_drain/tasks/main.yml85
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_exec/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_exec/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_full/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_full/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_gc/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_gc/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_generate_name/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_generate_name/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/aliases3
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/defaults/main.yml12
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/meta/main.yml2
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/tasks/main.yml108
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_info/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/tasks/wait.yml2
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_json_patch/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_json_patch/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_label_selectors/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_label_selectors/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_lists/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_lists/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_log/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_log/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_manifest_url/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_manifest_url/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_merge_type/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_merge_type/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_patched/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_patched/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_rollback/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_rollback/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_scale/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_scale/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_scale/tasks/main.yml65
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_taint/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_taint/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_template/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_template/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_user_impersonation/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_user_impersonation/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_validate/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_validate/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_validate/tasks/main.yml1
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/k8s_waiter/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/k8s_waiter/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/lookup_k8s/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/lookup_k8s/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/lookup_kustomize/playbook.yaml6
-rwxr-xr-xansible_collections/kubernetes/core/tests/integration/targets/lookup_kustomize/runme.sh5
-rw-r--r--ansible_collections/kubernetes/core/tests/integration/targets/setup_kubeconfig/library/test_inventory_read_credentials.py2
107 files changed, 1340 insertions, 110 deletions
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm/defaults/main.yml b/ansible_collections/kubernetes/core/tests/integration/targets/helm/defaults/main.yml
index ae860ce85..39841cce6 100644
--- a/ansible_collections/kubernetes/core/tests/integration/targets/helm/defaults/main.yml
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm/defaults/main.yml
@@ -24,3 +24,5 @@ test_namespace:
- "helm-local-path-003"
- "helm-from-repository"
- "helm-from-url"
+ - "helm-reuse-values"
+ - "helm-chart-with-space-into-name"
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm/library/helm_test_pending.py b/ansible_collections/kubernetes/core/tests/integration/targets/helm/library/helm_test_pending.py
new file mode 100644
index 000000000..cc8bde7f9
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm/library/helm_test_pending.py
@@ -0,0 +1,130 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# Copyright: (c) 2023, Ansible Project
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+
+DOCUMENTATION = r"""
+---
+module: helm_test_pending
+short_description: created pending-install release
+author:
+ - Aubin Bikouo (@abikouo)
+requirements:
+ - "helm (https://github.com/helm/helm/releases)"
+description:
+ - This module is used to create a pending install release for integration testing
+ - The scope of this module is the integration testing of the kubernetes.core collection only.
+options:
+ binary_path:
+ description:
+ - The path of a helm binary to use.
+ required: true
+ type: path
+ chart_ref:
+ description:
+ - chart reference on chart repository (e.g. my-repo/my-chart-ref)
+ required: true
+ type: str
+ chart_release:
+ description:
+ - Release name to manage.
+ required: true
+ type: str
+ chart_release_namespace:
+ description:
+ - Kubernetes namespace where the chart should be installed.
+ required: true
+ type: str
+"""
+
+EXAMPLES = r"""
+"""
+
+RETURN = r"""
+"""
+
+import json
+import subprocess
+import time
+
+from ansible.module_utils.basic import AnsibleModule
+
+
+class HelmReleaseNotFoundError(Exception):
+ def __init__(self, message):
+ super().__init__(message)
+
+
+def create_pending_install_release(helm_binary, chart_ref, chart_release, namespace):
+ # create pending-install release
+ command = [
+ helm_binary,
+ "install",
+ chart_release,
+ chart_ref,
+ "--namespace",
+ namespace,
+ "--wait",
+ ]
+ proc = subprocess.Popen(command)
+ time.sleep(2)
+ proc.kill()
+ # ensure release status is pending-install
+ command = [
+ helm_binary,
+ "list",
+ "--all",
+ "--output=json",
+ "--namespace",
+ namespace,
+ "--filter",
+ chart_release,
+ ]
+ cmd = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ out, err = cmd.communicate()
+
+ data = json.loads(out)
+ if not data:
+ error = "Release %s not found." % chart_release
+ raise HelmReleaseNotFoundError(message=error)
+ return data[0]["status"] == "pending-install", data[0]["status"]
+
+
+def main():
+ module = AnsibleModule(
+ argument_spec=dict(
+ binary_path=dict(type="path", required=True),
+ chart_ref=dict(type="str", required=True),
+ chart_release=dict(type="str", required=True),
+ chart_release_namespace=dict(type="str", required=True),
+ ),
+ )
+
+ params = dict(
+ helm_binary=module.params.get("binary_path"),
+ chart_release=module.params.get("chart_release"),
+ chart_ref=module.params.get("chart_ref"),
+ namespace=module.params.get("chart_release_namespace"),
+ )
+
+ try:
+ result, status = create_pending_install_release(**params)
+ if not result:
+ module.fail_json(
+ msg="unable to create pending-install release, current status is %s"
+ % status
+ )
+ module.exit_json(changed=True, msg="Release created with status '%s'" % status)
+ except HelmReleaseNotFoundError as err:
+ module.fail_json(
+ msg="Error while trying to create pending-install release due to '%s'" % err
+ )
+
+
+if __name__ == "__main__":
+ main()
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm/library/helm_test_version.py b/ansible_collections/kubernetes/core/tests/integration/targets/helm/library/helm_test_version.py
index dfd9a0860..1ac12e0f6 100644
--- a/ansible_collections/kubernetes/core/tests/integration/targets/helm/library/helm_test_version.py
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm/library/helm_test_version.py
@@ -52,12 +52,12 @@ result:
"""
import re
+
+from ansible.module_utils.basic import AnsibleModule
from ansible_collections.kubernetes.core.plugins.module_utils.version import (
LooseVersion,
)
-from ansible.module_utils.basic import AnsibleModule
-
def main():
module = AnsibleModule(
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/helm/playbook.yaml
new file mode 100644
index 000000000..92e2e48b1
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm/playbook.yaml
@@ -0,0 +1,7 @@
+---
+- connection: local
+ gather_facts: true
+ hosts: localhost
+
+ roles:
+ - helm
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/helm/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/run_test.yml b/ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/run_test.yml
index 545b25c8e..76d55b22c 100644
--- a/ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/run_test.yml
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/run_test.yml
@@ -25,12 +25,18 @@
- from_repository
- from_url
+- name: test helm upgrade with reuse_values
+ include_tasks: test_helm_reuse_values.yml
+
- name: test helm dependency update
include_tasks: test_up_dep.yml
- name: Test helm uninstall
include_tasks: test_helm_uninstall.yml
+- name: Test helm install with chart name containing space
+ include_tasks: test_helm_with_space_into_chart_name.yml
+
# https://github.com/ansible-collections/community.kubernetes/issues/296
- name: Test Skip CRDS feature in helm chart install
include_tasks: test_crds.yml
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/test_helm_reuse_values.yml b/ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/test_helm_reuse_values.yml
new file mode 100644
index 000000000..9384fd4f4
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/test_helm_reuse_values.yml
@@ -0,0 +1,75 @@
+---
+- name: Test helm reuse_values
+ vars:
+ helm_namespace: "{{ test_namespace[9] }}"
+ chart_release_values:
+ replica:
+ replicaCount: 3
+ master:
+ count: 1
+ kind: Deployment
+ chart_reuse_values:
+ replica:
+ replicaCount: 1
+ master:
+ count: 3
+ block:
+ - name: Initial chart installation
+ helm:
+ binary_path: "{{ helm_binary }}"
+ chart_ref: redis
+ chart_repo_url: https://charts.bitnami.com/bitnami
+ release_name: test-redis
+ release_namespace: "{{ helm_namespace }}"
+ create_namespace: true
+ release_values: "{{ chart_release_values }}"
+ register: install
+
+ - name: Get value set as string
+ helm_info:
+ binary_path: "{{ helm_binary }}"
+ release_name: test-redis
+ release_namespace: "{{ helm_namespace }}"
+ register: release_value
+
+ - name: Validate that chart values are as expected
+ assert:
+ that:
+ - install is changed
+ - '"--reuse-values=True" not in install.command'
+ - release_value["status"]["values"] == chart_release_values
+
+ - name: Upgrade chart using reuse_values=true
+ helm:
+ binary_path: "{{ helm_binary }}"
+ chart_ref: redis
+ chart_repo_url: https://charts.bitnami.com/bitnami
+ release_name: test-redis
+ release_namespace: "{{ helm_namespace }}"
+ reuse_values: true
+ reset_values: false
+ release_values: "{{ chart_reuse_values }}"
+ register: upgrade
+
+ - name: Get value set as string
+ helm_info:
+ binary_path: "{{ helm_binary }}"
+ release_name: test-redis
+ release_namespace: "{{ helm_namespace }}"
+ register: release_value
+
+ - name: Validate that chart values are as expected
+ assert:
+ that:
+ - upgrade is changed
+ - '"--reuse-values=True" in upgrade.command'
+ - '"--reset-values" not in upgrade.command'
+ - release_value["status"]["values"] == chart_release_values | combine(chart_reuse_values, recursive=true)
+
+ always:
+ - name: Remove helm namespace
+ k8s:
+ api_version: v1
+ kind: Namespace
+ name: "{{ helm_namespace }}"
+ state: absent
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/test_helm_uninstall.yml b/ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/test_helm_uninstall.yml
index e82891e4d..23e36fb0e 100644
--- a/ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/test_helm_uninstall.yml
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/test_helm_uninstall.yml
@@ -7,6 +7,7 @@
- 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:
@@ -64,6 +65,36 @@
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: Delete temp directory
file:
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/test_helm_with_space_into_chart_name.yml b/ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/test_helm_with_space_into_chart_name.yml
new file mode 100644
index 000000000..fcf867665
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm/tasks/test_helm_with_space_into_chart_name.yml
@@ -0,0 +1,58 @@
+---
+- name: Create test directory
+ ansible.builtin.tempfile:
+ state: directory
+ suffix: .helm
+ register: test_dir
+
+- name: Test helm using directory with space
+ vars:
+ helm_dir: "{{ test_dir.path }}/Deploy Chart"
+ helm_namespace: "{{ test_namespace[10] }}"
+ chart_release_name: "deploy-chart-with-space-into-name"
+ helm_local_src: "test-chart"
+ block:
+ - name: Copy helm file into destination
+ ansible.builtin.copy:
+ src: "{{ helm_local_src }}"
+ dest: "{{ helm_dir }}"
+
+ - name: Install chart from local source with Space into name
+ helm:
+ binary_path: "{{ helm_binary }}"
+ name: "{{ chart_release_name }}"
+ chart_ref: "{{ helm_dir }}/{{ helm_local_src | basename }}"
+ namespace: "{{ helm_namespace }}"
+ create_namespace: true
+ register: install_chart
+
+ - name: Assert that chart is installed
+ assert:
+ that:
+ - install_chart is changed
+ - install_chart.status.status | lower == 'deployed'
+
+ - name: Check helm_info content
+ helm_info:
+ binary_path: "{{ helm_binary }}"
+ name: "{{ chart_release_name }}"
+ namespace: "{{ helm_namespace }}"
+ register: chart_info
+
+ - name: Assert that Chart is installed (using helm_info)
+ assert:
+ that:
+ - chart_info.status.status | lower == 'deployed'
+
+ always:
+ - name: Delete temporary directory
+ ansible.builtin.file:
+ state: absent
+ name: "{{ test_dir.path }}"
+
+ - name: Remove helm namespace
+ k8s:
+ api_version: v1
+ kind: Namespace
+ name: "{{ helm_namespace }}"
+ state: absent
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/files/test-chart-reuse-values/Chart.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/files/test-chart-reuse-values/Chart.yaml
new file mode 100644
index 000000000..c3681dba0
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/files/test-chart-reuse-values/Chart.yaml
@@ -0,0 +1,24 @@
+apiVersion: v2
+name: chart-reuse-values
+description: A Helm chart for Kubernetes
+
+# A chart can be either an 'application' or a 'library' chart.
+#
+# Application charts are a collection of templates that can be packaged into versioned archives
+# to be deployed.
+#
+# Library charts provide useful utilities or functions for the chart developer. They're included as
+# a dependency of application charts to inject those utilities and functions into the rendering
+# pipeline. Library charts do not define any templates and therefore cannot be deployed.
+type: application
+
+# This is the chart version. This version number should be incremented each time you make changes
+# to the chart and its templates, including the app version.
+# Versions are expected to follow Semantic Versioning (https://semver.org/)
+version: 0.1.0
+
+# This is the version number of the application being deployed. This version number should be
+# incremented each time you make changes to the application. Versions are not expected to
+# follow Semantic Versioning. They should reflect the version the application is using.
+# It is recommended to use it with quotes.
+appVersion: "1.16.0"
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/files/test-chart-reuse-values/templates/configmap.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/files/test-chart-reuse-values/templates/configmap.yaml
new file mode 100644
index 000000000..4bbad8d69
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/files/test-chart-reuse-values/templates/configmap.yaml
@@ -0,0 +1,7 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: cmap
+data:
+ ansible_version: {{ .Values.ansible_version }}
+ phase: {{ .Values.phase }}
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/files/test-chart-reuse-values/values.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/files/test-chart-reuse-values/values.yaml
new file mode 100644
index 000000000..f2cd9d72b
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/files/test-chart-reuse-values/values.yaml
@@ -0,0 +1,2 @@
+ansible_version: milestone
+phase: uat
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/playbook.yaml
new file mode 100644
index 000000000..cb953721a
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/playbook.yaml
@@ -0,0 +1,7 @@
+---
+- connection: local
+ gather_facts: true
+ hosts: localhost
+
+ roles:
+ - helm_diff
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/tasks/main.yml b/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/tasks/main.yml
index d54d0ba72..c37d947f5 100644
--- a/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/tasks/main.yml
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/tasks/main.yml
@@ -143,6 +143,8 @@
chart_ref: "{{ test_chart_ref }}"
values:
foo: gaz
+ values_files:
+ - "{{ test_chart_ref }}/values.yml"
register: install
- assert:
@@ -157,6 +159,46 @@
chart_ref: "{{ test_chart_ref }}"
values:
foo: gaz
+ values_files:
+ - "{{ test_chart_ref }}/values.yml"
+ register: install
+
+ - assert:
+ that:
+ - install is not changed
+
+ - name: Upgrade with set_values
+ helm:
+ binary_path: "{{ helm_binary }}"
+ name: test-chart
+ namespace: "{{ helm_namespace }}"
+ chart_ref: "{{ test_chart_ref }}"
+ values:
+ foo: gaz
+ values_files:
+ - "{{ test_chart_ref }}/values.yml"
+ set_values:
+ - value: foo=qux
+ value_type: string
+ register: install
+
+ - assert:
+ that:
+ - install is changed
+
+ - name: Upgrade with set_values idempotency check
+ helm:
+ binary_path: "{{ helm_binary }}"
+ name: test-chart
+ namespace: "{{ helm_namespace }}"
+ chart_ref: "{{ test_chart_ref }}"
+ values:
+ foo: gaz
+ values_files:
+ - "{{ test_chart_ref }}/values.yml"
+ set_values:
+ - value: foo=qux
+ value_type: string
register: install
- assert:
@@ -256,4 +298,7 @@
kind: Namespace
name: "{{ helm_namespace }}"
state: absent
+ wait: true
ignore_errors: yes
+
+- include_tasks: reuse_values.yml
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/tasks/reuse_values.yml b/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/tasks/reuse_values.yml
new file mode 100644
index 000000000..f2d80a8f4
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_diff/tasks/reuse_values.yml
@@ -0,0 +1,93 @@
+---
+- name: Create temporary directory for helm chart
+ tempfile:
+ suffix: .helm
+ state: directory
+ register: helm_dir
+
+- name: Test helm diff functionality
+ vars:
+ test_chart_path: "{{ helm_dir.path }}/test-chart-reuse-values"
+ test_release_name: "myrelease"
+
+ block:
+
+ - name: Install helm diff
+ kubernetes.core.helm_plugin:
+ binary_path: "{{ helm_binary }}"
+ state: present
+ plugin_path: https://github.com/databus23/helm-diff
+ plugin_version: 3.9.4
+
+ - name: Copy test chart
+ ansible.builtin.copy:
+ src: "test-chart-reuse-values"
+ dest: "{{ helm_dir.path }}"
+
+ - name: Create helm release
+ kubernetes.core.helm:
+ state: present
+ binary_path: "{{ helm_binary }}"
+ chart_ref: "{{ test_chart_path }}"
+ release_name: "{{ test_release_name }}"
+ release_namespace: "{{ helm_namespace }}"
+ create_namespace: true
+ release_values:
+ ansible_version: devel
+ phase: ci
+ wait: true
+
+ - name: Upgrade helm release (reset_values=false and reuse_values=true)
+ kubernetes.core.helm:
+ binary_path: "{{ helm_binary }}"
+ chart_ref: "{{ test_chart_path }}"
+ reset_values: false
+ reuse_values: true
+ release_name: "{{ test_release_name }}"
+ release_namespace: "{{ helm_namespace }}"
+ values:
+ ansible_version: devel
+ register: helm_upgrade
+
+ - name: Ensure task did not reported change
+ assert:
+ that:
+ - helm_upgrade is not changed
+
+ - name: Upgrade helm release (reuse_values=true with default value for reset_values)
+ kubernetes.core.helm:
+ binary_path: "{{ helm_binary }}"
+ chart_ref: "{{ test_chart_path }}"
+ reuse_values: true
+ release_name: "{{ test_release_name }}"
+ release_namespace: "{{ helm_namespace }}"
+ values:
+ ansible_version: devel
+ register: helm_upgrade
+
+ - name: Ensure task reported change
+ assert:
+ that:
+ - helm_upgrade is changed
+
+ always:
+ - name: Remove temporary directory
+ file:
+ path: "{{ helm_dir.path }}"
+ state: absent
+ ignore_errors: true
+
+ - name: Uninstall helm diff
+ kubernetes.core.helm_plugin:
+ binary_path: "{{ helm_binary }}"
+ state: absent
+ plugin_name: diff
+ ignore_errors: true
+
+ - name: Remove helm namespace
+ kubernetes.core.k8s:
+ api_version: v1
+ kind: Namespace
+ name: "{{ helm_namespace }}"
+ state: absent
+ ignore_errors: true
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/meta/main.yml b/ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/meta/main.yml
index 2e3ba2fa3..10d989e78 100644
--- a/ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/meta/main.yml
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/meta/main.yml
@@ -1,3 +1,4 @@
---
dependencies:
- remove_namespace
+ - install_helm
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/playbook.yaml
new file mode 100644
index 000000000..8c6c252a7
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/playbook.yaml
@@ -0,0 +1,7 @@
+---
+- connection: local
+ gather_facts: true
+ hosts: localhost
+
+ roles:
+ - helm_kubeconfig
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_kubeconfig/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_plugin/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/helm_plugin/playbook.yaml
new file mode 100644
index 000000000..2b50d19c6
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_plugin/playbook.yaml
@@ -0,0 +1,7 @@
+---
+- connection: local
+ gather_facts: true
+ hosts: localhost
+
+ roles:
+ - helm_plugin
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_plugin/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/helm_plugin/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_plugin/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_pull/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/helm_pull/playbook.yaml
new file mode 100644
index 000000000..43c5e6d43
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_pull/playbook.yaml
@@ -0,0 +1,7 @@
+---
+- connection: local
+ gather_facts: true
+ hosts: localhost
+
+ roles:
+ - helm_pull
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_pull/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/helm_pull/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_pull/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_repository/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/helm_repository/playbook.yaml
new file mode 100644
index 000000000..f2a56a7bb
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_repository/playbook.yaml
@@ -0,0 +1,7 @@
+---
+- connection: local
+ gather_facts: true
+ hosts: localhost
+
+ roles:
+ - helm_repository
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_repository/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/helm_repository/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_repository/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_set_values/meta/main.yml b/ansible_collections/kubernetes/core/tests/integration/targets/helm_set_values/meta/main.yml
index 2e3ba2fa3..10d989e78 100644
--- a/ansible_collections/kubernetes/core/tests/integration/targets/helm_set_values/meta/main.yml
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_set_values/meta/main.yml
@@ -1,3 +1,4 @@
---
dependencies:
- remove_namespace
+ - install_helm
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_set_values/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/helm_set_values/playbook.yaml
new file mode 100644
index 000000000..5d3109d24
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_set_values/playbook.yaml
@@ -0,0 +1,7 @@
+---
+- connection: local
+ gather_facts: true
+ hosts: localhost
+
+ roles:
+ - helm_set_values
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/helm_set_values/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/helm_set_values/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/helm_set_values/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/inventory_k8s/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/inventory_k8s/runme.sh
index 4548f4bb9..0691d8d5d 100755
--- a/ansible_collections/kubernetes/core/tests/integration/targets/inventory_k8s/runme.sh
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/inventory_k8s/runme.sh
@@ -8,6 +8,7 @@ USER_CREDENTIALS_DIR=$(pwd)
ansible-playbook playbooks/delete_resources.yml -e "user_credentials_dir=${USER_CREDENTIALS_DIR}" "$@"
{
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
export ANSIBLE_INVENTORY_ENABLED=kubernetes.core.k8s,yaml
export ANSIBLE_PYTHON_INTERPRETER=auto_silent
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_access_review/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_access_review/playbook.yaml
new file mode 100644
index 000000000..a97d2ee20
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_access_review/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_access_review
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_access_review/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_access_review/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_access_review/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_append_hash/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_append_hash/playbook.yaml
new file mode 100644
index 000000000..1ef60c4aa
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_append_hash/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_append_hash
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_append_hash/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_append_hash/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_append_hash/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_apply/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_apply/playbook.yaml
new file mode 100644
index 000000000..a1ec85526
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_apply/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_apply
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_apply/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_apply/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_apply/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_check_mode/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_check_mode/playbook.yaml
new file mode 100644
index 000000000..ee9f14f57
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_check_mode/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_check_mode
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_check_mode/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_check_mode/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_check_mode/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_cluster_info/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_cluster_info/playbook.yaml
new file mode 100644
index 000000000..3f26f1dd1
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_cluster_info/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_cluster_info
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_cluster_info/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_cluster_info/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_cluster_info/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/library/k8s_create_file.py b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/library/k8s_create_file.py
deleted file mode 100644
index 6898c36a5..000000000
--- a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/library/k8s_create_file.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-# Copyright: (c) 2021, Aubin Bikouo <@abikouo>
-# 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: k8s_create_file
-
-short_description: Create large file with a defined size.
-
-author:
- - Aubin Bikouo (@abikouo)
-
-description:
- - This module is used to validate k8s_cp module.
-
-options:
- path:
- description:
- - The destination path for the file to create.
- type: path
- required: yes
- size:
- description:
- - The size of the output file in MB.
- type: int
- default: 400
- binary:
- description:
- - If this flag is set to yes, the generated file content binary data.
- type: bool
- default: False
-"""
-
-EXAMPLES = r"""
-- name: create 150MB file
- k8s_diff:
- path: large_file.txt
- size: 150
-"""
-
-
-RETURN = r"""
-"""
-
-import os
-
-from ansible.module_utils.basic import AnsibleModule
-from ansible.module_utils._text import to_native
-
-
-def execute_module(module):
- try:
- size = module.params.get("size") * 1024 * 1024
- path = module.params.get("path")
- write_mode = "w"
- if module.params.get("binary"):
- content = os.urandom(size)
- write_mode = "wb"
- else:
- content = ""
- count = 0
- while len(content) < size:
- content += "This file has been generated using ansible: {0}\n".format(
- count
- )
- count += 1
-
- with open(path, write_mode) as f:
- f.write(content)
- module.exit_json(changed=True, size=len(content))
- except Exception as e:
- module.fail_json(msg="failed to create file due to: {0}".format(to_native(e)))
-
-
-def main():
- argument_spec = {}
- argument_spec["size"] = {"type": "int", "default": 400}
- argument_spec["path"] = {"type": "path", "required": True}
- argument_spec["binary"] = {"type": "bool", "default": False}
- module = AnsibleModule(argument_spec=argument_spec)
-
- execute_module(module)
-
-
-if __name__ == "__main__":
- main()
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/library/kubectl_file_compare.py b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/library/kubectl_file_compare.py
index bcf097839..e84bbffd8 100644
--- a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/library/kubectl_file_compare.py
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/library/kubectl_file_compare.py
@@ -89,10 +89,10 @@ EXAMPLES = r"""
RETURN = r"""
"""
-import os
import filecmp
-
+import os
from tempfile import NamedTemporaryFile, TemporaryDirectory
+
from ansible.module_utils.basic import AnsibleModule
@@ -157,7 +157,6 @@ def compare_directories(dir1, dir2):
def execute_module(module):
-
args = module.params.get("args")
local_path = module.params.get("local_path")
namespace = module.params.get("namespace")
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/playbook.yaml
new file mode 100644
index 000000000..a0fec9444
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_copy
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/tasks/test_copy_large_file.yml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/tasks/test_copy_large_file.yml
index 6758202eb..27d4050ac 100644
--- a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/tasks/test_copy_large_file.yml
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_copy/tasks/test_copy_large_file.yml
@@ -10,16 +10,13 @@
path: "{{ test_directory }}"
state: directory
- - name: create large text file
- k8s_create_file:
- path: "{{ test_directory }}/large_text_file.txt"
- size: 150
+ - name: Create a large text file
+ ansible.builtin.shell:
+ cmd: base64 /dev/random | head -c 150M > {{ test_directory }}/large_text_file.txt
- - name: create large binary file
- k8s_create_file:
- path: "{{ test_directory }}/large_bin_file.bin"
- size: 200
- binary: true
+ - name: Create a large binary file
+ ansible.builtin.command:
+ cmd: dd if=/dev/random of={{ test_directory }}/large_bin_file.bin bs=1M count=200
# Copy large text file from/to local filesystem to Pod
- name: copy large file into remote Pod
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_crd/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_crd/playbook.yaml
new file mode 100644
index 000000000..303acd539
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_crd/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_crd
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_crd/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_crd/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_crd/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/files/deployments.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/files/deployments.yaml
new file mode 100644
index 000000000..594d4522a
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/files/deployments.yaml
@@ -0,0 +1,70 @@
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: nginx-d
+ labels:
+ context: ansible
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ context: ansible
+ template:
+ metadata:
+ labels:
+ context: ansible
+ spec:
+ containers:
+ - name: nginx
+ image: nginx
+ ports:
+ - containerPort: 80
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: openjdk-d
+ labels:
+ context: ansible
+spec:
+ replicas: 2
+ selector:
+ matchLabels:
+ context: ansible
+ template:
+ metadata:
+ labels:
+ context: ansible
+ spec:
+ containers:
+ - name: openjdk
+ image: openjdk:17
+ command:
+ - /bin/sh
+ - -c
+ - while true;do date;sleep 5; done
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: alpine-d
+ labels:
+ context: ansible
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ context: ansible
+ template:
+ metadata:
+ labels:
+ context: ansible
+ spec:
+ containers:
+ - name: alpine
+ image: alpine
+ command:
+ - /bin/sh
+ - -c
+ - while true;do date;sleep 5; done
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/playbook.yaml
new file mode 100644
index 000000000..ab89107b0
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_delete
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/tasks/main.yml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/tasks/main.yml
index 88edf59bd..d7b144cb4 100644
--- a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/tasks/main.yml
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_delete/tasks/main.yml
@@ -121,6 +121,77 @@
that:
- _result.resources | length == 0
+ # test deletion using delete_all=true
+ - name: Create deployments
+ k8s:
+ namespace: "{{ test_namespace }}"
+ src: files/deployments.yaml
+ wait: true
+ register: result
+
+ - name: Trying to delete deployments without name and label_selectors and select_all=false
+ k8s:
+ kind: Deployment
+ api_version: apps/v1
+ namespace: "{{ test_namespace }}"
+ state: absent
+ register: _delete
+
+ - name: Ensure Deployment were not deleted
+ assert:
+ that:
+ - _delete is not changed
+
+ - name: Validate that Deployment still exist
+ k8s_info:
+ kind: Deployment
+ api_version: apps/v1
+ namespace: "{{ test_namespace }}"
+ label_selectors:
+ - context=ansible
+ register: _deployment
+ failed_when: _deployment.resources | length == 0
+
+ - name: Trying to delete using delete_all=true but missing kind option
+ k8s:
+ api_version: apps/v1
+ namespace: "{{ test_namespace }}"
+ delete_all: true
+ state: absent
+ register: _delete
+ ignore_errors: true
+
+ - name: assert task failed with proper message
+ assert:
+ that:
+ - _delete is failed
+ - _delete.msg == "'kind' option is required to specify the resource type."
+
+ - name: Trying to delete deployments without name and label_selectors and delete_all=true
+ k8s:
+ kind: Deployment
+ api_version: apps/v1
+ namespace: "{{ test_namespace }}"
+ delete_all: true
+ wait: true
+ state: absent
+ register: _delete
+
+ - name: Ensure Deployment were deleted
+ assert:
+ that:
+ - _delete is changed
+
+ - name: Validate that Deployment do not exist anymore
+ k8s_info:
+ kind: Deployment
+ api_version: apps/v1
+ namespace: "{{ test_namespace }}"
+ label_selectors:
+ - context=ansible
+ register: _deployment
+ failed_when: _deployment.resources | length > 0
+
always:
- name: Remove namespace
k8s:
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_diff/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_diff/playbook.yaml
new file mode 100644
index 000000000..bd6fe9645
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_diff/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_diff
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_diff/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_diff/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_diff/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_drain/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_drain/playbook.yaml
new file mode 100644
index 000000000..f31993483
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_drain/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_drain
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_drain/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_drain/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_drain/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_drain/tasks/main.yml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_drain/tasks/main.yml
index f16f8affc..5891011f9 100644
--- a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_drain/tasks/main.yml
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_drain/tasks/main.yml
@@ -281,6 +281,7 @@
that:
- dset_result.resources | list | length > 0
+ # test: drain using disable_eviction=true
- name: Uncordon node
k8s_drain:
state: uncordon
@@ -347,6 +348,90 @@
register: _result
failed_when: _result.resources
+ # test: drain using pod_selectors
+ - name: Uncordon node
+ k8s_drain:
+ state: uncordon
+ name: '{{ node_to_drain }}'
+
+ - name: create a Pod for test
+ k8s:
+ namespace: '{{ test_namespace }}'
+ wait: true
+ wait_timeout: "{{ k8s_wait_timeout | default(omit) }}"
+ definition:
+ apiVersion: v1
+ kind: Pod
+ metadata:
+ name: 'ansible-drain-pod'
+ labels:
+ app: ansible-drain
+ spec:
+ affinity:
+ nodeAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ nodeSelectorTerms:
+ - matchFields:
+ - key: metadata.name
+ operator: In
+ values:
+ - '{{ node_to_drain }}'
+ containers:
+ - name: ansible-container
+ image: busybox
+ command:
+ - '/bin/sh'
+ - '-c'
+ - 'while true; do echo $(date); sleep 10; done'
+
+ - name: Drain node using pod_selectors 'app!=ansible-drain'
+ k8s_drain:
+ state: drain
+ name: '{{ node_to_drain }}'
+ pod_selectors:
+ - app!=ansible-drain
+ delete_options:
+ terminate_grace_period: 0
+ delete_emptydir_data: true
+ force: true
+ ignore_daemonsets: true
+ register: drain_pod_selector
+
+ - name: assert that node has been drained
+ assert:
+ that:
+ - drain_pod_selector is changed
+ - '"node {{ node_to_drain }} marked unschedulable." in drain_pod_selector.result'
+
+ - name: assert that pod created before is still running
+ k8s_info:
+ namespace: '{{ test_namespace }}'
+ kind: Pod
+ label_selectors:
+ - app=ansible-drain
+ field_selectors:
+ - status.phase=Running
+ register: pods
+ failed_when: pods.resources == []
+
+ - name: Drain node using pod_selectors 'app=ansible-drain'
+ k8s_drain:
+ state: drain
+ name: '{{ node_to_drain }}'
+ pod_selectors:
+ - app=ansible-drain
+ delete_options:
+ terminate_grace_period: 0
+ force: true
+ register: drain_pod_selector_equal
+
+ - name: assert that node was not drained
+ assert:
+ that:
+ - drain_pod_selector_equal is changed
+ - '"node {{ node_to_drain }} already marked unschedulable." in drain_pod_selector_equal.result'
+ - '"Deleting Pods not managed by ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet: {{ test_namespace }}/ansible-drain-pod." in drain_pod_selector_equal.warnings'
+
- name: Uncordon node
k8s_drain:
state: uncordon
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_exec/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_exec/playbook.yaml
new file mode 100644
index 000000000..f2c6a67cd
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_exec/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_exec
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_exec/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_exec/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_exec/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_full/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_full/playbook.yaml
new file mode 100644
index 000000000..f0f4f3745
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_full/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_full
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_full/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_full/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_full/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_gc/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_gc/playbook.yaml
new file mode 100644
index 000000000..d1c5b4ff9
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_gc/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_gc
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_gc/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_gc/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_gc/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_generate_name/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_generate_name/playbook.yaml
new file mode 100644
index 000000000..fa5db406b
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_generate_name/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_generate_name
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_generate_name/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_generate_name/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_generate_name/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/aliases b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/aliases
new file mode 100644
index 000000000..64f66d0a5
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/aliases
@@ -0,0 +1,3 @@
+time=59
+k8s
+k8s_info
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/defaults/main.yml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/defaults/main.yml
new file mode 100644
index 000000000..1858b94ea
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/defaults/main.yml
@@ -0,0 +1,12 @@
+---
+test_namespace: "hide-fields"
+hide_fields_namespace: "hide-fields"
+hide_fields_base_configmap:
+ apiVersion: v1
+ kind: ConfigMap
+ metadata:
+ name: hide-fields-cm
+ namespace: hide-fields
+ data:
+ hello: world
+ another: value
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/meta/main.yml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/meta/main.yml
new file mode 100644
index 000000000..08362c780
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+- setup_namespace
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/playbook.yaml
new file mode 100644
index 000000000..349b62951
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_hide_fields
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/runme.sh
new file mode 100755
index 000000000..29fda1c9a
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@"
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/tasks/main.yml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/tasks/main.yml
new file mode 100644
index 000000000..4b361fb96
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_hide_fields/tasks/main.yml
@@ -0,0 +1,108 @@
+- block:
+ - name: Creation with hidden fields should work
+ k8s:
+ definition: "{{ hide_fields_base_configmap}}"
+ hidden_fields:
+ - metadata.managedFields
+ register: hf1
+
+ - name: Ensure hidden fields are not present
+ assert:
+ that:
+ - "'managedFields' not in hf1.result['metadata']"
+
+ - name: Running without hidden fields should work
+ k8s:
+ definition: "{{ hide_fields_base_configmap}}"
+
+ - name: Running with missing hidden fields should have no effect
+ k8s:
+ definition: "{{ hide_fields_base_configmap}}"
+ hidden_fields:
+ - does.not.exist
+ register: hf2
+
+ - name: Ensure no change with missing hidden fields
+ assert:
+ that:
+ - not hf2.changed
+
+ - name: Hide status and managed fields
+ k8s:
+ definition: "{{ hide_fields_base_configmap}}"
+ hidden_fields:
+ - status
+ - metadata.managedFields
+ register: hf3
+ diff: true
+
+ - name: Ensure hidden fields are not present
+ assert:
+ that:
+ - "'status' not in hf3.result"
+ - "'managedFields' not in hf3.result['metadata']"
+
+ - name: k8s_info works with hidden fields
+ k8s_info:
+ name: "{{ hide_fields_base_configmap.metadata.name }}"
+ namespace: "{{ hide_fields_base_configmap.metadata.namespace }}"
+ kind: ConfigMap
+ hidden_fields:
+ - metadata.managedFields
+ register: hf4
+
+ - name: Ensure hidden fields are not present
+ assert:
+ that:
+ - hf4.resources | length == 1
+ - "'managedFields' not in hf4.resources[0]['metadata']"
+
+
+ - name: Hiding a changed field should still result in a change
+ k8s:
+ definition: "{{ hide_fields_base_configmap | combine({'data':{'hello':'different'}}) }}"
+ hidden_fields:
+ - data
+ - metadata.managedFields
+ register: hf5
+ diff: true
+
+ - name: Ensure that hidden changed field changed
+ assert:
+ that:
+ - hf5.changed
+
+ - name: Apply works with hidden fields
+ k8s:
+ definition: "{{ hide_fields_base_configmap | combine({'data':{'anew':'value'}}) }}"
+ hidden_fields:
+ - data
+ apply: true
+ register: hf6
+ diff: true
+
+ - name: Ensure that hidden changed field changed
+ assert:
+ that:
+ - hf6.changed
+
+ - name: Hidden field should not show up in deletion
+ k8s:
+ definition: "{{ hide_fields_base_configmap}}"
+ hidden_fields:
+ - status
+ state: absent
+ register: hf7
+
+ - name: Ensure hidden fields are not present
+ assert:
+ that:
+ - "'status' not in hf7.result"
+
+ always:
+ - name: Remove namespace
+ k8s:
+ kind: Namespace
+ name: "{{ hide_fields_namespace }}"
+ state: absent
+ ignore_errors: true
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/playbook.yaml
new file mode 100644
index 000000000..0070d8910
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_info
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/tasks/wait.yml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/tasks/wait.yml
index 2608f8208..03fc72695 100644
--- a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/tasks/wait.yml
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_info/tasks/wait.yml
@@ -192,7 +192,7 @@
- name: Check that module waited
assert:
that:
- - "{{ lookup('pipe', 'date +%s') }} - {{ start }} > 30"
+ - ( lookup('pipe', 'date +%s')|int - start|int ) > 30
- name: Create simple pod
k8s:
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_json_patch/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_json_patch/playbook.yaml
new file mode 100644
index 000000000..7206db569
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_json_patch/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_json_patch
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_json_patch/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_json_patch/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_json_patch/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_label_selectors/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_label_selectors/playbook.yaml
new file mode 100644
index 000000000..bff2875ba
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_label_selectors/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_label_selectors
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_label_selectors/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_label_selectors/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_label_selectors/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_lists/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_lists/playbook.yaml
new file mode 100644
index 000000000..0b7156d5b
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_lists/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_lists
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_lists/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_lists/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_lists/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_log/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_log/playbook.yaml
new file mode 100644
index 000000000..1855427a4
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_log/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_log
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_log/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_log/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_log/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_manifest_url/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_manifest_url/playbook.yaml
new file mode 100644
index 000000000..9196cafad
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_manifest_url/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_manifest_url
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_manifest_url/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_manifest_url/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_manifest_url/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_merge_type/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_merge_type/playbook.yaml
new file mode 100644
index 000000000..5aec041fc
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_merge_type/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_merge_type
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_merge_type/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_merge_type/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_merge_type/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_patched/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_patched/playbook.yaml
new file mode 100644
index 000000000..e3b890d1f
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_patched/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_patched
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_patched/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_patched/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_patched/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_rollback/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_rollback/playbook.yaml
new file mode 100644
index 000000000..f91f78ea7
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_rollback/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_rollback
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_rollback/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_rollback/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_rollback/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_scale/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_scale/playbook.yaml
new file mode 100644
index 000000000..2c48db5ab
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_scale/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_scale
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_scale/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_scale/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_scale/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_scale/tasks/main.yml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_scale/tasks/main.yml
index eb2107d30..f5c79df55 100644
--- a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_scale/tasks/main.yml
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_scale/tasks/main.yml
@@ -389,6 +389,71 @@
that:
- output.result.status.replicas == 0
+ - name: Create a StatefulSet with updateStrategy=OnDelete
+ kubernetes.core.k8s:
+ wait: yes
+ wait_timeout: "{{ k8s_wait_timeout | default(omit) }}"
+ definition:
+ apiVersion: apps/v1
+ kind: StatefulSet
+ metadata:
+ namespace: "{{ scale_namespace }}"
+ name: scale-set-ondelete
+ spec:
+ replicas: 2
+ updateStrategy:
+ type: OnDelete
+ selector:
+ matchLabels:
+ app: foo
+ template:
+ metadata:
+ labels:
+ app: foo
+ spec:
+ terminationGracePeriodSeconds: 10
+ containers:
+ - image: busybox
+ name: busybox
+ command:
+ - sleep
+ - "600"
+ register: output
+
+ - assert:
+ that:
+ - output.result.status.replicas == 2
+
+ - name: Wait for StatefulSet to scale down to 0
+ kubernetes.core.k8s_scale:
+ kind: StatefulSet
+ api_version: apps/v1
+ name: scale-set-ondelete
+ namespace: "{{ scale_namespace }}"
+ replicas: 0
+ wait: yes
+ wait_timeout: "{{ k8s_wait_timeout | default(omit) }}"
+ register: output
+
+ - assert:
+ that:
+ - output.result.status.replicas == 0
+
+ - name: Wait for StatefulSet to scale up to 2
+ kubernetes.core.k8s_scale:
+ kind: StatefulSet
+ api_version: apps/v1
+ name: scale-set-ondelete
+ namespace: "{{ scale_namespace }}"
+ replicas: 2
+ wait: yes
+ wait_timeout: "{{ k8s_wait_timeout | default(omit) }}"
+ register: output
+
+ - assert:
+ that:
+ - output.result.status.replicas == 2
+
always:
- name: Remove namespace
k8s:
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_taint/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_taint/playbook.yaml
new file mode 100644
index 000000000..805c34760
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_taint/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_taint
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_taint/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_taint/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_taint/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_template/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_template/playbook.yaml
new file mode 100644
index 000000000..1a4e61122
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_template/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_template
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_template/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_template/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_template/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_user_impersonation/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_user_impersonation/playbook.yaml
new file mode 100644
index 000000000..e09f40e90
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_user_impersonation/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_user_impersonation
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_user_impersonation/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_user_impersonation/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_user_impersonation/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_validate/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_validate/playbook.yaml
new file mode 100644
index 000000000..510c8e6cd
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_validate/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_validate
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_validate/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_validate/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_validate/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_validate/tasks/main.yml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_validate/tasks/main.yml
index 900e6f70b..b7b99c18a 100644
--- a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_validate/tasks/main.yml
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_validate/tasks/main.yml
@@ -52,6 +52,7 @@
name:
- kubernetes
- kubernetes-validate
+ - setuptools
virtualenv: "{{ virtualenv }}"
virtualenv_command: "{{ virtualenv_command }}"
virtualenv_site_packages: false
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_waiter/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_waiter/playbook.yaml
new file mode 100644
index 000000000..4e5171ee3
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_waiter/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - k8s_waiter
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/k8s_waiter/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_waiter/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/k8s_waiter/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/lookup_k8s/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/lookup_k8s/playbook.yaml
new file mode 100644
index 000000000..47a0c7ff6
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/lookup_k8s/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - lookup_k8s
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/lookup_k8s/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/lookup_k8s/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/lookup_k8s/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/lookup_kustomize/playbook.yaml b/ansible_collections/kubernetes/core/tests/integration/targets/lookup_kustomize/playbook.yaml
new file mode 100644
index 000000000..1a5ed844a
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/lookup_kustomize/playbook.yaml
@@ -0,0 +1,6 @@
+---
+- connection: local
+ gather_facts: false
+ hosts: localhost
+ roles:
+ - lookup_kustomize
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/lookup_kustomize/runme.sh b/ansible_collections/kubernetes/core/tests/integration/targets/lookup_kustomize/runme.sh
new file mode 100755
index 000000000..02ef14603
--- /dev/null
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/lookup_kustomize/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eux
+export ANSIBLE_CALLBACKS_ENABLED=profile_tasks
+export ANSIBLE_ROLES_PATH=../
+ansible-playbook playbook.yaml "$@" \ No newline at end of file
diff --git a/ansible_collections/kubernetes/core/tests/integration/targets/setup_kubeconfig/library/test_inventory_read_credentials.py b/ansible_collections/kubernetes/core/tests/integration/targets/setup_kubeconfig/library/test_inventory_read_credentials.py
index 9c9e87966..1e0d45ec3 100644
--- a/ansible_collections/kubernetes/core/tests/integration/targets/setup_kubeconfig/library/test_inventory_read_credentials.py
+++ b/ansible_collections/kubernetes/core/tests/integration/targets/setup_kubeconfig/library/test_inventory_read_credentials.py
@@ -78,7 +78,6 @@ from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import
class K8SInventoryTestModule(AnsibleModule):
def __init__(self):
-
argument_spec = dict(
kube_config=dict(required=True, type="path"),
dest_dir=dict(required=True, type="path"),
@@ -88,7 +87,6 @@ class K8SInventoryTestModule(AnsibleModule):
self.execute_module()
def execute_module(self):
-
dest_dir = os.path.abspath(self.params.get("dest_dir"))
kubeconfig_path = self.params.get("kube_config")
if not os.path.isdir(dest_dir):