Skip to content

Epic 18 - #417

Merged
raffaelespazzoli merged 16 commits into
redhat-cop:mainfrom
raffaelespazzoli:epic-18
Nov 15, 2026
Merged

raffaelespazzoli merged 16 commits into
redhat-cop:mainfrom
raffaelespazzoli:epic-18

Conversation

@raffaelespazzoli

@raffaelespazzoli raffaelespazzoli commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

remove most of the admission webhook in favor of more lightweight VAPs.

epic-18: done

  # Story 18.1: VAP Infrastructure + Path/Name Immutability Policies
  # - Set up config/vap/ kustomize overlay and envtest VAP support
  # - Create 2 shared VAPs: vco-immutable-path (72 CRDs), vco-immutable-name (65 CRDs)
  # - Fixes 4 missing path-immutable + 31 missing name-immutable gaps
  # - Remove path/name Go validation from webhook files
  # - VAP enforcement smoke tests (vap_enforcement_test.go)
  # Complexity: High — first VAP in project, new CEL patterns
  # Novelty Risk: HIGH
  18-1-vap-infrastructure-and-universal-immutability-policies: done

  # Story 18.1.1: Target Namespace Guard VAP
  # - Create parameterized vco-target-namespace-guard VAP (92 CRDs) with CleansePath/JoinNamespace CEL
  # - Create vco-vap-params ConfigMap for VAULT_NAMESPACE fallback
  # - Remove ValidateTargetNamespaceUpdate from all 91 webhook files and commons.go
  # - Completes the universal immutability VAP set from 18.1
  # - Must complete before 18.3 (webhook code removal)
  # Complexity: High — parameterized VAP, CEL string manipulation
  # Novelty Risk: HIGH
  18-1-1-target-namespace-guard-vap: done

  # Story 18.2: Credential Source + CRD-Specific VAPs
  # - Credential source mutual-exclusivity VAPs (rootCredentials group + per-field groups)
  # - ~15 CRD-specific VAPs for unique isValid() logic
  # - TransitSecretEngineKey, AWSSecretEngineRole, RandomSecret, mounts, etc.
  # Complexity: High — 15+ distinct CEL policies
  # Novelty Risk: MEDIUM
  18-2-credential-source-and-crd-specific-vaps: done

  # Story 18.3: Webhook Code Removal + Residual Webhook Cleanup + CSV Version Bump
  # - Remove all migrated validating webhook logic
  # - Keep residual mutating webhooks (AWS/CF/GCP/Okta/RADIUS/SSH/TFC/Userpass defaulters, K8sAuthConfig CA reader)
  # - Keep RabbitMQ cross-resource validating webhook
  # - Evaluate simple defaulters for +kubebuilder:default migration
  # - Update main.go webhook registration + kustomize webhook config
  # - Bump CSV minKubeVersion from 1.29.0 → 1.30.0 (VAPs GA in K8s 1.30)
  # - Bump com.redhat.openshift.versions from v4.16 → v4.17 (OCP 4.17 = K8s 1.30)
  # Complexity: Medium
  # Novelty Risk: LOW
  18-3-webhook-code-removal-and-residual-webhook-cleanup-and-csv-version-bump: done

  # Story 18.4: VAP Test Suite — envtest + Integration Coverage
  # - Configure envtest to enable ValidatingAdmissionPolicy admission plugin
  # - envtest tests: vap_test.go — table-driven tests per shared VAP, per CRD-specific VAP
  # - Integration tests: vap_integration_test.go — Kind cluster VAP enforcement
  # - Cover the 35 previously-missing gap fixes
  # - Adapt existing webhook_validate_update_test.go scenarios
  # Complexity: Medium
  # Novelty Risk: MEDIUM
  18-4-vap-test-suite-envtest-and-integration-coverage: done

  # Story 18.5: Documentation — VAP Approach + Admission Control Guide
  # - Create docs/admission-control.md explaining 3-tier VAP architecture
  # - Update developer guide for adding new CRD types (VAP binding steps)
  # - Update project-context.md admission webhook rules for VAP-first approach
  # Complexity: Low
  # Novelty Risk: LOW
  18-5-documentation-vap-approach-and-admission-control-guide: done

  # Story 18.6: Project Context + Sprint Status Finalization
  # - Final update to sprint-status.yaml, project-context.md, epics.md
  # - Retrospective
  # Complexity: Low
  # Novelty Risk: LOW
  18-6-project-context-and-sprint-status-finalization: done
  epic-18-retrospective: done

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

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
… runs

