Skip to content

refactor(policy): preserve Helm release defaults on CEL policies - #5360

Merged
devantler merged 8 commits into
mainfrom
codex/helm-policy-migration-4997-r69
Oct 26, 2026
Merged

devantler merged 8 commits into
mainfrom
codex/helm-policy-migration-4997-r69

Conversation

@devantler

Copy link
Copy Markdown
Contributor

🤖 Generated by the Agentic Engineer

Why

Two automatic release defaults still rely on a retiring policy format. They need to keep working through the platform upgrade.

What

Preserve automatic release testing and retry settings on the supported format, including existing opt-outs and unrelated settings. The broader migration stays open.

Fixes #5357
Part of #4997

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

Local validation at a27dd76fa46f6668b57dbe7c0db22eb8a2d78dd6 preserves the two legacy HelmRelease defaults. Twenty old-policy cases were committed before migration; their expected objects were generated by the original policies with the exact CI-pinned Kyverno 1.19.1 CLI. The replacement policies pass the same expectations, including missing/null parents, authored values, unrelated keys, opt-outs, wrong kinds and kind-only matching across API groups. Six deliberate old-rule ablations were rejected. Complete objects also match across all six orders of the three Helm defaults and repeated application (57 offline applications). All 98 existing Kyverno fixture files passed the complete-evaluation guard.

The pinned CLI's CEL UPDATE processor copies the incoming object into oldObject, so the old-label fixture alone cannot prove the UPDATE boundary. A dedicated control opens only the selector on a temporary policy copy, modeling an already-admitted old-label request: the real incoming conditions skip both opt-outs, and removing those conditions makes the same fixtures fail. This runs in the existing policy job.

Native run 40267919289 correctly rejected two unregistered policy identities and unknown CEL surfaces. The follow-up records only those two authorization-inventory replacements, with every other ledger entry unchanged. Consumer discovery separately recognizes their complete rendered API/kind/spec fingerprints; names alone grant nothing. Its full regression suite passes with zero failures, including both positives and 26 changed-scope, side-effect, patch-path, evaluation and foreign-kind/API refusals. The real conservation guard passes on Bash 3.2 and 5. The unchanged complete authorization regression suite and rendered equality check pass with the pinned renderer. ShellCheck, actionlint and the policy-job contract pass.

As the platform operator, I inspected all ten prescribed configuration layers. Both provider infrastructure renders contain exactly the two new MutatingPolicies and no corresponding legacy ClusterPolicy. The defaults and unrelated settings match the legacy output. Local/prod KSail validation exits zero, but its Helm rendering reports missing local credential-helper support for 20 charts; that portion is not claimed as complete validation, including after a private anonymous-client retry. No shared credentials or installed tools changed. Full current-head native CI, substantive review, protected deployment and live policy readback remain required. Parent #4997 remains open for its other policies.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

The manifest failure at a27dd76fa46f6668b57dbe7c0db22eb8a2d78dd6 was the existing effective-policy CEL producer gate refusing the two new formats. The repair records only their two complete closed specifications; matching a name or a patch path grants nothing. Every existing effective-policy rule remains byte-identical. All scope, incoming-label conditions, fixed values and field names are fixed; token whitespace is tolerated only after quoted literal whitespace and escapes are refused.

The complete real Crossplane/Helm/effective-policy suite passes on Bash 3.2 and 5, including both approved definitions and 26 schema-valid altered-scope, side-effect, value-path, extra-selector and evaluation controls. An initial unknown-field fixture failed schema validation before reaching the intended gate; it was replaced with a schema-valid control, preserving both validators. No schema check or admission gate was disabled.

Both local and production configuration validation also completed using an isolated anonymous public-chart client that reads no host credentials, resolving the earlier missing-helper limitation. The known offline namespace-label warnings remain unproven admission cases. Those runs precede the latest independent main synchronization; fresh native CI must judge the combined head. The final combined authorization suite passes uncached and consumer conservation remains exact. No production deployment or live policy acceptance is claimed. Parent #4997 remains open.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T07:59:02.735494Z 3ed20e3 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

The acknowledged request's original 30-minute observation window has expired. A complete fresh read at 06:37 UTC still shows only the running acknowledgement, with no submitted review, completed verdict or finding. The current head and all finding surfaces were checked again before advancing the ordered review loop. This records a stalled request, not a successful review or permission to merge without one. A later finding remains actionable.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@devantler

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3ed20e3. Configure here.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 38 minutes.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between ac76568 and 3ed20e3.

Files selected for processing: 22
  • .github/workflows/ci.yaml
  • k8s/bases/infrastructure/cluster-policies/flux/helm-release-enable-tests.yaml
  • k8s/bases/infrastructure/cluster-policies/flux/helm-release-remediation-retries.yaml
  • scripts/guard-consumer-discovery-conservation.sh
  • scripts/tests/crossplane-egress-policy-rules.yaml
  • scripts/tests/test-crossplane-egress-policy.sh
  • scripts/tests/test-guard-consumer-discovery-conservation.sh
  • scripts/tests/test-helm-release-mutation-scope.sh
  • scripts/validate-eks-ci-role-policy/approved-surface-history.md
  • scripts/validate-eks-ci-role-policy/approved-surface.txt
  • tests/helm-release-enable-tests/kyverno-test.yaml
  • tests/helm-release-enable-tests/label-removed/kyverno-test.yaml
  • tests/helm-release-enable-tests/label-removed/resources.yaml
  • tests/helm-release-enable-tests/label-removed/values.yaml
  • tests/helm-release-enable-tests/patched-resources.yaml
  • tests/helm-release-enable-tests/resources.yaml
  • tests/helm-release-remediation-retries/kyverno-test.yaml
  • tests/helm-release-remediation-retries/label-removed/kyverno-test.yaml
  • tests/helm-release-remediation-retries/label-removed/resources.yaml
  • tests/helm-release-remediation-retries/label-removed/values.yaml
  • tests/helm-release-remediation-retries/patched-resources.yaml
  • tests/helm-release-remediation-retries/resources.yaml

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Recent review details
Additional context used
Code guidelines: 1
AGENTS.md — auto-discovered
Path-based instructions: 1
Source excerpt: The platform uses a hierarchical kustomization structure: **base** configurations in `k8s/bases/` → **provider-specific** overlays in `k8s/providers/` → **cluster-specific** overlays in `k8s/clusters/`.

