805 Commits
Author SHA1 Message Date
2e5f3198fc fix: add default to k8s_copy init-pod until conditional (#1233) (#1271)
(cherry picked from commit b7e1ed5661)

Co-authored-by: Don Naro <dnaro@redhat.com>
2026-09-22 16:29:41 +01:00
819adf3e4b fix(sanity): resolve ansible-test devel validation errors (#1268) (#1269)
(cherry picked from commit 177297fdae)

Co-authored-by: Don Naro <dnaro@redhat.com>
2026-09-22 09:59:33 +01:00
e91b3171ea Release v6.6.0 (#1261)
* Release v6.6.0

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* bump Makefile and README example VERSION to 6.6.0

* docs: regenerate for 6.6.0 and fix stable-6 links

- Regenerate module documentation with collection_prep
- Update helm module docs for reuse_values/reset_values changes
- Add wait_for_jobs, copy_timeout, metadata_only parameters
- Restore ansible_turbo_mode.rst (not auto-generated)
- Fix README.md links to point to stable-6 branch

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Mandar Kulkarni <mandkulk@redhat.com>
6.6.0
2026-09-16 12:28:23 +01:00
693e80389b fix(helm): validate reuse_values against reset_values and replace (#1230) (#1262)
* fix(helm): validate reuse_values against reset_values and replace

reset_values defaults to true and helm ignores --reuse-values whenever
--reset-values is passed, so the documented reuse_values example was a
no-op. Warn rather than flip the default, which would silently change
what existing playbooks deploy.

helm install accepts neither --reuse-values nor --reset-then-reuse-values,
so pairing either with replace could only ever make helm report an unknown
flag. Fail up front instead, and keep both flags inside the upgrade branch.

Fixes #1229

* fix(docstring): neither nor replacing



* fix(helm): warn instead of failing on replace + reuse_values

reuse_values has been accepted since 3.0.0, and a converged release never
reaches deploy(), so these combinations pass in playbooks today. Failing
in main() would turn them red on upgrade. The flags are already dropped
from the install path, so warning leaves a valid command behind.

Splits the changelog fragment per user-visible change, and covers the
helm diff path, whose 'not replace' guards the hard failure had made
unreachable.

Changes based on the @abikouo's feedback

---------


(cherry picked from commit 10584acdbb)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
Co-authored-by: Don Naro <dnaro@redhat.com>
2026-09-16 11:47:18 +01:00
53cb65a740 :fix(helm_repository): normalize both sides of the repo URL comparison (#1236) (#1258)
helm stores repository URLs verbatim, so a repository registered with a
trailing slash keeps it in repositories.yaml. Only the URL coming from the
task was normalized, so a repository that already matched was reported as a
name conflict.

Fixes #1235

(cherry picked from commit 094240ab77)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
2026-09-15 11:03:49 -07:00
a2803df8e8 Add deprecation warnings for the status.values return value (#1241) (#1256)
* chore: add deprecation warning for status.values

* docs: add changelog entries for status.values deprecation

(cherry picked from commit f42c78ce83)

Co-authored-by: Don Naro <dnaro@redhat.com>
2026-09-15 16:44:53 +01:00
1016f80aee Add ansible-core version check to k8s lookup turbo mode (#1253) (#1254)
* feat(lookup): add ansible-core version check for turbo mode in k8s lookup

Add ansible-core version checking to the k8s lookup plugin to match the
behavior already implemented in module_utils/ansiblemodule.py.

When ENABLE_TURBO_MODE is set and ansible-core >= 2.19.0:
- Emit deprecation warning for ENABLE_TURBO_MODE
- Emit version warning explaining turbo mode is unsupported
- Disable turbo mode and fall back to standard LookupBase

This prevents confusing tracebacks when cloud.common (which declares
requires_ansible '>=2.15.0,<2.19') is used on newer ansible-core versions
where it is not fully compatible.

Changes:
- Import ansible_version and LooseVersion
- Add TURBO_UNSUPPORTED_CORE = "2.19.0" constant
- Check version before enabling turbo mode
- Disable turbo mode and warn if version >= 2.19.0

Addresses reviewer feedback on PR #1251 to add version testing to the
lookup plugin matching the module implementation.



* test(lookup): add unit tests for k8s turbo mode version check

Add comprehensive unit tests for the ansible-core version checking logic
in the k8s lookup plugin's turbo mode handling.

Tests validate that when ENABLE_TURBO_MODE is set:
- Turbo mode is disabled on ansible-core >= 2.19.0 (tests 2.19.0 and 2.21.4)
- Turbo mode is enabled on ansible-core < 2.19.0 (tests 2.18.0)
- Appropriate deprecation and version warnings are shown
- Standard LookupBase is used when turbo mode is disabled

Tests also verify that when ENABLE_TURBO_MODE is not set:
- No deprecation or warning messages are shown
- Turbo mode remains disabled
- Standard LookupBase is used

Implementation follows pytest best practices:
- Autouse fixture for module cleanup between tests
- Parametrized tests to avoid duplication (2.19.0 and 2.21.4 share logic)
- Mock assertion methods (assert_called, assert_not_called)
- Module-level import of StandardLookupBase to avoid repetition

Simplified and maintainable: 71 lines vs initial 139-line implementation
(49% reduction through deduplication and better abstractions).



* style: format with black

* fixup! test(lookup): add unit tests for k8s turbo mode version check

* docs: add changelog fragment for k8s lookup turbo version check

Add changelog entry documenting that the k8s lookup plugin now ignores
ENABLE_TURBO_MODE on ansible-core >= 2.19.0 and falls back to standard
LookupBase instead of failing with a traceback.

This complements the existing deprecate-enable-turbo-mode.yml fragment
which covers the module implementation, by documenting the lookup plugin
fix specifically.



* fixup! fixup! test(lookup): add unit tests for k8s turbo mode version check

* fixup! fixup! fixup! test(lookup): add unit tests for k8s turbo mode version check

---------


(cherry picked from commit c46180bb6f)

Co-authored-by: Don Naro <dnaro@redhat.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-09-15 16:42:50 +01:00
90e868aa37 ci: add the PE certification checker workflow (#1231) (#1249)
* ci: add the PE certification checker workflow

* ci: add stable branches to certification workflow

(cherry picked from commit 732925b986)

Co-authored-by: Don Naro <dnaro@redhat.com>
2026-09-15 14:25:49 +01:00
864c7addd1 k8s_cp - wait for remote tar to finish before closing the stream (#1217) (#1252)
* fix(k8s_cp): wait for remote tar to finish before closing the stream

The module closed the exec connection right after writing the last chunk,
killing tar mid-extract, and never checked its exit status, so a partial
or failed copy was reported as success (#776).

The v4 exec protocol cannot half-close stdin, and busybox tar blocks for
EOF rather than stopping at the end-of-archive marker, so bound the stream
with `head -c N | tar ...`. tar then gets a clean EOF, exits on its own,
and its status is read from the error channel. Containers without /bin/sh
and head keep the previous behaviour and get a warning.

Also add copy_timeout (default 300s, #621) and stream the archive from the
temp file instead of buffering every chunk in memory.

* test(k8s_cp): split combined assert into separate statements

Addresses review feedback on #1217.

* chore(changelog): link the PR and use single-line fragment entries

* fix(linter): reformat with black

* fix(linter): sort imports in test_copy.py

isort --profile black puts ansible_collections in the same third-party
section as pytest, so the blank line between them is a failure.

* fix(k8s_cp): report what tar said when the copy fails early

An early close or a stall is the symptom; tar has usually already
written the cause (a read-only mount, a missing directory) to stderr,
and drain() has it. Discarding it left only the generic truncation or
timeout message.

* refactor(k8s_cp): move the stderr suffix into _fail

The nested fail() helper added a branch inside a closure, which counts
double for nesting and took _stream_tar_to_pod over Sonar's cognitive
complexity limit (14 -> 16). _fail already had the response; give it
the stderr too.

* test(k8s_cp): tempfile for the repeated-copy test directory



---------


(cherry picked from commit 8a9dd54fe7)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com>
2026-09-15 10:53:45 +01:00
021ffbfec2 Add a deprecation notice for ENABLE_TURBO_MODE (#1242) (#1250)
* Add a deprecation notice for ENABLE_TURBO_MODE

* minor fix

* fix(turbo): ensure deprecation warning reaches user and skip turbo on unsupported ansible-core

Move the ENABLE_TURBO_MODE deprecation warning to module import time,
since AnsibleTurboModule.__init__() exits the process before returning,
making the previous per-instance deprecate() call unreachable. Also
skip turbo mode on ansible-core >= 2.19.0, where cloud.common is not
supported and the import succeeding could otherwise fail later with
an unrelated traceback, and warn instead of silently falling back
when cloud.common is not installed.

Assisted-by: Claude Sonnet 5

* docs(turbo): clarify that turbo mode is ignored on ansible-core 2.19+

Turbo mode is now bypassed with a warning rather than failing on
unsupported ansible-core, so drop the "may lead to fails" wording from
the README note and the matching statement in the turbo mode guide.

Assisted-by: Claude Opus 5


---------


(cherry picked from commit 031bc475fa)

Co-authored-by: Mandar Kulkarni <mandkulk@redhat.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 09:19:32 +01:00
b40a401ec2 fix(helm): skip Helm's OCI registry progress messages on stdout (#1223) (#1247)
* fix(helm): skip OCI registry progress messages on stdout

Helm 4.2.1 moved the registry client's progress messages from stderr to
stdout (helm/helm#32056), so on an OCI reference they now precede the real
output. helm parses the stdout of `helm show chart` and helm_template
returns the stdout of `helm template`, and neither can detect this from the
return code because both commands exit 0.

Helm rewrites '+' to '_' in OCI tags, which makes it also print a free-text
explanation. That is not valid YAML, so a chart version carrying semver
build metadata failed outright. Without the '+' the messages parse as a
mapping instead, silently adding Pulled/Digest keys to the chart info.

Match helm's message verbatim rather than seeking the start of the real
output: the payload has three shapes and can be empty, whereas the messages
are always at the front and byte-identical. A reworded message then fails
loudly instead of consuming a line of real output.

Fixes: #1222

* test(helm): cover OCI charts whose version has build metadata

Pushes a chart versioned 1.0.0+build.1 to the local registry and asserts
that helm installs it idempotently with the version reported verbatim, and
that helm_template returns only rendered manifests. A second version without
build metadata covers the case where the registry messages parse as YAML.

Pinned to Helm 4.2.4: the target is only meaningful on >= 4.2.1, which is
where the messages moved to stdout. The rest of the helm matrix tops out at
v4.0.0, which is why this went unnoticed.

Verified to fail on the parent commit and pass on the fix.

* test(helm): drop Go template from chart fixture

The yamllint sanity test parses chart templates with libyaml, where
`{{ default "test" .Values.myValue }}` is an unhashable mapping key. The
existing chart fixtures carry a yamllint!skip entry in every
tests/sanity/ignore-*.txt for exactly this, but the target never renders
the chart with values, so the template served no purpose. Making the
fixture plain YAML keeps the ignore lists from growing.

* test(ci): empty commit to re-trigger CI

(cherry picked from commit c098ecc8c8)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
2026-09-14 14:33:17 +01:00
e620b92b49 [PR #1240/cb00cf3c backport][stable-6] Address stale deprecations (#1245)
* Address stale deprecations (#1240)

* chore: update deprecation for wait_timeout

* chore: update deprecation for return_code

* docs(changelogs): add stale deprecations to changelogs

* docs: ignore pylint deprecation warnings

* chore: update deprecation for merge_type

* docs: update changelogs for merge_type

* docs: ignore more pylint deprecation warnings

(cherry picked from commit cb00cf3c9e)

* fix: remove unnecessary ignore statements

---------

Co-authored-by: Don Naro <dnaro@redhat.com>
2026-09-14 13:49:58 +01:00
40123060c1 chore(test): add ansible 2.21 to integration tests matrix (#1234) (#1243)
* chore(test): add ansible 2.21 to integration tests matrix

current version of Ansible (as the time of this commit) is
2.21 that is included in the Ansible 14 release.

To ensure testing coverage for actual version if ansible,
version 2.21 should be included in the integration tests matrix.

Updated matrix includes:
- stable-2.18 as the latest version support turbo mode
- stable-2.21 as the actual version
- milestone as the development version

* chore(test): exclude 2.18/turbo off from integration tests matrix

stable-2.18 is used mostly as the last version with turbo mode,
so no reason to test it with turbo mode disabled as it tested with
the later version of ansible.

Excluding to decrease CI time/cost

(cherry picked from commit 7df5e01974)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
2026-09-14 13:21:20 +01:00
d44a8501e6 test(sanity): align python_requires with documented 3.9+ support (#1226) (#1227)
tests/config.yml declared ">=3.6", so ansible-test ran the module import
test on target Python versions this collection never supported, while
README states 3.9+. Narrow the declaration and add ignore entries for the
supported target versions that were missing.

(cherry picked from commit d9e0218dba)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
2026-09-10 17:27:53 +01:00
c3f7a453fd fix(meta): add missing modules to helm and k8s action groups, document them (#1216) (#1221)
* fix(meta): add missing modules to helm and k8s action groups

`helm_plugin` and `helm_plugin_info` both build their argument spec from
`HELM_AUTH_ARG_SPEC`, and `k8s_taint` builds its own from `AUTH_ARG_SPEC`,
but none of the three were listed in the action groups. Anyone setting
`module_defaults` on `group/kubernetes.core.helm` or
`group/kubernetes.core.k8s` silently got no defaults for them.

Deliberately left out of the groups, since they do not accept the shared
authentication options and would make `module_defaults` fail for every
user of the group:

  - `helm_pull` and `helm_template` take only `binary_path`
  - `helm_registry_auth` takes `binary_path` plus its own required `host`,
    which is an OCI registry URL rather than a Kubernetes API server
  - `kubeconfig` writes a kubeconfig file locally and takes no cluster
    connection options

Also documents both action groups in the scenario guide, including the
exclusions above and the distinction from the legacy `k8s` group that
ansible-core defines, which is a different group and does not cover this
collection's modules.

Closes #577

* test(meta): guard action group membership against argspec drift

The action groups in `meta/runtime.yml` were maintained by hand, so
`helm_plugin`, `helm_plugin_info` and `k8s_taint` were able to inherit the
shared authentication arg specs without anyone adding them to a group.
Nothing failed, users just silently got no `module_defaults`.

Asserts the invariant in both directions: a module belongs to a group if
and only if it builds its argument spec from that group's shared constant.
The reverse direction matters too, since a member that does not accept the
shared options makes `module_defaults` fail with "Unsupported parameters"
for every user of the group.

Membership is read statically with `ast`, so the test needs no imports and
runs without a cluster or the `kubernetes` package.

The four modules that are deliberately excluded are listed with their
reasons, so restoring one has to be a decision rather than an oversight.

* fix(tests): satisfy pylint disallowed-name and set an explicit license

ansible-test's pylint profile rejects `_` as a name, which the sanity job
flagged three times. Rather than renaming the throwaways, give the entries
in SHARED_ARG_SPECS named keys so there is nothing to discard when reading
them back.

The header was copied from a sibling test that carries Apache-2.0 because
it derives from kubernetes/kubernetes, so it named the wrong copyright
holder. It now names the author, and keeps Apache-2.0 deliberately: the
collection requirements allow code outside plugins/ that imports no
GPL-3.0-or-later code to use any GPL-3.0-compatible license, and this file
imports only ast, os, pytest and yaml, since it reads group membership
statically rather than importing the modules. A comment records that
reasoning so the constraint is visible if an import is ever added.

* fix(doc): update changelog fragment with the manintainer suggestion

* fix(doc): show helm group defaults in the action group example

abikouo asked for the module_defaults example to cover the helm action
group as well, with tasks that actually consume those defaults. Set
binary_path, kubeconfig and context on group/kubernetes.core.helm and
add helm_repository, helm and helm_info tasks that rely on them; the
namespace in the k8s tasks now matches the release namespace so the
playbook reads as one flow.



---------


(cherry picked from commit 0bc99117af)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com>
2026-09-10 17:24:42 +01:00
5c06a554a8 Use collections.abc (#1057) (#1220)
* use collections.abc

ansible.module_utils.common._collections_compat shall be deprecated in
ansible-core 2.24

Use collections.abc

Link: https://forum.ansible.com/t/deprecation-warnings-in-ansible-core-2-20/44741


* Apply suggestion from @abikouo

* Fix linter errors

---------




(cherry picked from commit c643719085)

Signed-off-by: Plamerdi Makela <plamerdi447@gmail.com>
Co-authored-by: Plamerdi Makela <plamerdi447@gmail.com>
Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com>
Co-authored-by: Bianca Henderson <bianca@redhat.com>
2026-09-10 17:23:52 +01:00
20b9c3fb7f Fix ansible-lint no-changed-when and execution-environment schema warnings (#1196) (#1237)
* Fix ansible-lint no-changed-when and execution-environment schema warnings

Add `changed_when: false` to example command tasks in the kubectl
connection plugin to resolve no-changed-when warnings from ansible-lint.

Add `version: 3` to meta/execution-environment.yml to satisfy the
schema[execution-environment] rule requiring the version property.



* Add changelog fragment for ansible-lint warning fixes



* Fix changelog fragment YAML formatting

Quote strings to avoid YAML parsing ambiguity in the trivial section.



---------


(cherry picked from commit a7922e498c)

Co-authored-by: Daniel Brennand <52419383+dbrennand@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-09-10 15:26:41 +01:00
7b17313ace Support wait_for_jobs flag for helm release upgrade/install (#1140) (#1214)
* Support wait_for_jobs flag for helm release upgrade/install

* Update plugins/modules/helm.py



* Apply suggestion from @abikouo

* fix(helm): correct wait_for_jobs implementation and add changelog

- Fix double-append of --wait-for-jobs flag
- Fix version check to run before appending the flag
- Fetch helm_version before use to avoid undefined variable
- Fix YAML indentation for version_added in docs
- Add changelog fragment



* test: add integration tests for wait_for_jobs

- Test that --wait-for-jobs is appended when wait=true and wait_for_jobs=true
- Test that wait_for_jobs fails with appropriate message on helm < 3.5.0
- Test that wait_for_jobs is ignored when wait is not set
- Add test-chart-job helm chart containing a simple Job resource



* fix: harden test Job pod spec

Disable service account token automounting and add memory limit to
the test Job container.



* fix: add resource requests and pin image version in test Job

Add CPU, memory, and ephemeral-storage requests. Pin busybox image
to version 1.37.



* style: apply linter formatting to helm argument_spec



* Update sanity ignore file

* fix: quote Helm template expression to pass yamllint sanity



* Fix linters errors

---------





(cherry picked from commit e475d06403)

Co-authored-by: Daniel Simko <danosimko1@gmail.com>
Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com>
Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
Co-authored-by: aubin bikouo <abikouo@redhat.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-08-11 12:11:51 -04:00
569bae6593 Remove remaining ansible.module_utils.six import from kubectl connection plugin (#1197) (#1200)
* Replace ansible.module_utils.six with Python stdlib equivalents

ansible.module_utils.six is deprecated in ansible-core 2.21 and is
scheduled for removal in 2.24. Every use of it in this collection has a
direct Python 3 standard library equivalent, so switch to those.

* Update changelogs/fragments/20260723-remove-module-utils-six.yaml



---------


(cherry picked from commit dd4ca7a8b0)

Co-authored-by: Zhiwei Liang <zhiwei.liang@zliang.me>
Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com>
2026-08-11 12:54:54 +02:00
da42348358 ci: exclude test code from SonarCloud duplication detection (#1207) (#1213)
Duplication is scored on new code only, so a PR adding cases to an already
repetitive test module inherits debt accrued across earlier PRs rather than
introducing it; tests/unit/modules/test_module_helm.py sits at 47.9% on main
before any change.

sonar.exclusions filters the source set, not the copy/paste detector, so test
code needs its own exclusion. Production code stays covered.

(cherry picked from commit f31ecce59c)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
2026-08-10 12:01:19 -04:00
79e98c3d6e feat(waiter): add native wait support for Job resources (#1202) (#1211)
Add a `job_complete` predicate that waits for Job resources to reach
either `Complete` or `Failed` condition, removing the need for custom
wait_condition workarounds.

Also rename shadowed `match` variable to `match_condition` in
`custom_condition` to avoid masking the Python built-in.

Fixes ansible-collections/kubernetes.core#1201


(cherry picked from commit 3e58e3a9ad)

Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-08-10 16:49:59 +02:00
477bb79305 feat(helm): add cleanup_on_fail option (#1206) (#1210)
* feat(helm): add cleanup_on_fail option

atomic rolls back to the last successful revision but can leave behind
resources the failed upgrade created; helm accepts both flags together so
the rollback also drops those orphans.

Rejected with replace=true, since that deploys via helm install, which has
no --cleanup-on-fail. No version gate: the flag exists in helm 3.0.0, the
module's minimum, and was not renamed in v4.

* refactor(tests): share helm command-building test helpers

The new cleanup_on_fail tests copied setUp and _run_with_version verbatim
from the atomic tests, which SonarQube flagged as duplication on new code.
Extract both to module level so the two classes share them.

Scoped to the classes involved in that duplication; the other test classes
in this file keep their own fixtures.

* test(helm): align cleanup_on_fail assertions with review feedback

Adjust the Helm unit tests to assert the expected flags for
cleanup_on_fail on Helm v3 and v4, matching the behavior clarified
in review feedback.



---------


(cherry picked from commit d4ef10fc80)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
Co-authored-by: abikouo <abikouo@users.noreply.github.com>
2026-08-10 16:41:33 +02:00
fd65a4f09e Handle empty template output gracefully (#1044) (#1205)
* Handle empty template output gracefully

* Add changelog fragment for empty template output fix

* refactor: reduce cognitive complexity of ActionModule.run

Extract compound boolean condition to a variable to reduce the
cognitive complexity from 16 to the allowed maximum of 15.



* refactor: extract duplicated error handling into _fail_with_error

Replace two identical error-handling blocks in ActionModule.run() with
a shared _fail_with_error static method to address SonarQube code
duplication finding.



* refactor: reduce code duplication in action plugin and tests

Revert _fail_with_error extraction that increased duplication on new
code. Consolidate duplicate integration test tasks for conditional
template into a single looped task.



---------



(cherry picked from commit ec8942dd90)

Co-authored-by: W. H. Wang <mattwang44@gmail.com>
Co-authored-by: aubin bikouo <abikouo@redhat.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-08-10 16:29:44 +02:00
b9749c94f9 Support for metadata-only fetches in k8s_info module (#1030) (#1203)
* Support for metadata-only fetches in k8s_info module

* Fix integration test assert

* Add missing changelog fragment

* Fix linters and sanity checks

* Fix linters

* Apply suggestion from @abikouo

* fix: resolve linter errors after rebase

Fix import sorting and apply black formatting to k8s_info.py and
args_common.py to pass tox -e linters.



---------




(cherry picked from commit 08a761fc17)

Co-authored-by: Federico Chiacchiaretta <federico.chia@gmail.com>
Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com>
Co-authored-by: aubin bikouo <abikouo@redhat.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-08-07 11:03:57 +02:00
0f472b53e2 Prepare release 6.5.0 (#1188)
* Prepare k8s collection release 6.5.0

* update release date for the version 6.5.0

* Update changelog.yaml and changelog.rst mismatch

---------

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
6.5.0
2026-07-08 11:06:30 -04:00
a1cd39a71f Update RST documentation files (#1189) (#1190)
(cherry picked from commit 470c042690)

Co-authored-by: Bianca Henderson <bianca@redhat.com>
2026-07-07 17:17:19 -04:00
6742eaa725 Add meta/execution-environment.yml to fix EE builds on UBI images (#1142) (#1183)
ansible-builder builds fail with "No package matches 'openshift-clients'"
on UBI images because the openshift-clients RPM in bindep.txt requires
repos not available in standard UBI. This adds collection-level EE
metadata pointing to a minimal bindep file without openshift-clients,
while preserving the original bindep.txt for direct bindep usage.

Fixes #1141


(cherry picked from commit a80e2d067c)

Co-authored-by: Christopher Brown <snecklifter@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-07 09:53:59 -04:00
5c98d5696e Add lint ignore entry (#1184) (#1186)
(cherry picked from commit 75a5560aec)

Co-authored-by: Bianca Henderson <bianca@redhat.com>
2026-07-07 09:43:06 -04:00
78b82c74f7 feat(ci): add security check to block .claude/ and .vscode/ directories (#1173) (#1181)
* feat(ci): add security check to block .claude/ and .vscode/ directories

Add workflow that calls the security_check_directories action from
cloud-content-ci-automation to fail PRs containing files under .claude/
or .vscode/ directories.

Integrates with all_green_check.yaml as a required job for PRs.

Ref: ACA-6411



* fix(ci): suppress SonarCloud S7637 for reusable actions using @main

Internal reusable actions from ansible-network/github_actions and
ansible-collections/cloud-content-ci-automation use @main refs for
simpler maintenance. Suppress the 'use full commit SHA' rule for
workflow files.



* fix(ci): use correct org and pin action to commit SHA

Address review feedback:
- Change org from ansible-collections to ansible
- Pin to commit SHA 74b5fe87 instead of @main



* docs: add changelog fragment for security check workflow



* Update changelogs/fragments/1173-security-check-workflow.yml

---------



(cherry picked from commit 6bb9cce51b)

Co-authored-by: GomathiselviS <gomathiselvi@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Bianca Henderson <beeankha@gmail.com>
2026-07-03 08:39:50 -04:00
42963f0536 feat: add plugin --keyring option (#1150) (#1179)
* feat: add plugin --keyring option

* docs: add changelog fragment

* Update changelogs/fragments/20260620-add-plugin-keyring-option.yaml



* feat: restrict helm_plugin keyring to install subcommand (#1)

Restrict the keyring option to state=present (helm plugin install),
the only implemented subcommand that supports --keyring, and fail
explicitly when it is used with other states.



* refactor(helm_plugin): warn instead of fail

* Resolve linter error

* Update plugins/modules/helm_plugin.py

---------




(cherry picked from commit 4b3e24bf02)

Co-authored-by: Kenji Gaillac <48765390+Nhqml@users.noreply.github.com>
Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
Co-authored-by: Bianca Henderson <bianca@redhat.com>
Co-authored-by: Bianca Henderson <beeankha@gmail.com>
2026-07-02 13:24:50 -04:00
9c3988689f helm: use --rollback-on-failure for atomic on Helm v4 (#1144) (#1178)
* helm: use --rollback-on-failure for atomic on Helm v4

Helm v4 renamed the `--atomic` flag to `--rollback-on-failure`. The old
flag is deprecated on `helm upgrade` and removed entirely from `helm
install`, so `atomic: true` failed against Helm v4 (issue #1143).

Emit the version-appropriate flag from deploy() using the existing
is_helm_v4() helper, covering both the upgrade and the replace/install
code paths. The public `atomic` option is unchanged.

Fixes: https://github.com/ansible-collections/kubernetes.core/issues/1143

Co-Authored-By: Claude Opus 4.8

* fix wrong link in the changelog fragment



---------


(cherry picked from commit bc17b33d44)

Signed-off-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
2026-07-01 17:27:39 -04:00
08143fc16f fix(helm): support Helm v4 force/server-side apply flags (#1164) (#1177)
* fix(helm): support Helm v4 force/server-side apply flags

Helm v4 deprecated --force and enables server-side apply by default, so
playbooks relying on force=true broke with "Flag --force has been
deprecated" and "cannot use server-side apply and force replace together".
Because force always meant a client-side delete/recreate replacement, the
module now reproduces that behaviour on v4 (--server-side=false
--force-replace) so existing playbooks keep working unchanged across both
Helm versions.

To let users opt into Helm v4's server-side world explicitly, add
server_side and force_conflicts options. These are mutually exclusive with
force (a client-side replacement cannot coexist with a server-side mode),
keeping the surface unambiguous and surfacing bad combinations up front
instead of as cryptic Helm errors.

AI-assisted commit with Claude Opus

* fix(linter) reformat tests/unit/modules/test_module_helm.py with black

(cherry picked from commit 3634105366)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
2026-07-01 14:12:24 -04:00
457a7dc534 Point to Python 3.13 for ansible-core devel (#1174) (#1176)
(cherry picked from commit ceeafa8c6d)

Co-authored-by: Bianca Henderson <bianca@redhat.com>
2026-07-01 12:19:06 -04:00
Bianca HendersonandGitHub edee5c994d [manual backport stable-6] Fix CI Test Collision (#1162) (#1167)
* Fix CI Test Collision (#1162)

* Fix CI concurrency issue

* More CI fixes

* Fix coverage job install

* Install correct test dependencies

(cherry picked from commit d211f316ad)

* Restore cancel-in-progress: true
2026-06-30 12:01:51 -04:00
a523a195cb ci: suppress SonarCloud python:S5443 for test code (#1165) (#1169)
Unit tests pass hardcoded '/tmp/...' strings as fake module arguments (for
example chart_ref) into fully mocked helm commands, so no file is ever
created and there is no real exposure. SonarCloud's python:S5443 still
raises a security hotspot on each literal and, because it only scores new
code, drops a PR's security rating even though the same pattern already
pervades the existing test suite.

Scope the suppression to tests/** only. Production code creates temporary
files via tempfile.mkstemp / NamedTemporaryFile and remains covered by the
rule, where it carries real value.

AI-assisted commit with Claude Opus

(cherry picked from commit 0836e96c2d)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
2026-06-30 11:48:49 -04:00
7f5c2183c0 CI - configure precommit hook to block commit when files from .claude… (#1149) (#1171)
* CI - configure precommit hook to block commit when files from .claude/ and/or .vscode/ directories are staged

* fix sanity issue - shebang

* Remove local hook and update documentation

(cherry picked from commit a4fc40732a)

Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com>
2026-06-30 10:58:06 +02:00
294c2fce4a Fix workflow concurrency issue (#1159) (#1161)
(cherry picked from commit bb80dde66d)

Co-authored-by: Bianca Henderson <bianca@redhat.com>
2026-06-26 12:03:25 -04:00
ebc015955e Fix all-green CI workflow (#1153) (#1158)
(cherry picked from commit 8bf31513f5)

Co-authored-by: Bianca Henderson <bianca@redhat.com>
2026-06-26 10:53:17 -04:00
57f4bf76cd helm_registry_auth: document/test stdout for registry success messages (Helm 4.2.1) (#1147) (#1156)
* helm: document/test stdout for registry success messages (Helm 4.2.1)

Helm < 4.2.1 prints registry success messages (Login Succeeded, Pushed,
Pulled, Digest) to stderr (helm/helm#13464); Helm >= 4.2.1 moves them to
stdout (helm/helm#32056). The modules key on the return code, so logic is
unaffected, but the RETURN docs and integration assertions assumed stderr.

- helm_registry_auth: note the version-dependent output stream in
  the RETURN documentation.
- helm_registry_auth integration tests: assert success messages against the
  stdout+stderr union so they pass on both old and new Helm.

Fixes: #1146

Co-Authored-By: Claude Opus 4.8

* ci: empty commit to re-trigger ci

(cherry picked from commit ae90b60fd6)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
2026-06-25 16:07:10 -04:00
63f490d123 ci: suppress SonarCloud python:S7498 for argument_spec dict() convention (#1152) (#1155)
Ansible module argument_spec is conventionally defined with the dict(...)
constructor rather than {...} literals, for readability and consistency
across the collection. SonarCloud's python:S7498 ("Literal syntax should
be preferred...") flags this as a false positive and re-fires on every
new module argument. Ignore the rule project-wide via sonar-project.properties.

Fixes #1151

(cherry picked from commit 1c20b53bdc)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
2026-06-25 14:07:07 -04:00
1d49a942d9 Manual backport of SonarQube configuration to stable-6 branch (#1136)
* Manual backport of SonarQube configuration to stable-6 branch

* Add CI.md and align README with collection standards (#1124)

Include CI.md from #1124 and update README.md to match the Red Hat
Ansible Certified Collection layout from main, with stable-6 branch
references for repository links.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Revert changes to some README links

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-29 17:31:59 -04:00
d8ae230bcf docs: clarify ansible turbo mode with version compatibility notice (#1120) (#1132)
The docs/ansible_turbo_mode.rst file was accidentally removed in PR#988,
breaking the link referenced in README.md. Restore it so users following
that link get the full Turbo mode documentation rather than a 404.

Additionally, document the ansible-core version compatibility issue for
cloud.common (see ansible-collections/cloud.common@5e3430d and
kubernetes.core PR #1109): Turbo mode is incompatible with ansible-core
>= 2.19 because cloud.common no longer supports it. Without this
clarification users on newer ansible-core versions encounter silent or
confusing failures when ENABLE_TURBO_MODE=1 is set.

Update README.md with the same warning so the incompatibility is visible
before users follow the link to the full docs.

Addresses: #927
(cherry picked from commit 248e0d7db9)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kiev.ua>
2026-05-26 09:58:23 -04:00
71e9aba89c Fix unit test failures in CI (#1133) (#1135)
(cherry picked from commit f69761f37c)

Co-authored-by: Bianca Henderson <bianca@redhat.com>
2026-05-25 15:53:21 -04:00
fdebba58bc Kubeconfig module improvement (#1123) (#1131)
* Add kubeconfig module for managing Kubernetes config files

* Remove unnecessary requirement & Change version

* Move functions to module_utils

* Add unit tests

* Add kubeconfig module for managing Kubernetes config files

* Remove unnecessary requirement & Change version

* Move functions to module_utils

* Add unit tests

* Avoid linter errors

* Improve documentation clarity

* Redact sensitive kubeconfig information

* Imprvoe verbosity

* Move import statement for to_native to avoid linters check failure

* Fix linting error

* Add remove behavior

* Add tests for remove behavior

* Imporve documentation

* Add changelog

---------


(cherry picked from commit 53c6c0ee80)

Co-authored-by: Youssef Ali <154611350+YoussefKhalidAli@users.noreply.github.com>
Co-authored-by: Bianca Henderson <bianca@redhat.com>
2026-05-19 14:38:15 -04:00
e87fe77453 Update pod deletion conditions for local storage used in a daemon set pod (#1095) (#1128)
* Update pod deletion conditions for local storage used in a daemon set pod

Refactor pod deletion logic to handle local storage in daemon set pods correctly.

* Add bugfix for k8s_drain handling local storage pods

Fix logic for handling pods with local storage in k8s_drain.

* Refactor filter_pods function for clarity and efficiency

* Fix sanity and linter errors

---------


(cherry picked from commit b58b2ca70e)

Co-authored-by: Juan Morete <morete@gmail.com>
Co-authored-by: Bianca Henderson <bianca@redhat.com>
2026-05-15 15:16:01 -04:00
714c2f6711 fix(helm_repository): strip trailing slashes from repo_url (#1121) (#1126)
Helm normalizes repository URLs internally, so a URL supplied with a
trailing slash and the same URL without one are treated as different
entries. This causes the module to fail every run when the user
provides a trailing slash, even though the repository is already
correctly registered.

Strip the trailing slash from repo_url before comparing against the
existing repository list so repeated runs with the same input are
idempotent.

Fixes #480

(cherry picked from commit 8a58d3b6de)

Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kiev.ua>
2026-05-14 10:56:28 -04:00
2fb6546b03 docs: add until example to k8s_info (#885) (#1119)
I would liked to have an example like this when I was using the
documentation.

(cherry picked from commit 4d7dc2a7d1)

Co-authored-by: Birger Johan Nordølum <33870508+MindTooth@users.noreply.github.com>
2026-05-06 10:16:32 -04:00
ef9fb67688 Add kubeconfig module for managing Kubernetes config files (#1104) (#1122)
* Add kubeconfig module for managing Kubernetes config files

* Remove unnecessary requirement & Change version

* Move functions to module_utils

* Add unit tests

* Add kubeconfig module for managing Kubernetes config files

* Remove unnecessary requirement & Change version

* Move functions to module_utils

* Add unit tests

* Avoid linter errors

* Improve documentation clarity

* Redact sensitive kubeconfig information

* Imprvoe verbosity

* Move import statement for to_native to avoid linters check failure

* Fix linting error

---------


(cherry picked from commit e79ed52a4d)

Co-authored-by: Youssef Ali <154611350+YoussefKhalidAli@users.noreply.github.com>
Co-authored-by: Bianca Henderson <bianca@redhat.com>
2026-05-06 10:15:42 -04:00
Bianca HendersonandGitHub 90bc4c4b3b Release prep for 6.4.0 (#1101)
SUMMARY

Prep kubernetes.core 6.4.0 release

COMPONENT NAME

Multiple

Reviewed-by: Bianca Henderson <beeankha@gmail.com>
Reviewed-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua>
Reviewed-by: Bikouo Aubin
Reviewed-by: Hannah DeFazio <h2defazio@gmail.com>
6.4.0
2026-04-22 21:04:10 +00:00
1590c6a4cc Update URL reference in integration-test CI file (#1112) (#1114)
(cherry picked from commit 210467b26d)

Co-authored-by: Bianca Henderson <bianca@redhat.com>
2026-04-22 14:14:06 -04:00