- Add pre-test cleanup of orphaned secret engines, auth engines, and
  policies left by previous integration test runs
- Split integration tests into unit-tagged and controller packages with
  separate coverage profiles, then merge into cover.out
- Adjust timeouts (10m for unit-tagged, 30m for controller integration)

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

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
Create shared VAP infrastructure in config/vap/ with two policies:
- vco-immutable-path: CEL-based path immutability for 72 CRDs
- vco-immutable-name: CEL-based name immutability for 65 CRDs

Remove migrated Go validation (spec.path and spec.name checks) from
92 webhook ValidateUpdate methods. Configure envtest with VAP admission
plugin and add enforcement smoke tests.

Fixes 4 CRDs previously missing path immutability checks:
AzureAuthEngineRole, GCPAuthEngineRole, JWTOIDCAuthEngineRole,
LDAPAuthEngineGroup.

Target-namespace-guard VAP deferred to follow-up plan.

Story: 18.1

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
Split from Story 18.1 during implementation. Creates the parameterized
vco-target-namespace-guard VAP (92 CRDs) with CleansePath/JoinNamespace
CEL logic, vco-vap-params ConfigMap, and removes ValidateTargetNamespaceUpdate
from all 91 webhook files. Must complete before Story 18.3.

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
- Create parameterized vco-target-namespace-guard VAP with CEL
  CleansePath/JoinNamespace logic and vco-vap-params ConfigMap
- Add kustomize namespace replacement for binding paramRef
- Add 8 envtest VAP enforcement tests covering all edge cases
- Remove ValidateTargetNamespaceUpdate from 91 webhook files
- Remove ValidateTargetNamespaceUpdate and displayNamespace from commons.go
- Clean up associated test files
- Fix Makefile: use helm upgrade -i for idempotent helmchart-test
- Configure bmad-build: no auto-commit, grok 4.7 for reviews

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

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
Add 30 ValidatingAdmissionPolicies + 30 bindings covering:
- Shared credential-source mutual-exclusivity (root + bind)
- Per-CRD validations: immutability, conditional fields, one-way flags
- CRD-specific rules for Transit, TOTP, AWS role, RandomSecret, mounts

Story 18.2: Credential Source + CRD-Specific VAPs

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

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
…ter-only

Story 18.3: Webhook code removal and residual webhook cleanup.

- Delete 68 webhook files with no-op Default() and VAP-covered validation
- Gut 7 webhook files to defaulter-only (CF, K8s, GCP, Okta, SSH,
  Terraform, Radius auth/secret engine configs)
- Retain 24 webhook files: 1 Cat-A (AWSAuthEngineClientConfig),
  15 Cat-C (uncovered CRD-specific validation), 7 Cat-B (defaulter-only),
  1 Cat-E (RabbitMQ raw handler)
- Remove 68 SetupWebhookWithManager calls from cmd/main.go (91→23)
- Trim webhook_validate_update_test.go and webhook_suite_test.go
- Delete orphaned namespace_webhook_test.go and
  transitsecretenginekey_webhook_test.go
- Bump minKubeVersion 1.29.0→1.30.0, OCP annotation v4.16→v4.17
- Regenerate config/webhook/manifests.yaml and CRD bases

