Skip to content

Commit

Permalink
Don't panic when HashiCorp Vault path doesn't exist (kedacore#1867)
Browse files Browse the repository at this point in the history
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
Signed-off-by: nilayasiktoprak <nilayasiktoprak@gmail.com>
  • Loading branch information
zroubalik authored and nilayasiktoprak committed Oct 23, 2021
1 parent 5d3d198 commit b550036
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
### Improvements

- Fix READY and ACTIVE fields of ScaledJob to show status when we run `kubectl get sj` ([#1855](https://github.com/kedacore/keda/pull/1855))
- Don't panic when HashiCorp Vault path doesn't exist ([#1864](https://github.com/kedacore/keda/pull/1864))

### Breaking Changes

Expand Down
11 changes: 8 additions & 3 deletions pkg/scaling/resolver/scale_resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,15 @@ func ResolveAuthRef(client client.Client, logger logr.Logger, triggerAuthRef *ke
if err != nil {
logger.Error(err, "Error trying to read secret from Vault", "triggerAuthRef.Name", triggerAuthRef.Name,
"secret.path", e.Path)
continue
} else {
if secret == nil {
// sometimes there is no error, but `vault.Read(e.Path)` is not being able to parse the secret and returns nil
logger.Error(fmt.Errorf("unable to parse secret, is the provided path correct?"), "Error trying to read secret from Vault",
"triggerAuthRef.Name", triggerAuthRef.Name, "secret.path", e.Path)
} else {
result[e.Parameter] = resolveVaultSecret(logger, secret.Data, e.Key)
}
}

result[e.Parameter] = resolveVaultSecret(logger, secret.Data, e.Key)
}

vault.Stop()
Expand Down

0 comments on commit b550036

Please sign in to comment.