Class KubernetesNamedSecretProvider
- All Implemented Interfaces:
ISecretProvider
Unlike KubernetesCredentialFactory, which maps one Kubernetes secret to one alias,
this provider expects each configured secret to hold credentials for multiple aliases
using a dot-prefixed key convention. For example, a secret containing the keys
myalias.username and myalias.password exposes the alias myalias
with fields username and password.
The names of the Kubernetes secrets to read from must be specified via the property "credentialFactory.kubernetes.secretNames" as a comma-separated list. Secrets are searched in order; the first secret that contains any key with the requested alias prefix is used.
Both individual secrets and the full alias discovery result are cached for 60000 ms to limit calls to the Kubernetes API.
The credentials are cached for 60 seconds to prevent unnecessary calls to the Kubernetes API.
-
Field Summary
Fields inherited from class AbstractKubernetesCredentialProvider
client, DEFAULT_NAMESPACE, namespace -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn a list of all configured aliases, should provide an empty list if none can be provided.getSecret(@NonNull CredentialAlias alias) protected voidpostInitialize(CredentialConstants appConstants) protected @Nullable io.fabric8.kubernetes.api.model.SecretreadSecretByName(String secretName) Methods inherited from class AbstractKubernetesCredentialProvider
close, hasSecret, initialize, isAliasNameValid, warnIfAliasNameInvalid
-
Constructor Details
-
KubernetesNamedSecretProvider
public KubernetesNamedSecretProvider()
-
-
Method Details
-
postInitialize
- Specified by:
postInitializein classAbstractKubernetesCredentialProvider
-
getSecret
- Throws:
NoSuchElementException
-
getConfiguredAliases
Description copied from interface:ISecretProviderReturn a list of all configured aliases, should provide an empty list if none can be provided. -
readSecretByName
-