90 files changed, ~224 insertions, ~9563 deletions

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

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
Add comprehensive test coverage for all ValidatingAdmissionPolicy rules
in both envtest (unit tier) and Kind (integration tier).

envtest tests (api/v1alpha1/vap_test.go — 90 specs):
- Immutable-path rejection for 15 CRDs (incl. 4 gap CRDs)
- Immutable-name rejection for 15 CRDs (incl. 12 gap CRDs)
- Target-namespace-guard rejection and allowance
- Credential source mutual-exclusivity (create + update)
- CRD-specific VAP enforcement (9 types, 20+ cases)
- Positive allowance tests for all shared VAPs

Kind integration tests (internal/controller/vap_integration_test.go):
- VAP manifest deployment verification
- Immutable-path enforcement with Eventually retry
- CRD-specific enforcement (TransitSecretEngineKey)

VAP manifest fixes — add has() guards for omitempty fields:
- vco-validate-totpsecretenginekey: generate, keySize
- vco-validate-randomsecret: isKVSecretsEngineV2
- vco-validate-authenginemount: type, description
- vco-validate-secretenginemount: type, description, local,
  sealWrap, externalEntropyAccess
- vco-validate-transitsecretenginekey: convergentEncryption,
  derived, type, keySize, exportable, allowPlaintextBackup

Existing webhook tests stripped to retain only residual Go webhook
validation (AppRoleAuthEngineRole localSecretIDs, LDAPSecretEngineStaticRole
username/dn).

Story: 18.4
Epic: 18 (Webhook-to-VAP Migration)
Co-authored-by: Cursor <cursoragent@cursor.com>

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
Co-authored-by: Cursor <cursoragent@cursor.com>

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
Co-authored-by: Cursor <cursoragent@cursor.com>

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
@sabre1041

Copy link
Copy Markdown
Contributor

@raffaelespazzoli can you review the test failures?

Wait for VAP enforcement in BeforeSuite so randomized Ginkgo specs cannot race
policy compile, and load helmchart images via archive without BuildKit attestations.

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

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
Docker on GHA saves busybox:1.37 as a multi-arch index; kind import
--all-platforms then fails on the arm32v5 digest. Force linux/$arch pull.

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

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
Docker's containerd store keeps the multi-arch index after --platform pull,
so save+kind --all-platforms still misses arm32v5. Rebuild locally and import
via ctr without --all-platforms.

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

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
@raffaelespazzoli

Copy link
Copy Markdown
Collaborator Author

cc @sabre1041

@sabre1041 sabre1041 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.

LGTM

sebastiendavos and others added 2 commits November 15, 2026 07:13
…x target-namespace-guard params

- vco-validate-randomsecret: check (spec.path + "/") for a "/data/" segment,
  matching the webhook semantics (GetPath() = path + "/" + name). A KVv2
  RandomSecret with spec.path "secret/data" was valid before the VAP
  migration and is now rejected on CREATE and on every UPDATE.
- vco-immutable-path: spec.path is optional on several CRDs; guard it
  with has() like vco-immutable-name does.
- vco-target-namespace-guard: drop vaultsecrets (no spec.authentication,
  never covered by the former Go check) and guard spec.authentication.
- kustomize: keep the binding paramRef name/namespace in sync with the
  vco-vap-params ConfigMap (namePrefix in config/default, release
  namespace in config/helmchart). Without this the parameter is never
  found and the policy is silently skipped.
- envtest: cover the three cases.

Fixes redhat-cop#419

Signed-off-by: Sebastien DAVOS <349436848+sebastiendavos@users.noreply.github.com>
Resolve Makefile conflict by keeping epic-18's single-platform ctr import
for helmchart-test and accepting main's CONTAINER_BUILD_OPTS alongside
DOCKER_BUILD_EXTRA_ARGS. Includes VAP fixes for redhat-cop#419/redhat-cop#422.

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

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
@raffaelespazzoli
raffaelespazzoli merged commit 4780686 into redhat-cop:main Nov 15, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants