diff --git a/controllers/configurationpolicy_controller.go b/controllers/configurationpolicy_controller.go index dcc51a73..2abd635b 100644 --- a/controllers/configurationpolicy_controller.go +++ b/controllers/configurationpolicy_controller.go @@ -2410,9 +2410,7 @@ func handleSingleKey( } if key == "stringData" && existingObj.GetKind() == "Secret" { - // override automatic conversion from stringData to data prior to evaluation - existingValue = existingObj.UnstructuredContent()["data"] - + // override automatic conversion from stringData to data before evaluation encodedValue, _, err := unstructured.NestedStringMap(existingObj.Object, "data") if err != nil { message := "Error accessing encoded data" @@ -2420,6 +2418,8 @@ func handleSingleKey( return message, false, mergedValue, false } + existingValue = make(map[string]interface{}, len(encodedValue)) + for k, value := range encodedValue { decodedVal, err := base64.StdEncoding.DecodeString(value) if err != nil {