Documentation ¶
Index ¶
- Constants
- Variables
- func CreateConfig(namespace string, clientCfg *client.Config) (*clientcmdapi.Config, error)
- func FindExistingContextName(haystack clientcmdapi.Config, needle clientcmdapi.Context) string
- func GetClusterNicknameFromConfig(clientCfg *client.Config) (string, error)
- func GetClusterNicknameFromURL(apiServerLocation string) (string, error)
- func GetContextNickname(namespace, clusterNick, userNick string) string
- func GetContextNicknameFromConfig(namespace string, clientCfg *client.Config) (string, error)
- func GetUserNicknameFromCert(clusterNick string, chain ...*x509.Certificate) (string, error)
- func GetUserNicknameFromConfig(clientCfg *client.Config) (string, error)
- func MergeConfig(startingConfig, addition clientcmdapi.Config) (*clientcmdapi.Config, error)
- func NewOpenShiftClientConfigLoadingRules() *clientcmd.ClientConfigLoadingRules
- func NewPathOptions(cmd *cobra.Command) *kubecmdconfig.PathOptions
- func NormalizeServerURL(s string) (string, error)
- func RelativizeClientConfigPaths(cfg *clientcmdapi.Config, base string) (err error)
Constants ¶
const ( OpenShiftConfigPathEnvVar = "KUBECONFIG" OpenShiftConfigFlagName = "config" OpenShiftConfigHomeDir = ".kube" OpenShiftConfigHomeFileName = "config" OpenShiftConfigHomeDirFileName = OpenShiftConfigHomeDir + "/" + OpenShiftConfigHomeFileName )
Variables ¶
var RecommendedHomeFile = path.Join(homedir.HomeDir(), OpenShiftConfigHomeDirFileName)
Functions ¶
func CreateConfig ¶
CreateConfig takes a clientCfg and builds a config (kubeconfig style) from it.
func FindExistingContextName ¶
func FindExistingContextName(haystack clientcmdapi.Config, needle clientcmdapi.Context) string
FindExistingContextName finds the nickname for the passed context
func GetClusterNicknameFromConfig ¶
GetClusterNicknameFromConfig returns host:port of the clientConfig.Host, with .'s replaced by -'s
func GetClusterNicknameFromURL ¶
GetClusterNicknameFromURL returns host:port of the apiServerLocation, with .'s replaced by -'s
func GetContextNickname ¶
func GetContextNicknameFromConfig ¶
GetContextNicknameFromConfig returns "namespace/GetClusterNicknameFromConfig/username(as known by the server)". This allows tab completion for switching projects/context to work easily. First tab is the most selective on project. Second stanza in the next most selective on cluster name. The chances of a user trying having one projects on a single server that they want to operate against with two identities is low, so username is last.
func GetUserNicknameFromCert ¶
func GetUserNicknameFromCert(clusterNick string, chain ...*x509.Certificate) (string, error)
func GetUserNicknameFromConfig ¶
GetUserNicknameFromConfig returns "username(as known by the server)/GetClusterNicknameFromConfig". This allows tab completion for switching users to work easily and obviously.
func MergeConfig ¶
func MergeConfig(startingConfig, addition clientcmdapi.Config) (*clientcmdapi.Config, error)
MergeConfig adds the additional Config stanzas to the startingConfig. It blindly stomps clusters and users, but it searches for a matching context before writing a new one.
func NewOpenShiftClientConfigLoadingRules ¶
func NewOpenShiftClientConfigLoadingRules() *clientcmd.ClientConfigLoadingRules
NewOpenShiftClientConfigLoadingRules returns file priority loading rules for OpenShift. 1. --config value 2. if KUBECONFIG env var has a value, use it. Otherwise, ~/.kube/config file
func NewPathOptions ¶
func NewPathOptions(cmd *cobra.Command) *kubecmdconfig.PathOptions
func NormalizeServerURL ¶
NormalizeServerURL is opinionated normalization of a string that represents a URL. Returns the URL provided matching the format expected when storing a URL in a config. Sets a scheme and port if not present, removes unnecessary trailing slashes, etc. Can be used to normalize a URL provided by user input.
func RelativizeClientConfigPaths ¶
func RelativizeClientConfigPaths(cfg *clientcmdapi.Config, base string) (err error)
TODO should be moved upstream
Types ¶
This section is empty.