public class KubeConfigUtils
extends java.lang.Object
~/.kube/config
which is updated when you use commands
like osc login
and osc project myproject
Constructor and Description |
---|
KubeConfigUtils() |
Modifier and Type | Method and Description |
---|---|
static Cluster |
getCluster(Config config,
Context context)
Returns the current
Cluster for the current context |
static Context |
getCurrentContext(Config config)
Returns the current context in the given config
|
static AuthInfo |
getUserAuthInfo(Config config,
Context context)
Returns the current
AuthInfo for the current context and user |
static java.lang.String |
getUserToken(Config config,
Context context)
Returns the current user token for the config and current context
|
static Config |
parseConfig(java.io.File file) |
static Config |
parseConfigFromString(java.lang.String contents) |
public static Config parseConfig(java.io.File file) throws java.io.IOException
java.io.IOException
public static Config parseConfigFromString(java.lang.String contents) throws java.io.IOException
java.io.IOException
public static Context getCurrentContext(Config config)
config
- Config objectpublic static java.lang.String getUserToken(Config config, Context context)
config
- Config objectcontext
- Context objectpublic static AuthInfo getUserAuthInfo(Config config, Context context)
AuthInfo
for the current context and userconfig
- Config objectcontext
- Context objectAuthInfo
for current contextCopyright © 2015-2019 Red Hat. All Rights Reserved.