Documentation ¶
Index ¶
- func GetClientset(contextName string) (*kubernetes.Clientset, error)
- func GetContextNames() []string
- func GetMetrics(contextName string) (*metrics.Clientset, error)
- func LoadContexts(applicationConfiguration configuration.ApplicationConfiguration) error
- func SetClusterCertificateEmbedded(clusterName string, cluster ParamClusterCertificateEmbedded) error
- func SetClusterCertificateFile(clusterName string, cluster ParamClusterCertificateFile) error
- func SetClusterInsecure(clusterName string, cluster ParamClusterInsecure) error
- func SetContext(contextName string, context ParamContext) error
- func SetUserWithCertificateFile(userName string, credentials ParamCredentialsCertificateFile) error
- func SetUserWithCertificateFileEmbedded(userName string, credentials ParamCredentialsCertificateEmbedded) error
- func SetUserWithUserNamePassword(userName string, credentials ParamCredentialsUserNamePassword) error
- func UseContext(contextName string) error
- type DefinitionCluster
- type DefinitionContext
- type DefinitionUser
- type KubeConfig
- type NamedCluster
- type NamedContext
- type NamedUser
- type NotFoundError
- type ParamClusterCertificateEmbedded
- type ParamClusterCertificateFile
- type ParamClusterInsecure
- type ParamContext
- type ParamCredentialsCertificateEmbedded
- type ParamCredentialsCertificateFile
- type ParamCredentialsUserNamePassword
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetClientset ¶
func GetClientset(contextName string) (*kubernetes.Clientset, error)
GetClientset gives a clientset for the given contextName
func GetContextNames ¶
func GetContextNames() []string
GetContextNames gives the list of all contextNames known by the application
func GetMetrics ¶
GetMetrics gives a clientset for the given contextName
func LoadContexts ¶
func LoadContexts(applicationConfiguration configuration.ApplicationConfiguration) error
LoadContexts loads all the possible configuration from a Kubectl config file. If there are no configuration, try to default to the InCluster mode
func SetClusterCertificateEmbedded ¶
func SetClusterCertificateEmbedded(clusterName string, cluster ParamClusterCertificateEmbedded) error
SetClusterCertificateEmbedded adds or updates a cluster without validating the server certificate given as raw text
func SetClusterCertificateFile ¶
func SetClusterCertificateFile(clusterName string, cluster ParamClusterCertificateFile) error
SetClusterCertificateFile adds or updates a cluster without validating the server certificate given as a local file
func SetClusterInsecure ¶
func SetClusterInsecure(clusterName string, cluster ParamClusterInsecure) error
SetClusterInsecure adds or updates a cluster without validating the server certificate
func SetContext ¶
func SetContext(contextName string, context ParamContext) error
SetContext adds or updates a context
func SetUserWithCertificateFile ¶
func SetUserWithCertificateFile(userName string, credentials ParamCredentialsCertificateFile) error
SetUserWithCertificateFile adds or updates a user with the credentials given as local certificate files
func SetUserWithCertificateFileEmbedded ¶
func SetUserWithCertificateFileEmbedded(userName string, credentials ParamCredentialsCertificateEmbedded) error
SetUserWithCertificateFileEmbedded adds or updates a user with the credentials given as embedded certificate files
func SetUserWithUserNamePassword ¶
func SetUserWithUserNamePassword(userName string, credentials ParamCredentialsUserNamePassword) error
SetUserWithUserNamePassword adds or updates a user with the given credentials
func UseContext ¶
UseContext defines the current default context
Types ¶
type DefinitionCluster ¶
type DefinitionCluster struct { Server string `yaml:"server,omitempty" json:"server,omitempty"` InsecureSkipTLSVerify bool `yaml:"insecure-skip-tls-verify,omitempty" json:"insecure-skip-tls-verify,omitempty"` CertificateAuthority string `yaml:"certificate-authority,omitempty" json:"certificate-authority,omitempty"` CertificateAuthorityData string `yaml:"certificate-authority-data,omitempty" json:"certificate-authority-data,omitempty"` }
DefinitionCluster is the actual definition of a Kubernetes cluster
type DefinitionContext ¶
type DefinitionContext struct { User string `yaml:"user,omitempty" json:"user"` Cluster string `yaml:"cluster,omitempty" json:"cluster"` Namespace string `yaml:"namespace,omitempty" json:"namespace,omitempty"` }
DefinitionContext is the actual definition of a Kubectl configuration
type DefinitionUser ¶
type DefinitionUser struct { UserName string `yaml:"username,omitempty" json:"username,omitempty"` Password string `yaml:"password,omitempty" json:"password,omitempty"` ClientCertificate string `yaml:"client-certificate,omitempty" json:"client-certificate,omitempty"` ClientKey string `yaml:"client-key,omitempty" json:"client-key,omitempty"` ClientCertificateData string `yaml:"client-certificate-data,omitempty" json:"client-certificate-data,omitempty"` ClientKeyData string `yaml:"client-key-data,omitempty" json:"client-key-data,omitempty"` }
DefinitionUser is the actual definition of a Kubernetes user
type KubeConfig ¶
type KubeConfig struct { APIVersion string `yaml:"apiVersion" json:"apiVersion"` Kind string `yaml:"kind" json:"kind"` Preferences map[string]string `yaml:"preferences" json:"preferences"` Clusters []NamedCluster `yaml:"clusters,omitempty" json:"clusters,omitempty"` Contexts []NamedContext `yaml:"contexts,omitempty" json:"contexts,omitempty"` CurrentContext string `yaml:"current-context,omitempty" json:"current-context,omitempty"` Users []NamedUser `yaml:"users,omitempty" json:"users,omitempty"` }
KubeConfig is the complete configuration of a kubectl config file
func GetKubeConfig ¶
func GetKubeConfig() (*KubeConfig, error)
GetKubeConfig reads the configuration file
type NamedCluster ¶
type NamedCluster struct { Name string `yaml:"name" json:"name"` DefinitionCluster DefinitionCluster `yaml:"cluster,omitempty" json:"cluster,omitempty"` }
NamedCluster is a Kubernetes cluster. This struct holds only a name and the // actual definition structure
func GetKubeCluster ¶
func GetKubeCluster(name string) (*NamedCluster, error)
GetKubeCluster return a single cluster if present, nil otherwise
func GetKubeClusters ¶
func GetKubeClusters() ([]NamedCluster, error)
GetKubeClusters returns the clusters configured
type NamedContext ¶
type NamedContext struct { Name string `yaml:"name" json:"name"` DefinitionContext DefinitionContext `yaml:"context,omitempty" json:"context,omitempty"` }
NamedContext is a Kubectl configuration, the association of a user and a cluster. This struct holds only a name and the actual definition structure
func GetKubeContext ¶
func GetKubeContext(name string) (*NamedContext, error)
GetKubeContext return a single context if present, nil otherwise
func GetKubeContexts ¶
func GetKubeContexts() ([]NamedContext, error)
GetKubeContexts returns the clusters configured
type NamedUser ¶
type NamedUser struct { Name string `yaml:"name" json:"name"` DefinitionUser DefinitionUser `yaml:"user,omitempty" json:"user,omitempty"` }
NamedUser is a Kubernetes user. This struct holds only a name and the // actual definition structure
func GetKubeUser ¶
GetKubeUser return a single user if present, nil otherwise
func GetKubeUsers ¶
GetKubeUsers returns the users configured
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError is a trivial implementation of error.
func (*NotFoundError) ContextName ¶
func (e *NotFoundError) ContextName() string
ContextName returns the name of the context that was not found
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
type ParamClusterCertificateEmbedded ¶
type ParamClusterCertificateEmbedded struct { Server string `json:"server"` CertificateAuthorityData string `json:"certificateAuthorityData"` }
ParamClusterCertificateEmbedded is the definition of a cluster for which the TLS certificate is verified with a local file
type ParamClusterCertificateFile ¶
type ParamClusterCertificateFile struct { Server string `json:"server"` CertificateAuthority string `json:"certificateAuthority"` }
ParamClusterCertificateFile is the definition of a cluster for which the TLS certificate is verified with a local file
type ParamClusterInsecure ¶
type ParamClusterInsecure struct {
Server string `json:"server"`
}
ParamClusterInsecure is the definition of a cluster for which the TLS certificate is not verified
type ParamContext ¶
type ParamContext struct { User string `json:"user"` Cluster string `json:"cluster"` Namespace string `json:"namespace"` }
ParamContext is the definition of a context
type ParamCredentialsCertificateEmbedded ¶
type ParamCredentialsCertificateEmbedded struct { ClientCertificateData string `json:"clientCertificateData"` ClientKeyData string `json:"clientKeyData"` }
ParamCredentialsCertificateEmbedded is the definition of a credential with a certificate embedded
type ParamCredentialsCertificateFile ¶
type ParamCredentialsCertificateFile struct { ClientCertificate string `json:"clientCertificate"` ClientKey string `json:"clientKey"` }
ParamCredentialsCertificateFile is the definition of a credential with a certificate kept as a local file
type ParamCredentialsUserNamePassword ¶
type ParamCredentialsUserNamePassword struct { UserName string `json:"userName"` Password string `json:"password"` }
ParamCredentialsUserNamePassword is the definition of a credential with a username and a password