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/configwhich is updated when you use commands likeosc loginandosc project myproject
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static StringfindExecutable(String command, String pathValue)protected static List<String>getAuthenticatorCommandFromExecConfig(ExecConfig exec, File configFile, String systemPathValue)protected static Config.ExecCredentialgetExecCredentialFromExecConfig(ExecConfig exec, File configFile)static FilegetFileWithNamedAuthInfo(NamedContext namedContext)Returns the file containing the auth info information if it was loaded using KubeConfigUtils#parseConfig.static FilegetFileWithNamedCluster(NamedContext namedContext)Returns the file containing the cluster information if it was loaded using KubeConfigUtils#parseConfig.static FilegetFileWithNamedContext(NamedContext namedContext)Returns the file containing the context information if it was loaded using KubeConfigUtils#parseConfig.static voidmerge(Config clientConfig, String context, Config... kubeconfigs)static ConfigparseConfig(File kubeconfig)static ConfigparseConfigFromString(String contents)static voidpersistKubeConfigIntoFile(Config kubeconfig, File kubeConfigPath)Persist KUBECONFIG file from the providedConfigobject.
-
-
-
Method Detail
-
persistKubeConfigIntoFile
public static void persistKubeConfigIntoFile(Config kubeconfig, File kubeConfigPath) throws IOException
Persist KUBECONFIG file from the providedConfigobject.- Parameters:
kubeconfig- modifiedConfigobject.kubeConfigPath- path to KUBECONFIG.- Throws:
IOException- in case of failure while writing to file.
-
getFileWithNamedContext
public static File getFileWithNamedContext(NamedContext namedContext)
Returns the file containing the context information if it was loaded using KubeConfigUtils#parseConfig.- Parameters:
namedContext- the context to get the file from.- Returns:
- the file containing the context information if it was loaded using KubeConfigUtils#parseConfig or null.
-
getFileWithNamedCluster
public static File getFileWithNamedCluster(NamedContext namedContext)
Returns the file containing the cluster information if it was loaded using KubeConfigUtils#parseConfig.- Parameters:
namedContext- the context to get the file from.- Returns:
- the file containing the cluster information if it was loaded using KubeConfigUtils#parseConfig or null.
-
getFileWithNamedAuthInfo
public static File getFileWithNamedAuthInfo(NamedContext namedContext)
Returns the file containing the auth info information if it was loaded using KubeConfigUtils#parseConfig.- Parameters:
namedContext- the context to get the file from.- Returns:
- the file containing the auth info information if it was loaded using KubeConfigUtils#parseConfig or null.
-
getExecCredentialFromExecConfig
protected static Config.ExecCredential getExecCredentialFromExecConfig(ExecConfig exec, File configFile)
-
getAuthenticatorCommandFromExecConfig
protected static List<String> getAuthenticatorCommandFromExecConfig(ExecConfig exec, File configFile, String systemPathValue)
-
-