mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-05 10:20:36 +02:00
set kube/vault refresh interval, fixes #2463
This commit is contained in:
parent
4063d29b44
commit
4f5c53f9ee
@ -5,6 +5,7 @@
|
|||||||
package vault
|
package vault
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -78,6 +79,9 @@ func New(store model.ConfigStore, opts ...Opts) (secrets.Plugin, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *vault) initKubernetes() error {
|
func (v *vault) initKubernetes() error {
|
||||||
|
if v.renew == 0 {
|
||||||
|
return errors.New("vault: token renewal not configured")
|
||||||
|
}
|
||||||
token, ttl, err := getKubernetesToken(
|
token, ttl, err := getKubernetesToken(
|
||||||
v.kubeAuth.addr,
|
v.kubeAuth.addr,
|
||||||
v.kubeAuth.role,
|
v.kubeAuth.role,
|
||||||
@ -91,7 +95,6 @@ func (v *vault) initKubernetes() error {
|
|||||||
|
|
||||||
v.client.SetToken(token)
|
v.client.SetToken(token)
|
||||||
v.ttl = ttl
|
v.ttl = ttl
|
||||||
v.renew = ttl / 2
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user