Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions docs/operator-manual/upgrading/2.14-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ Example of a status field in the Application CR persisting health:
status:
health:
status: Healthy
lastTransitionTime: "2025-01-01T00:00:00Z"
lastTransitionTime: '2025-01-01T00:00:00Z'
resources:
- group: apps
health:
Expand All @@ -339,7 +339,7 @@ Example of a status field in the Application CR _not_ persisting health:
status:
health:
status: Healthy
lastTransitionTime: "2025-01-01T00:00:00Z"
lastTransitionTime: '2025-01-01T00:00:00Z'
resourceHealthSource: appTree
resources:
- group: apps
Expand Down Expand Up @@ -437,4 +437,30 @@ data:
ignoreResourceStatusField: crd
```

### Removing default ignores of `preserveUnknownFields` for CRD

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

This means that CRD deployed with Argo CD containing `spec.preserveUnknownFields: false` will be out of sync. To address this problem,
the `preserveUnknownFields` field can be removed from the CRD spec.

Until this is completed, if you want your Application not to be out of sync, you can add the following configuration to the Application manifest.

```yaml
spec:
ignoreDifferences:
- group: apiextensions.k8s.io
kind: CustomResourceDefinition
jsonPointers:
- /spec/preserveUnknownFields
```

You can also configure it globally in the `argocd-cm` ConfigMap.

```yaml
resource.customizations.ignoreDifferences.apiextensions.k8s.io_CustomResourceDefinition: |
jsonPointers:
- /spec/preserveUnknownFields
```

More details for ignored resource updates in the [Diffing customization](../../user-guide/diffing.md) documentation.
2 changes: 0 additions & 2 deletions util/settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -987,15 +987,13 @@ func (mgr *SettingsManager) GetResourceOverrides() (map[string]v1alpha1.Resource
}

crdGK := "apiextensions.k8s.io/CustomResourceDefinition"
crdPrsvUnkn := "/spec/preserveUnknownFields"

switch diffOptions.IgnoreResourceStatusField {
case "", IgnoreResourceStatusInAll:
addStatusOverrideToGK(resourceOverrides, "*/*")
log.Info("Ignore status for all objects")
case IgnoreResourceStatusInCRD:
addStatusOverrideToGK(resourceOverrides, crdGK)
addIgnoreDiffItemOverrideToGK(resourceOverrides, crdGK, crdPrsvUnkn)
case IgnoreResourceStatusInNone, "off", "false":
// Yaml 'off' non-string value can be converted to 'false'
// Support these cases because compareoptions is a yaml string in the config
Expand Down
2 changes: 1 addition & 1 deletion util/settings/settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ func TestGetResourceOverrides(t *testing.T) {
crdOverrides := overrides[crdGK]
assert.NotNil(t, crdOverrides)
assert.Equal(t, v1alpha1.ResourceOverride{IgnoreDifferences: v1alpha1.OverrideIgnoreDiff{
JSONPointers: []string{"/webhooks/0/clientConfig/caBundle", "/status", "/spec/preserveUnknownFields"},
JSONPointers: []string{"/webhooks/0/clientConfig/caBundle", "/status"},
JQPathExpressions: []string{".webhooks[0].clientConfig.caBundle"},
}}, crdOverrides)

Expand Down
Loading