Skip to content

Commit

Permalink
feat: Enable ignoreResourceUpdate by default argoproj#19992 (argoproj…
Browse files Browse the repository at this point in the history
…#20303)

Signed-off-by: jaehanbyun <awbrg789@naver.com>
Signed-off-by: Adrian Aneci <aneci@adobe.com>
  • Loading branch information
jaehanbyun authored and adriananeci committed Dec 4, 2024
1 parent ecf4277 commit e986e3a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/operator-manual/argocd-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ data:
- /spec/replicas
# Enable resource.customizations.ignoreResourceUpdates rules. If "false," those rules are not applied, and all updates
# to resources are applied to the cluster cache. Default is false.
resource.ignoreResourceUpdatesEnabled: "false"
# to resources are applied to the cluster cache. Default is true.
resource.ignoreResourceUpdatesEnabled: "true"

# Configuration to define customizations ignoring differences during watched resource updates to skip application reconciles.
resource.customizations.ignoreResourceUpdates.all: |
Expand Down
15 changes: 12 additions & 3 deletions docs/operator-manual/reconcile.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,21 @@ When a resource update is ignored, if the resource's [health status](./health.md

## System-Level Configuration

By default, `resource.ignoreResourceUpdatesEnabled` is set to `true`, enabling Argo CD to ignore resource updates. This default setting ensures that Argo CD maintains sustainable performance by reducing unnecessary reconcile operations. If you need to alter this behavior, you can explicitly set `resource.ignoreResourceUpdatesEnabled` to `false` in the `argocd-cm` ConfigMap:

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-cm
namespace: argocd
data:
resource.ignoreResourceUpdatesEnabled: "false"
```
Argo CD allows ignoring resource updates at a specific JSON path, using [RFC6902 JSON patches](https://tools.ietf.org/html/rfc6902) and [JQ path expressions](https://stedolan.github.io/jq/manual/#path(path_expression)). It can be configured for a specified group and kind
in `resource.customizations` key of the `argocd-cm` ConfigMap.

!!!important "Enabling the feature"
The feature is behind a flag. To enable it, set `resource.ignoreResourceUpdatesEnabled` to `"true"` in the `argocd-cm` ConfigMap.

Following is an example of a customization which ignores the `refreshTime` status field of an [`ExternalSecret`](https://external-secrets.io/main/api/externalsecret/) resource:

```yaml
Expand Down
2 changes: 1 addition & 1 deletion util/settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ func (mgr *SettingsManager) GetIsIgnoreResourceUpdatesEnabled() (bool, error) {
}

if argoCDCM.Data[resourceIgnoreResourceUpdatesEnabledKey] == "" {
return false, nil
return true, nil
}

return strconv.ParseBool(argoCDCM.Data[resourceIgnoreResourceUpdatesEnabledKey])
Expand Down
15 changes: 11 additions & 4 deletions util/settings/settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,23 @@ func TestGetServerRBACLogEnforceEnableKeyDefaultFalse(t *testing.T) {
}

func TestGetIsIgnoreResourceUpdatesEnabled(t *testing.T) {
_, settingsManager := fixtures(map[string]string{
_, settingsManager := fixtures(nil)
ignoreResourceUpdatesEnabled, err := settingsManager.GetIsIgnoreResourceUpdatesEnabled()
require.NoError(t, err)
assert.True(t, ignoreResourceUpdatesEnabled)

_, settingsManager = fixtures(map[string]string{
"resource.ignoreResourceUpdatesEnabled": "true",
})
ignoreResourceUpdatesEnabled, err := settingsManager.GetIsIgnoreResourceUpdatesEnabled()
ignoreResourceUpdatesEnabled, err = settingsManager.GetIsIgnoreResourceUpdatesEnabled()
require.NoError(t, err)
assert.True(t, ignoreResourceUpdatesEnabled)
}

func TestGetIsIgnoreResourceUpdatesEnabledDefaultFalse(t *testing.T) {
_, settingsManager := fixtures(nil)
func TestGetIsIgnoreResourceUpdatesEnabledFalse(t *testing.T) {
_, settingsManager := fixtures(map[string]string{
"resource.ignoreResourceUpdatesEnabled": "false",
})
ignoreResourceUpdatesEnabled, err := settingsManager.GetIsIgnoreResourceUpdatesEnabled()
require.NoError(t, err)
assert.False(t, ignoreResourceUpdatesEnabled)
Expand Down

0 comments on commit e986e3a

Please sign in to comment.