Class ConfigHelper
java.lang.Object
com.redhat.devtools.intellij.common.utils.ConfigHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanareEqual(io.fabric8.kubernetes.api.model.Config thisConfig, io.fabric8.kubernetes.api.model.Config thatConfig) Returnstrueif the givenConfigand (client runtime)Configare equal.static booleanareEqual(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.client.Config clientConfig) Returnstrueif the givenConfigand (client runtime)Configare equal.static booleanareEqual(io.fabric8.kubernetes.api.model.NamedContext thisContext, io.fabric8.kubernetes.api.model.NamedContext thatContext) Returnstrueif both given contexts are equal.static booleanareEqual(Collection<io.fabric8.kubernetes.api.model.NamedContext> these, Collection<io.fabric8.kubernetes.api.model.NamedContext> those) static booleanareEqualCurrentContext(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.api.model.Config newKubeConfig) Returnstrueif the givenConfigand the newConfigare equal.static booleanareEqualToken(io.fabric8.kubernetes.api.model.AuthInfo authInfo, io.fabric8.kubernetes.api.model.AuthInfo newAuthInfo) Returnstrueif the token in the givenAuthInfo(that's retrieved from the kube config file) and the newAuthInfo(that's retrieved from the new kube config file) are equal.static booleanareEqualToken(io.fabric8.kubernetes.api.model.AuthInfo authInfo, io.fabric8.kubernetes.client.Config clientConfig) Returnstrueif the token in the givenAuthInfo(that's retrieved from the kube config file) andConfig(that's contains the runtime settings that the kubernetes-client is using) are equal.static booleanareEqualToken(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.api.model.Config newKubeConfig) Returnstrueif the token in the given (kubernetes file)Configand the one in the new Kubernetes fileConfigare equal.static booleanareEqualToken(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.client.Config clientConfig) Returnstrueif the token in the given (kubernetes file)Configand (client runtime)Configare equal.static io.fabric8.kubernetes.api.model.NamedContextstatic io.fabric8.kubernetes.api.model.NamedContextgetCurrentContext(io.fabric8.kubernetes.api.model.Config config) static Stringstatic StringgetCurrentContextName(io.fabric8.kubernetes.api.model.Config config) static Stringstatic booleanstatic booleanisKubeConfigParsable(File kubeConfig) static io.fabric8.kubernetes.api.model.Configstatic io.fabric8.kubernetes.api.model.ConfigloadKubeConfig(String path) static ToolsConfigstatic ToolsConfigloadToolsConfig(URL url) static io.fabric8.kubernetes.api.model.Configstatic voidsaveKubeConfig(io.fabric8.kubernetes.api.model.Config config)
-
Constructor Details
-
ConfigHelper
public ConfigHelper()
-
-
Method Details
-
getKubeConfigPath
-
saveKubeConfig
- Throws:
IOException
-
safeLoadKubeConfig
public static io.fabric8.kubernetes.api.model.Config safeLoadKubeConfig() -
loadKubeConfig
- Throws:
IOException
-
loadKubeConfig
- Throws:
IOException
-
isKubeConfigParsable
public static boolean isKubeConfigParsable() -
isKubeConfigParsable
-
loadToolsConfig
- Throws:
IOException
-
loadToolsConfig
- Throws:
IOException
-
getCurrentContext
public static io.fabric8.kubernetes.api.model.NamedContext getCurrentContext() -
getCurrentContext
public static io.fabric8.kubernetes.api.model.NamedContext getCurrentContext(io.fabric8.kubernetes.api.model.Config config) -
getCurrentContextName
-
getCurrentContextName
-
areEqualCurrentContext
public static boolean areEqualCurrentContext(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.api.model.Config newKubeConfig) Returnstrueif the givenConfigand the newConfigare equal. They are considered equal if they're equal in- current context (cluster, user, current namespace, extensions)
- (authentication) token
- Parameters:
kubeConfig- the (file) config to comparenewKubeConfig- the (client, runtime) config to compare- Returns:
- true if both configs are equal in context, contexts and token
-
areEqual
public static boolean areEqual(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.client.Config clientConfig) Returnstrueif the givenConfigand (client runtime)Configare equal. They are considered equal if they're equal in- current context (cluster, user, current namespace, extensions)
- (existing) contexts
- (authentication) token
- Parameters:
kubeConfig- the (file) config to compareclientConfig- the (client, runtime) config to compare- Returns:
- true if both configs are equal in context, contexts and token
-
areEqual
public static boolean areEqual(io.fabric8.kubernetes.api.model.Config thisConfig, io.fabric8.kubernetes.api.model.Config thatConfig) Returnstrueif the givenConfigand (client runtime)Configare equal. They are considered equal if they're equal in- current context (cluster, user, current namespace, extensions)
- (existing) contexts
- (authentication) token
- Parameters:
thisConfig- the first (file) config to comparethatConfig- the second (file) config to compare- Returns:
- true if both configs are equal in context, contexts and token
-
areEqual
public static boolean areEqual(io.fabric8.kubernetes.api.model.NamedContext thisContext, io.fabric8.kubernetes.api.model.NamedContext thatContext) Returnstrueif both given contexts are equal. They are considered equal if they're equal in- cluster
- user
- current namespace
- extensions
- Parameters:
thisContext- the first context to comparethatContext- the second context to compare- Returns:
- true if both contexts are equal
- See Also:
-
NamedContextContext
-
areEqual
public static boolean areEqual(Collection<io.fabric8.kubernetes.api.model.NamedContext> these, Collection<io.fabric8.kubernetes.api.model.NamedContext> those) -
areEqualToken
public static boolean areEqualToken(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.client.Config clientConfig) Returnstrueif the token in the given (kubernetes file)Configand (client runtime)Configare equal. Returnsfalseotherwise.- Parameters:
kubeConfig- the (kube config) auth info that contains the tokenclientConfig- the (client) config that contains the token- Returns:
- true if both tokens are equal, false otherwise
-
areEqualToken
public static boolean areEqualToken(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.api.model.Config newKubeConfig) Returnstrueif the token in the given (kubernetes file)Configand the one in the new Kubernetes fileConfigare equal. Returnsfalseotherwise.- Parameters:
kubeConfig- the (kube config) auth info that contains the tokennewKubeConfig- the (client) config that contains the token- Returns:
- true if both tokens are equal, false otherwise
-
areEqualToken
public static boolean areEqualToken(io.fabric8.kubernetes.api.model.AuthInfo authInfo, io.fabric8.kubernetes.client.Config clientConfig) Returnstrueif the token in the givenAuthInfo(that's retrieved from the kube config file) andConfig(that's contains the runtime settings that the kubernetes-client is using) are equal. Returnsfalseotherwise.- Parameters:
authInfo- the (kube config) auth info that contains the tokenclientConfig- the (client) config that contains the token- Returns:
- true if both tokens are equal, false otherwise
-
areEqualToken
public static boolean areEqualToken(io.fabric8.kubernetes.api.model.AuthInfo authInfo, io.fabric8.kubernetes.api.model.AuthInfo newAuthInfo) Returnstrueif the token in the givenAuthInfo(that's retrieved from the kube config file) and the newAuthInfo(that's retrieved from the new kube config file) are equal. Returnsfalseotherwise.- Parameters:
authInfo- the (kube config) auth info that contains the tokennewAuthInfo- the new (kube config) auth that contains the token- Returns:
- true if both tokens are equal, false otherwise
-