CodeRabbit inference engine (AGENTS.md)

Files:

  • k8s/bases/infrastructure/cluster-policies/flux/helm-release-enable-tests.yaml
  • k8s/bases/infrastructure/cluster-policies/flux/helm-release-remediation-retries.yaml
Learnings: 1
Learning: 2026-08-10T13:01:12.782Z
Learnt from: devantler
Repo: devantler-tech/platform PR: 3057
File: .github/workflows/ci.yaml:622-659
Timestamp: 2026-08-10T13:01:12.782Z
Learning: Repository shell tests and scripts must remain compatible with macOS Bash 3.2. Do not use Bash 4+ features such as `mapfile`; use portable constructs, such as a `while IFS= read -r` loop, instead.

Applied to files:

  • scripts/tests/test-crossplane-egress-policy.sh
  • scripts/guard-consumer-discovery-conservation.sh
Walkthrough

The two Flux HelmRelease default policies change from ClusterPolicy to MutatingPolicy. They use JSON patches to set test enablement or remediation values while conditionally creating missing or null parent fields. New fixtures and regression tests cover opted-in and excluded resources, existing settings, and label changes on updates. The consumer-discovery guard, CEL producer rule, CI workflow, and approved-surface records are updated for these policies.

Possibly related issues

Possibly related PRs

Priority: Normal

Merge Risk: Minimal · up to 3ed20

No demonstrated policy regression blocks merging. Current-head validation and deployment verification remain outstanding.

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive The implementation matches the coding objectives in [#5357]. Both resources are MutatingPolicy objects with CREATE/UPDATE matching, incoming-label conditions, failurePolicy: Fail, and JSON pat… Provide current-head results for the required policy tests, fixture-evaluation guard, and manifest/layer validation. No conclusion is made here from the separately outstanding deployment, review, or live-readback tasks because those are non…
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the main change: migrating Helm release default policies to CEL-based policies while preserving their behavior.
Description check Passed The description directly explains the need to migrate the two release defaults and preserve testing, retry settings, opt-outs, and unrelated settings.
Out of Scope Changes check Passed The changes stay within [#5357]. They migrate only helm-release-enable-tests and helm-release-remediation-retries and add directly related fixtures, regression tests, CI wiring, consumer-discovery…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 4 files. (18 skipped: 1…
Full details: Out of Scope Changes check

Explanation

The changes stay within [#5357]. They migrate only helm-release-enable-tests and helm-release-remediation-retries and add directly related fixtures, regression tests, CI wiring, consumer-discovery checks, and authorization-surface records. The CRD-install default and other migration work remain unchanged.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 4 files. (18 skipped: 18 unsupported.)

Full details: Linked Issues check

Explanation

The implementation matches the coding objectives in [#5357]. Both resources are MutatingPolicy objects with CREATE/UPDATE matching, incoming-label conditions, failurePolicy: Fail, and JSON patches that preserve unrelated settings. The PR adds fixture coverage, repeated-application and composition checks, fixture-evaluation guards, CI wiring, and policy-surface validation. However, the available record says current-head native CI and post-synchronization manifest/layer validation remain outstanding, so complete automated-test compliance cannot be established.

Resolution

Provide current-head results for the required policy tests, fixture-evaluation guard, and manifest/layer validation. No conclusion is made here from the separately outstanding deployment, review, or live-readback tasks because those are non-coding tasks.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

CodeRabbit explicitly declined this exact-head request under the included review limit. No green review was produced. The earlier Codex request already has its authenticated acknowledgement-timeout record, and Bugbot remains neutral after the sole finding was refuted with native execution evidence and its thread resolved. The draft still needs a qualifying current-head green review; collect the next included review opportunity after the provider’s reset rather than repeat a request inside the same limit window.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 3ed20e35b5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

Current-head readiness at 3ed20e35b50ede3a17f6a319cc16d3445fc69e38:

Native CI 40272630712 passed the complete policy fixtures, consumer-discovery regressions, production authorization, repository guards, and local/production manifest validation. These exercise the migrated defaults and preservation boundaries described in the earlier operator evaluation. The current-head security and Code Quality workflow runs also completed successfully; the separate native Code Quality rule remains independently unqueryable, so it is not represented as independently verified.

The Codex receipt matches this head. The refreshed CodeRabbit summary passes the reviewed exact-head verdict helper. All review/comment surfaces were read completely; the sole Bugbot finding has native refutation evidence and its thread is resolved. The summary's inconclusive linked-issue assessment requested current-head validation; the native run above supplies those results.

The base remains ac76568f45ac2196f34ea8c4741000ad6db18b84, the PR is CLEAN, and live platform health passes. Protected queue deployment and the live policy/admission readback in #5357 remain outstanding; #4997 stays open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Preserve Helm release defaults while retiring two legacy mutation policies

1 participant