Skip to content

Change Failed to apply normalization warning #14148

@jsoref

Description

@jsoref

Summary

There's a debug message Failed to apply normalization which is unhelpful and confusing

Motivation

#2933, #8113, #11088

I'm running a debug v2.8-ish build w/ debug logging enabled and I get a lot of:

Failed to apply normalization: error in remove for path: '/status': Unable to remove nonexistent key: status: missing value
Failed to apply normalization: error in remove for path: '/spec/preserveUnknownFields': Unable to remove nonexistent key: preserveUnknownFields: missing value

Proposal

The message should provide enough information to be actionable.

  1. If it's purely informational, it shouldn't say Failed, that's too scary.
  2. It should hint at where the thing came from and why it was trying to remove something.

Offhand this appears to be from:
https://github.com/argoproj/argo-cd/blob/4ca903bf38e06407a7c139e6f7c1abb6c7ef8ad7/util/settings/settings.go#LL848C1-L849C1

crdGK := "apiextensions.k8s.io/CustomResourceDefinition"
crdPrsvUnkn := "/spec/preserveUnknownFields"
switch diffOptions.IgnoreResourceStatusField {
case "", "crd":
addStatusOverrideToGK(resourceOverrides, crdGK)
addIgnoreDiffItemOverrideToGK(resourceOverrides, crdGK, crdPrsvUnkn)

And reported here:

log.Debugf("Failed to apply normalization: %v", err)

Since this is apparently a very expected thing because it's forced by the code as-is, it shouldn't present itself as it does.

I have no idea what it's doing, since apparently it's trying to remove /status from something but it doesn't tell me what the something it's operating on -- generally speaking that's an important detail.

Effectively, some portion of docData needs to be provided in the warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions