Skip to content

Kubernetes Secrets Backend fails to reload /var/run/secrets/kubernetes.io/serviceaccount/token #103

@jd-hatzenbuhler

Description

@jd-hatzenbuhler

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions