Skip to content

Commit

Permalink
Update deprecated vault api usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Fitzpatrick committed Dec 14, 2020
1 parent 215fdf2 commit 54db69a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions pkg/core/config/sources/vault/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ func (v *vaultConfigSource) initTokenRenewalIfNeeded() error {

authSec.Auth.ClientToken = v.client.Token()

renewer, err := v.client.NewRenewer(&api.RenewerInput{
Secret: authSec,
renewer, err := v.client.NewLifetimeWatcher(&api.LifetimeWatcherInput{
Secret: authSec,
RenewBehavior: api.RenewBehaviorErrorOnErrors,
})
if err != nil {
return err
Expand Down
11 changes: 6 additions & 5 deletions pkg/core/config/sources/vault/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ type vaultConfigSource struct {
client *api.Client
// Secrets that have been read from Vault
secretsByVaultPath map[string]*api.Secret
renewersByVaultPath map[string]*api.Renewer
renewersByVaultPath map[string]*api.LifetimeWatcher
customWatchersByVaultPath map[string]customWatcher
nonRenewableVaultPathRefetchTimes map[string]time.Time
// Used for unit testing
nowProvider func() time.Time
conf *Config
tokenRenewer *api.Renewer
tokenRenewer *api.LifetimeWatcher
logger logrus.FieldLogger
}

Expand Down Expand Up @@ -138,7 +138,7 @@ func New(conf *Config) (types.ConfigSource, error) {
vcs := &vaultConfigSource{
client: c,
secretsByVaultPath: make(map[string]*api.Secret),
renewersByVaultPath: make(map[string]*api.Renewer),
renewersByVaultPath: make(map[string]*api.LifetimeWatcher),
customWatchersByVaultPath: make(map[string]customWatcher),
nonRenewableVaultPathRefetchTimes: make(map[string]time.Time),
nowProvider: time.Now,
Expand Down Expand Up @@ -182,8 +182,9 @@ func (v *vaultConfigSource) Get(path string) (map[string][]byte, uint64, error)

switch {
case secret.Renewable:
renewer, err := v.client.NewRenewer(&api.RenewerInput{
Secret: secret,
renewer, err := v.client.NewLifetimeWatcher(&api.LifetimeWatcherInput{
Secret: secret,
RenewBehavior: api.RenewBehaviorErrorOnErrors,
})
if err == nil {
v.logger.Debugf("Setting up Vault renewer for secret at path %s", vaultPath)
Expand Down

0 comments on commit 54db69a

Please sign in to comment.