Class Fabric8Utils
java.lang.Object
org.springframework.cloud.kubernetes.fabric8.Fabric8Utils
Utility class related to Fabric8 Client. It resides in this module because it is
supposed to be re-used in fabric8 specific ones (like config or discovery)
- Author:
- wind57
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetApplicationNamespace(io.fabric8.kubernetes.client.KubernetesClient client, String namespace, String configurationTarget, org.springframework.cloud.kubernetes.commons.KubernetesNamespaceProvider provider) this method does the namespace resolution.static org.springframework.cloud.kubernetes.commons.discovery.ServiceMetadataserviceMetadata(io.fabric8.kubernetes.api.model.Service service)
-
Method Details
-
serviceMetadata
public static org.springframework.cloud.kubernetes.commons.discovery.ServiceMetadata serviceMetadata(io.fabric8.kubernetes.api.model.Service service) -
getApplicationNamespace
public static String getApplicationNamespace(io.fabric8.kubernetes.client.KubernetesClient client, @Nullable String namespace, String configurationTarget, org.springframework.cloud.kubernetes.commons.KubernetesNamespaceProvider provider) this method does the namespace resolution. Namespace is being searched according to the order below.1. from incoming namespace, which can be null. 2. from a property 'spring.cloud.kubernetes.client.namespace', if such is present. 3. from a String residing in a file denoted by `spring.cloud.kubernetes.client.serviceAccountNamespacePath` property, if such is present. 4. from a String residing in `/var/run/secrets/kubernetes.io/serviceaccount/namespace` file, if such is present (kubernetes default path) 5. from KubernetesClient::getNamespace, which is implementation specific.If any of the above fail, we throw aNamespaceResolutionFailedException.- Parameters:
namespace- normalized namespaceconfigurationTarget- Config Map/Secretprovider- the provider which computes the namespaceclient- fabric8 Kubernetes client- Returns:
- application namespace
- Throws:
org.springframework.cloud.kubernetes.commons.config.NamespaceResolutionFailedException- when namespace could not be resolved
-