@@ -945,17 +945,20 @@ func getLiveManifestFields_WithIgnoredFields(ignoredFields []string, userProvide
945945 // this implicitly excludes anything that the user didn't provide as it was added by kubernetes runtime (annotations/mutations etc)
946946 userKeys := []string {}
947947 for userKey , userValue := range flattenedUser {
948+ normalizedUserValue := strings .TrimSpace (userValue )
949+
948950 // only include the value if it exists in the live version
949951 // that is, don't add to the userKeys array unless the key still exists in the live manifest
950952 if _ , exists := flattenedLive [userKey ]; exists {
951953 userKeys = append (userKeys , userKey )
952- flattenedUser [userKey ] = strings .TrimSpace (flattenedLive [userKey ])
953- if strings .TrimSpace (userValue ) != flattenedUser [userKey ] {
954- log .Printf ("[TRACE] yaml drift detected in %s for %s, was:\n %s now:\n %s" , selfLink , userKey , userValue , flattenedLive [userKey ])
954+ normalizedLiveValue := strings .TrimSpace (flattenedLive [userKey ])
955+ flattenedUser [userKey ] = normalizedLiveValue
956+ if normalizedUserValue != normalizedLiveValue {
957+ log .Printf ("[TRACE] yaml drift detected in %s for %s, was: %s now: %s" , selfLink , userKey , normalizedUserValue , normalizedLiveValue )
955958 }
956959 } else {
957- if strings . TrimSpace ( userValue ) != "" {
958- log .Printf ("[TRACE] yaml drift detected in %s for %s, was %s now blank" , selfLink , userKey , userValue )
960+ if normalizedUserValue != "" {
961+ log .Printf ("[TRACE] yaml drift detected in %s for %s, was %s now blank" , selfLink , userKey , normalizedUserValue )
959962 }
960963 }
961964 }
0 commit comments