Class KubernetesClientUtils

java.lang.Object
org.springframework.cloud.kubernetes.client.KubernetesClientUtils

public final class KubernetesClientUtils extends Object
Author:
Ryan Baxter
  • Method Details

    • createApiClientForInformerClient

      public static io.kubernetes.client.openapi.ApiClient createApiClientForInformerClient()
    • kubernetesApiClient

      public static io.kubernetes.client.openapi.ApiClient kubernetesApiClient()
    • getApplicationNamespace

      public static String getApplicationNamespace(String namespace, String configurationTarget, org.springframework.cloud.kubernetes.commons.KubernetesNamespaceProvider provider)
      this method does the namespace resolution for both config map and secrets implementations. It tries these places to find the namespace:
          1. from a normalized source (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)
      
      If any of the above fail, we throw a NamespaceResolutionFailedException.
      Parameters:
      namespace - normalized namespace
      configurationTarget - Config Map/Secret
      provider - the provider which computes the namespace
      Returns:
      application namespace
      Throws:
      org.springframework.cloud.kubernetes.commons.config.NamespaceResolutionFailedException - when namespace could not be resolved