Describe the bug
When using the local cluster config for the backend configuration, the plugin fails to reload the token once it expires.
To Reproduce
Steps to reproduce the behavior:
- Create a Kubernetes Secrets Backend without the
service_account_jwt
- Create a role for the Kubernetes Secrets Engine on this backend
- Generate a credentials for the role - it will work
- Wait until the
/var/run/secrets/kubernetes.io/serviceaccount/token expires
- Generate a credentials for the role - it will not work
Expected behavior
The Kubernetes Secrets Backend will reload the /var/run/secrets/kubernetes.io/serviceaccount/token every minute
The issue is in the backend caching that will not reload the client see path_creds.go
The code should changed from
if client != nil {
return client, nil
}
to:
if client != nil && !b.isNeedReload(ctx, s) {
return client, nil
}
where isNeedReload check if we need to reload the /var/run/secrets/kubernetes.io/serviceaccount/token
Describe the bug
When using the local cluster config for the backend configuration, the plugin fails to reload the token once it expires.
To Reproduce
Steps to reproduce the behavior:
service_account_jwt/var/run/secrets/kubernetes.io/serviceaccount/tokenexpiresExpected behavior
The Kubernetes Secrets Backend will reload the
/var/run/secrets/kubernetes.io/serviceaccount/tokenevery minuteThe issue is in the backend caching that will not reload the client see path_creds.go
The code should changed from
to:
where
isNeedReloadcheck if we need to reload the/var/run/secrets/kubernetes.io/serviceaccount/token