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.ClustergetCluster(io.fabric8.kubernetes.api.model.Config config, io.fabric8.kubernetes.api.model.Context context)Returns the currentClusterfor the current contextstatic io.fabric8.kubernetes.api.model.NamedContextgetCurrentContext(io.fabric8.kubernetes.api.model.Config config)Returns the current context in the given configstatic io.fabric8.kubernetes.api.model.AuthInfogetUserAuthInfo(io.fabric8.kubernetes.api.model.Config config, io.fabric8.kubernetes.api.model.Context context)Returns the currentAuthInfofor the current context and userstatic StringgetUserToken(io.fabric8.kubernetes.api.model.Config config, io.fabric8.kubernetes.api.model.Context context)Returns the current user token for the config and current contextstatic io.fabric8.kubernetes.api.model.ConfigparseConfig(File file)static io.fabric8.kubernetes.api.model.ConfigparseConfigFromString(String contents)
-
Constructor Details
-
KubeConfigUtils
public KubeConfigUtils()
-
-
Method Details
-
parseConfig
- 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 objectcontext- 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 currentAuthInfofor the current context and user- Parameters:
config- Config objectcontext- Context object- Returns:
AuthInfofor 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 currentClusterfor the current context- Parameters:
config-Configconfig objectcontext-Contextcontext object- Returns:
- current
Clusterfor current context
-