Documentation ¶
Index ¶
- Constants
- func FindExistingAuthInfoName(haystack clientcmdapi.Config, needle clientcmdapi.AuthInfo) string
- func FindExistingClusterName(haystack clientcmdapi.Config, needle clientcmdapi.Cluster) string
- func FindExistingContextName(haystack clientcmdapi.Config, needle clientcmdapi.Context) string
- func FullClientConfigFilePriority() []string
- func GenerateContextIdentifier(namespace string, cluster string, authInfo string, ...) string
- func KubeClientConfigFilePriority() []string
- func MergeConfig(haystack, toModify, addition clientcmdapi.Config) (*clientcmdapi.Config, error)
- func NewOpenShiftClientConfigLoadingRules() *clientcmd.ClientConfigLoadingRules
- func OpenShiftClientConfigFilePriority() []string
- type ConfigStore
Constants ¶
const ( OpenShiftConfigPathEnvVar = "OPENSHIFTCONFIG" OpenShiftConfigFlagName = "config" OpenShiftConfigFileName = ".openshiftconfig" OpenShiftConfigHomeDir = ".config/openshift" OpenShiftConfigHomeFileName = ".config" OpenShiftConfigHomeDirFileName = OpenShiftConfigHomeDir + "/" + OpenShiftConfigHomeFileName KubeConfigPathEnvVar = clientcmd.RecommendedConfigPathEnvVar KubeConfigFileName = ".kubeconfig" KubeConfigHomeDir = ".kube" )
Variables ¶
This section is empty.
Functions ¶
func FindExistingAuthInfoName ¶
func FindExistingAuthInfoName(haystack clientcmdapi.Config, needle clientcmdapi.AuthInfo) string
FindExistingAuthInfoName finds the nickname for the passed auth info
func FindExistingClusterName ¶
func FindExistingClusterName(haystack clientcmdapi.Config, needle clientcmdapi.Cluster) string
FindExistingClusterName finds the nickname for the passed cluster config
func FindExistingContextName ¶
func FindExistingContextName(haystack clientcmdapi.Config, needle clientcmdapi.Context) string
FindExistingContextName finds the nickname for the passed context
func FullClientConfigFilePriority ¶
func FullClientConfigFilePriority() []string
func GenerateContextIdentifier ¶
func GenerateContextIdentifier(namespace string, cluster string, authInfo string, existingContextIdentifiers *util.StringSet) string
Generates the best context identifier possible based on the information it gets.
func KubeClientConfigFilePriority ¶
func KubeClientConfigFilePriority() []string
File priority loading rules for Kube. 1. KUBECONFIG env var 2. .kubeconfig file in current directory 3. ~/.kube/.kubeconfig file
func MergeConfig ¶
func MergeConfig(haystack, toModify, addition clientcmdapi.Config) (*clientcmdapi.Config, error)
MergeConfig takes a haystack to look for existing stanzas in (probably the merged config), a config object to modify (probably either the local or envvar config), and the new additions to merge in. It tries to find equivalents for the addition inside of the haystack and uses the mapping to avoid creating additional stanzas with duplicate information. It either locates or original stanzas or creates new ones for clusters and users. Then it uses the mapped names to build the correct contexts
func NewOpenShiftClientConfigLoadingRules ¶
func NewOpenShiftClientConfigLoadingRules() *clientcmd.ClientConfigLoadingRules
Set up the rules and priorities for loading config files.
func OpenShiftClientConfigFilePriority ¶
func OpenShiftClientConfigFilePriority() []string
File priority loading rules for OpenShift. 1. OPENSHIFTCONFIG env var 2. .openshiftconfig file in current directory 3. ~/.config/openshift/.config file
Types ¶
type ConfigStore ¶
type ConfigStore struct { Config *clientcmdapi.Config Path string // contains filtered or unexported fields }
A ConfigStore is the representation of a config from one individual config file. Can be used to persist configs by being explicit about the file to save.
func CreateEmpty ¶
func CreateEmpty() (*ConfigStore, error)
Create a new file to store configs and returns the ConfigStore that represents it.
func LoadFrom ¶
func LoadFrom(path string) (*ConfigStore, error)
Load a ConfigStore from the explicit path to a config file provided as argument Error if not found.
func LoadWithLoadingRules ¶
func LoadWithLoadingRules() (store *ConfigStore, err error)
Load a ConfigStore using the priority conventions declared by the ClientConfigLoadingRules. Error if none can be found.
func (*ConfigStore) FromKube ¶
func (c *ConfigStore) FromKube() bool
func (*ConfigStore) FromOpenShift ¶
func (c *ConfigStore) FromOpenShift() bool
func (*ConfigStore) SaveToFile ¶
func (c *ConfigStore) SaveToFile(credentialsName string, namespace string, clientCfg *client.Config, rawCfg clientcmdapi.Config) error
Save the provided config attributes to this ConfigStore.