diff --git a/pkg/collect/secret.go b/pkg/collect/secret.go index 1f33a2f5..931da8e4 100644 --- a/pkg/collect/secret.go +++ b/pkg/collect/secret.go @@ -71,7 +71,9 @@ func secret(ctx context.Context, client *kubernetes.Clientset, secretCollector * keyExists := false keyData := "" + secretKey := "" if secretCollector.Key != "" { + secretKey = secretCollector.Key if val, ok := found.Data[secretCollector.Key]; ok { keyExists = true if secretCollector.IncludeValue { @@ -83,7 +85,7 @@ func secret(ctx context.Context, client *kubernetes.Clientset, secretCollector * secret := FoundSecret{ Namespace: found.Namespace, Name: found.Name, - Key: secretCollector.Key, + Key: secretKey, SecretExists: true, KeyExists: keyExists, Value: keyData,