Skip to content

Commit

Permalink
feat: ignore status globally
Browse files Browse the repository at this point in the history
Signed-off-by: darshanime <deathbullet@gmail.com>
  • Loading branch information
darshanime committed Jun 12, 2020
1 parent d63ced4 commit a2b1235
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/argocd-util/commands/settings_test.go
Expand Up @@ -195,7 +195,7 @@ admissionregistration.k8s.io/MutatingWebhookConfiguration:
jsonPointers:
- /webhooks/0/clientConfig/caBundle`,
},
containsSummary: "1 resource overrides",
containsSummary: "2 resource overrides",
},
}
for name := range testCases {
Expand Down
8 changes: 7 additions & 1 deletion util/argo/normalizers/diff_normalizer.go
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/argoproj/gitops-engine/pkg/diff"
jsonpatch "github.com/evanphx/json-patch"
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"
yaml "gopkg.in/yaml.v2"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"

Expand Down Expand Up @@ -76,7 +76,13 @@ func NewIgnoreNormalizer(ignore []v1alpha1.ResourceIgnoreDifferences, overrides
func (n *ignoreNormalizer) Normalize(un *unstructured.Unstructured) error {
matched := make([]normalizerPatch, 0)
for _, patch := range n.patches {
if patch.groupKind.Group == "" && patch.groupKind.Kind == "" {
matched = append(matched, patch)
continue
}

groupKind := un.GroupVersionKind().GroupKind()

if groupKind == patch.groupKind &&
(patch.name == "" || patch.name == un.GetName()) &&
(patch.namespace == "" || patch.namespace == un.GetNamespace()) {
Expand Down
2 changes: 1 addition & 1 deletion util/settings/settings.go
Expand Up @@ -447,7 +447,7 @@ func (mgr *SettingsManager) GetResourceOverrides() (map[string]v1alpha1.Resource
return nil, err
}
}

resourceOverrides["/"] = v1alpha1.ResourceOverride{IgnoreDifferences: "jsonPointers:\n- /status"}
return resourceOverrides, nil
}

Expand Down

0 comments on commit a2b1235

Please sign in to comment.