Class ConfigHelper


  • public class ConfigHelper
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean areEqual​(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.client.Config clientConfig)
      Returns true if the given Config and (client runtime) Config are equal.
      static boolean areEqual​(io.fabric8.kubernetes.api.model.NamedContext thisContext, io.fabric8.kubernetes.api.model.NamedContext thatContext)
      Returns true if both given contexts are equal.
      static boolean areEqual​(java.util.Collection<io.fabric8.kubernetes.api.model.NamedContext> these, java.util.Collection<io.fabric8.kubernetes.api.model.NamedContext> those)  
      static boolean areEqualToken​(io.fabric8.kubernetes.api.model.AuthInfo authInfo, io.fabric8.kubernetes.client.Config clientConfig)
      Returns true if the token in the given AuthInfo (that's retrieved from the kube config file) and Config (that's contains the runtime settings that the kubernetes-client is using) are equal.
      static boolean areEqualToken​(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.client.Config clientConfig)
      Returns true if the token in the given (kubernetes file) Config and (client runtime) Config are equal.
      static io.fabric8.kubernetes.api.model.NamedContext getCurrentContext()  
      static java.lang.String getKubeConfigPath()  
      static boolean isKubeConfigParsable()  
      static boolean isKubeConfigParsable​(java.io.File kubeConfig)  
      static io.fabric8.kubernetes.api.model.Config loadKubeConfig()  
      static io.fabric8.kubernetes.api.model.Config loadKubeConfig​(java.lang.String path)  
      static ToolsConfig loadToolsConfig()  
      static ToolsConfig loadToolsConfig​(java.net.URL url)  
      static io.fabric8.kubernetes.api.model.Config safeLoadKubeConfig()  
      static void saveKubeConfig​(io.fabric8.kubernetes.api.model.Config config)  
      • Methods inherited from class java.lang.Object

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

      • ConfigHelper

        public ConfigHelper()
    • Method Detail

      • getKubeConfigPath

        public static java.lang.String getKubeConfigPath()
      • saveKubeConfig

        public static void saveKubeConfig​(io.fabric8.kubernetes.api.model.Config config)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • safeLoadKubeConfig

        public static io.fabric8.kubernetes.api.model.Config safeLoadKubeConfig()
      • loadKubeConfig

        public static io.fabric8.kubernetes.api.model.Config loadKubeConfig()
                                                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • loadKubeConfig

        public static io.fabric8.kubernetes.api.model.Config loadKubeConfig​(java.lang.String path)
                                                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • isKubeConfigParsable

        public static boolean isKubeConfigParsable()
      • isKubeConfigParsable

        public static boolean isKubeConfigParsable​(java.io.File kubeConfig)
      • loadToolsConfig

        public static ToolsConfig loadToolsConfig()
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • loadToolsConfig

        public static ToolsConfig loadToolsConfig​(java.net.URL url)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • getCurrentContext

        public static io.fabric8.kubernetes.api.model.NamedContext getCurrentContext()
      • areEqual

        public static boolean areEqual​(io.fabric8.kubernetes.api.model.Config kubeConfig,
                                       io.fabric8.kubernetes.client.Config clientConfig)
        Returns true if the given Config and (client runtime) Config are 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 compare
        clientConfig - 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.NamedContext thisContext,
                                       io.fabric8.kubernetes.api.model.NamedContext thatContext)
        Returns true if 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 compare
        thatContext - the second context to compare
        Returns:
        true if both contexts are equal
        See Also:
        NamedContext, Context
      • areEqual

        public static boolean areEqual​(java.util.Collection<io.fabric8.kubernetes.api.model.NamedContext> these,
                                       java.util.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)
        Returns true if the token in the given (kubernetes file) Config and (client runtime) Config are equal. Returns false otherwise.
        Parameters:
        kubeConfig - the (kube config) auth info that contains the token
        clientConfig - 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)
        Returns true if the token in the given AuthInfo (that's retrieved from the kube config file) and Config (that's contains the runtime settings that the kubernetes-client is using) are equal. Returns false otherwise.
        Parameters:
        authInfo - the (kube config) auth info that contains the token
        clientConfig - the (client) config that contains the token
        Returns:
        true if both tokens are equal, false otherwise