Skip to content

Conversation

@meskinemohamed
Copy link

@meskinemohamed meskinemohamed commented Dec 1, 2025

Fixes #3996

Also, I think we need to edit the constraints in framework, I can open a PR if need ?

@meskinemohamed meskinemohamed requested a review from a team as a code owner December 1, 2025 20:13
@meskinemohamed meskinemohamed changed the title Remove deprecated spec.preserveUnknownFields fix: remove deprecated spec.preserveUnknownFields Dec 1, 2025
@meskinemohamed meskinemohamed force-pushed the fix/remove-deprecated-preserveUnknownFields branch from 9ce277a to 96e39cd Compare December 1, 2025 20:15
@JaydipGabani JaydipGabani requested a review from Copilot December 1, 2025 22:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the deprecated spec.preserveUnknownFields field from Kubernetes Custom Resource Definitions (CRDs) and updates the corresponding kubebuilder markers to use the newer syntax.

  • Removes preserveUnknownFields: false from all CRD manifests
  • Updates kubebuilder markers from +kubebuilder:validation:XPreserveUnknownFields to +kubebuilder:pruning:PreserveUnknownFields
  • Removes the kustomization patch that was applying the deprecated field

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated no comments.

Show a summary per file
File Description
manifest_staging/deploy/gatekeeper.yaml Removes deprecated preserveUnknownFields: false from 16 CRD definitions in the main deployment manifest
manifest_staging/charts/gatekeeper/crds/*.yaml (17 files) Removes deprecated preserveUnknownFields: false from individual CRD chart files
config/crd/patches/preserve_unknown_fields_false.yaml Deletes the patch file that was adding the deprecated field
config/crd/kustomization.yaml Removes the kustomization patch reference for preserve_unknown_fields_false.yaml
apis/mutations/v1/value.go Updates kubebuilder marker to new pruning syntax
apis/mutations/v1/modifyset_types.go Updates kubebuilder marker to new pruning syntax
apis/mutations/v1alpha1/value.go Updates kubebuilder marker to new pruning syntax
apis/mutations/v1alpha1/modifyset_types.go Updates kubebuilder marker to new pruning syntax
apis/mutations/v1beta1/value.go Updates kubebuilder marker to new pruning syntax
apis/mutations/v1beta1/modifyset_types.go Updates kubebuilder marker to new pruning syntax
apis/mutations/unversioned/value.go Updates kubebuilder marker to new pruning syntax
apis/mutations/unversioned/modifyset_types.go Updates kubebuilder marker to new pruning syntax
apis/connection/v1alpha1/connection_types.go Updates kubebuilder marker to new pruning syntax

@JaydipGabani
Copy link
Contributor

@meskinemohamed yeah please open a PR in frameworks as well and link it here.

@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 40.73%. Comparing base (3350319) to head (1a0ab5f).
⚠️ Report is 524 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (3350319) and HEAD (1a0ab5f). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (3350319) HEAD (1a0ab5f)
unittests 2 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4276       +/-   ##
===========================================
- Coverage   54.49%   40.73%   -13.77%     
===========================================
  Files         134      251      +117     
  Lines       12329    17723     +5394     
===========================================
+ Hits         6719     7219      +500     
- Misses       5116     9881     +4765     
- Partials      494      623      +129     
Flag Coverage Δ
unittests 40.73% <ø> (-13.77%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@meskinemohamed
Copy link
Author

@JaydipGabani Done, PR is available here thanks !

Copy link
Contributor

@JaydipGabani JaydipGabani left a comment

Choose a reason for hiding this comment

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

These changes looks good, please address this comment - open-policy-agent/frameworks#644 (comment) and also resolve conflict.

@meskinemohamed meskinemohamed force-pushed the fix/remove-deprecated-preserveUnknownFields branch from 795da52 to 1a0ab5f Compare December 10, 2025 21:47
go.mod Outdated
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
)

replace github.com/open-policy-agent/frameworks/constraint => github.com/meskinemohamed/frameworks/constraint v0.0.0-20251210214342-3fd8922d7fc4
Copy link
Contributor

Choose a reason for hiding this comment

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

Just making a note to remove this and bump frameworks before merging this PR.

@JaydipGabani
Copy link
Contributor

@meskinemohamed can you run make manifests generate and push the changes, also I merged the frameworks PR so you can just bump the frameworks with latest commit and remove the replace .. line?

- Remove preserveUnknownFields from all CRD definitions (deprecated in k8s 1.16+)
- Remove config/crd/patches/preserve_unknown_fields_false.yaml patch file
- Remove patch reference from config/crd/kustomization.yaml
- Update kubebuilder annotations from +kubebuilder:validation:XPreserveUnknownFields
  to +kubebuilder:pruning:PreserveUnknownFields per KubeBuilder docs
- Update frameworks/constraint to use fork with fix for regenerated manifests
- Regenerate manifests

Fixes open-policy-agent#3996

Signed-off-by: meskinemohamed <mohamed.meskine@dataiku.com>
@meskinemohamed meskinemohamed force-pushed the fix/remove-deprecated-preserveUnknownFields branch from 3be7e0e to 8237e88 Compare December 12, 2025 15:47
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.

spec.preserveUnknownFields has been deprecated in favor of x-kubernetes-preserve-unknown-fields: true in the CRD v1

3 participants