Class KubeConfigUtils

java.lang.Object
io.fabric8.kubernetes.client.internal.KubeConfigUtils

public class KubeConfigUtils
extends Object
Helper class for working with the YAML config file thats located in ~/.kube/config which is updated when you use commands like osc login and osc project myproject
  • Constructor Summary

    Constructors 
    Constructor Description
    KubeConfigUtils()  
  • Method Summary

    Modifier and Type Method Description
    static io.fabric8.kubernetes.api.model.Cluster getCluster​(io.fabric8.kubernetes.api.model.Config config, io.fabric8.kubernetes.api.model.Context context)
    Returns the current Cluster for the current context
    static io.fabric8.kubernetes.api.model.NamedContext getCurrentContext​(io.fabric8.kubernetes.api.model.Config config)
    Returns the current context in the given config
    static io.fabric8.kubernetes.api.model.AuthInfo getUserAuthInfo​(io.fabric8.kubernetes.api.model.Config config, io.fabric8.kubernetes.api.model.Context context)
    Returns the current AuthInfo for the current context and user
    static String getUserToken​(io.fabric8.kubernetes.api.model.Config config, io.fabric8.kubernetes.api.model.Context context)
    Returns the current user token for the config and current context
    static io.fabric8.kubernetes.api.model.Config parseConfig​(File file)  
    static io.fabric8.kubernetes.api.model.Config parseConfigFromString​(String contents)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • parseConfig

      public static io.fabric8.kubernetes.api.model.Config parseConfig​(File file) throws IOException
      Throws:
      IOException
    • parseConfigFromString

      public static io.fabric8.kubernetes.api.model.Config parseConfigFromString​(String contents) throws IOException
      Throws:
      IOException
    • getCurrentContext

      public static io.fabric8.kubernetes.api.model.NamedContext getCurrentContext​(io.fabric8.kubernetes.api.model.Config config)
      Returns the current context in the given config
      Parameters:
      config - Config object
      Returns:
      returns context in config if found, otherwise null
    • getUserToken

      public static String getUserToken​(io.fabric8.kubernetes.api.model.Config config, io.fabric8.kubernetes.api.model.Context context)
      Returns the current user token for the config and current context
      Parameters:
      config - Config object
      context - Context object
      Returns:
      returns current user based upon provided parameters.
    • getUserAuthInfo

      public static io.fabric8.kubernetes.api.model.AuthInfo getUserAuthInfo​(io.fabric8.kubernetes.api.model.Config config, io.fabric8.kubernetes.api.model.Context context)
      Returns the current AuthInfo for the current context and user
      Parameters:
      config - Config object
      context - Context object
      Returns:
      AuthInfo for current context
    • getCluster

      public static io.fabric8.kubernetes.api.model.Cluster getCluster​(io.fabric8.kubernetes.api.model.Config config, io.fabric8.kubernetes.api.model.Context context)
      Returns the current Cluster for the current context
      Parameters:
      config - Config config object
      context - Context context object
      Returns:
      current Cluster for current context