Skip to content

Remove deprecated preserveUnknownFields from CRD manifests - #11

Merged
fredleger merged 3 commits into
masterfrom
copilot/fix-argocd-sync-issue
Oct 18, 2026
Merged

fredleger merged 3 commits into
masterfrom
copilot/fix-argocd-sync-issue

Conversation

Copilot AI commented Oct 18, 2026 •

Copy link
Copy Markdown

Description

ArgoCD apps pointing at manifest.yaml sit in perpetual OutOfSync: the diff shows preserveUnknownFields: false on the ClusterPullSecret CRD.

Root cause: spec.preserveUnknownFields is deprecated in apiextensions.k8s.io/v1 (per the upstream API type docs) and is a bool with omitempty — the API server strips it from stored objects when false, so the desired manifest always carries a line the live object never has. Removal is behavior-neutral: with a structural schema, pruning unknown fields is the only supported mode in v1; false is implicit.

Changes:

  • config/crd/bases/ops.alexellis.io_clusterpullsecrets.yaml — dropped the field at the source. Editing only manifest.yaml would be overwritten by the next make shrinkwrap (release workflow regenerates it from here).
  • manifest.yaml — dropped the same line; verified byte-identical to kustomize build config/default output (modulo image tag).
  • .github/workflows/build.yaml — guard in the existing "Apply manifests" step so a reintroduction fails CI:
! grep -q "preserveUnknownFields" ./manifest.yaml

Regression risk is low: verified in the pinned controller-gen v0.13.0 source (pkg/crd/spec.go) that CRD spec construction never sets this field — it's a leftover from an ancient generator version, and only the per-schema x-kubernetes-preserve-unknown-fields marker survives in v0.13.0.

Which issue # does this fix? And was it approved before you worked on it?

Checklist:

  • I waited for approval before creating this PR

Note: if the PR is for a typo, please close it and raise an issue instead.

How Has This Been Tested?

  • kustomize build config/default output diffed against the updated manifest.yaml — identical (modulo image tag), zero occurrences of the field.
  • CI guard exercised in both directions: fails when the field is present, passes when absent.
  • go build ./... and go vet ./... pass. No unit test files exist in the repo; the e2e path runs in the build workflow against a kind cluster, which now also applies the cleaned manifest.

How are existing users impacted? What migration steps/scripts do we need?

None. The field was a no-op — pruning behavior is unchanged. Users applying manifest.yaml directly or via GitOps (ArgoCD/Flux) will simply see the perpetual diff disappear on next sync. No data migration, no CRD version bump.

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)
  • read the CONTRIBUTION guide
  • signed-off my commits with git commit -s
  • added unit tests

Copilot AI linked an issue Oct 18, 2026 that may be closed by this pull request
Fixes #10. The spec.preserveUnknownFields field is deprecated in
apiextensions.k8s.io/v1 and omitted from stored objects when false,
causing ArgoCD to report a perpetual OutOfSync diff. Removing it is
behavior-neutral (pruning is the only supported mode in v1) and
controller-gen v0.13.0 (pinned in the Makefile) never emits it, so
removing it from the CRD source guarantees regenerated manifests stay
clean. A CI guard in the build workflow now fails if the field is ever
reintroduced into manifest.yaml.

Co-authored-by: fredleger <2778741+fredleger@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix argocd app sync issue with preserveUnknownFields Remove deprecated preserveUnknownFields from CRD manifests Oct 18, 2026
Copilot AI requested a review from fredleger October 18, 2026 20:02
Comment thread .github/workflows/build.yaml Resolved
@fredleger

Copy link
Copy Markdown

@copilot handle feedbacks

Per review on #11: the verification that controller-gen v0.13.0 never
re-emits spec.preserveUnknownFields is sufficient; no dedicated CI
check is needed. Reverts .github/workflows/build.yaml to its original
state. The actual fix (removing the deprecated field from the CRD
source and the generated manifest) is unchanged.

Co-authored-by: fredleger <2778741+fredleger@users.noreply.github.com>

Copilot AI commented Oct 18, 2026

Copy link
Copy Markdown
Author

@copilot handle feedbacks

All feedback is handled. The only review comment (removing the CI guard from .github/workflows/build.yaml) was addressed in 24ba2bc — that file now has zero net change against master. The PR diff is down to the two essential removals of the deprecated preserveUnknownFields: false line, in config/crd/bases/ops.alexellis.io_clusterpullsecrets.yaml and manifest.yaml. Ready for re-review.

Copilot AI requested a review from fredleger October 18, 2026 20:07
@fredleger
fredleger marked this pull request as ready for review October 18, 2026 20:10
@fredleger
fredleger merged commit 098fe67 into master Oct 18, 2026
2 checks passed
@fredleger
fredleger deleted the copilot/fix-argocd-sync-issue branch October 18, 2026 20:11
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.

can't sync with argocd

2 participants