Skip to content

fix: remove deprecated spec.preserveUnknownFields#644

Merged
JaydipGabani merged 3 commits intoopen-policy-agent:masterfrom
meskinemohamed:fix/remove-deprecated-preserveUnknownFields
Dec 12, 2025
Merged

fix: remove deprecated spec.preserveUnknownFields#644
JaydipGabani merged 3 commits intoopen-policy-agent:masterfrom
meskinemohamed:fix/remove-deprecated-preserveUnknownFields

Conversation

@meskinemohamed
Copy link
Copy Markdown
Contributor

@meskinemohamed meskinemohamed commented Dec 2, 2025

  • Remove deprecated spec.preserveUnknownFields: false from CRD definitions
  • This field defaults to false in CRD v1 and is deprecated in favor of x-kubernetes-preserve-unknown-fields

Related to:

  The preserveUnknownFields field is deprecated in CRD v1 and defaults
  to false. Explicitly setting it is unnecessary and triggers deprecation
  warnings.

Signed-off-by: meskinemohamed <mohamed.meskine@dataiku.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.56%. Comparing base (76869f8) to head (c781d4a).
⚠️ Report is 144 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #644       +/-   ##
===========================================
- Coverage   54.68%   43.56%   -11.12%     
===========================================
  Files          71       97       +26     
  Lines        5241     5380      +139     
===========================================
- Hits         2866     2344      -522     
- Misses       2073     2733      +660     
- Partials      302      303        +1     
Flag Coverage Δ
unittests 43.56% <ø> (-11.12%) ⬇️

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.

Copy link
Copy Markdown

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 CustomResourceDefinition (CRD) specifications. In CRD apiextensions.k8s.io/v1, this field defaults to false and has been deprecated in favor of using x-kubernetes-preserve-unknown-fields at the schema level.

  • Removed preserveUnknownFields: false from ConstraintTemplate CRD definitions
  • Eliminated redundant kustomize patch that was setting this deprecated field

Reviewed changes

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

File Description
constraint/pkg/schema/yaml_constant.go Removed deprecated preserveUnknownFields: false from the CRD YAML constant string
constraint/deploy/crds.yaml Removed deprecated preserveUnknownFields: false from the deployed CRD manifest
constraint/config/crds/kustomization.yaml Removed the entire kustomize patch section that was setting the deprecated field, reorganizing the file structure

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JaydipGabani
Copy link
Copy Markdown
Contributor

@meskinemohamed these changes look good, thanks for working on this!

can you run make manifests && make generate and push the changes? After this can you replace frameworks vendor in the gatekeeper PR for the same with latest commit -

replace github.com/open-policy-agent/frameworks/constraint => https://github.com/meskinemohamed/frameworks <commit-id>

After replcaing you will need to run go mod tidy && go mod vendor and then push changes to GK pr.

@meskinemohamed meskinemohamed force-pushed the fix/remove-deprecated-preserveUnknownFields branch from da5c19c to 943cda7 Compare December 10, 2025 21:42
meskinemohamed and others added 2 commits December 10, 2025 22:43
Run make manifests && make generate to update generated files
after removing deprecated spec.preserveUnknownFields.

Signed-off-by: meskinemohamed <mohamed.meskine@dataiku.com>
Copy link
Copy Markdown
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.

lgtm

@JaydipGabani JaydipGabani merged commit cf69624 into open-policy-agent:master Dec 12, 2025
8 of 10 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.

4 participants