NetApp / trident

Storage orchestrator for containers
Apache License 2.0
762 stars 222 forks source link

"Username is specified in both config and secret ..." message is incorrectly logged #755

Closed tksm closed 2 years ago

tksm commented 2 years ago

Describe the bug

"Username is specified in both config and secret ..." and similar warning messages are incorrectly logged after updating Trident v22.07.0.

time="2022-08-01T01:42:13Z" level=warning msg="clientPrivateKey is specified in both config and secret; overriding from secret."
time="2022-08-01T01:42:13Z" level=warning msg="Username is specified in both config and secret; overriding from secret."
time="2022-08-01T01:42:13Z" level=warning msg="Password is specified in both config and secret; overriding from secret."

It seems that this behavior is introduced in https://github.com/NetApp/trident/commit/655e707d26e047df7809740f05f1f984bb36cb1f. Apparently, this commit assumes ClientPrivateKey, Username, and Password in OntapStorageDriverConfig are empty if the backend secret is used. But these fields have values like secret:tbe-3282edab-7edf-46ef-b57d-eb134fa5bbd0 if we use the backend secret, so these warning messages are always logged.

Environment

To Reproduce

  1. Make an ontap-san backend on Trident v22.07.0.
tridentctl create backend -f- << EOL
{
  "version": 1,
  "storageDriverName": "ontap-san",
  "backendName": "ontapsan",
  "managementLIF": "${MANAGEMENT_LIF}",
  "svm": "${SVM}",
  "username": "${SVM_USER}",
  "password": "${SVM_PASSWORD}",
  "igroupName": "${IGROUP_NAME}",
  "storagePrefix": "${STORAGE_PREFIX}",
}
  1. Restart the trident controller plugin.
kubectl rollout restart -n trident deployment trident-csi
  1. The warning messages will be incorrectly reported.
kubectl logs -n trident deploy/trident-csi trident-main | grep "is specified in both"
time="2022-08-08T07:24:37Z" level=warning msg="Username is specified in both config and secret; overriding from secret."
time="2022-08-08T07:24:37Z" level=warning msg="Password is specified in both config and secret; overriding from secret."

Expected behavior

Trident should not log these warning messages when we only use the backend secret.

gnarl commented 2 years ago

This issue is fixed with commit 9b78a23 and will be included in the Trident 22.10 release.