Documentation ¶
Index ¶
- Constants
- func ApplyYaml(client kubernetes.Interface, dynamicClient dynamic.Interface, uri string) error
- func CreateOrUpdate(config *KubeConfig, obj client.Object) error
- func Delete(config *KubeConfig, obj client.Object) error
- func DeleteYamlObjects(kc *KubeConfig, uri string) error
- func GetClient(config *KubeConfig) (*kubernetes.Clientset, error)
- func GetDynamicClient(config *KubeConfig) (*dynamic.DynamicClient, error)
- func WaitForNodes(client kubernetes.Interface) error
- func WaitForPods(client kubernetes.Interface, namespace string) error
- type KubeConfig
- func (c *KubeConfig) ConfigAccess() clientcmd.ConfigAccess
- func (c *KubeConfig) CurrentContextName() (string, error)
- func (c *KubeConfig) DelContext(n string) error
- func (c *KubeConfig) GetConfigPath() string
- func (c *KubeConfig) GetContext(n string) (*clientcmdapi.Context, error)
- func (c *KubeConfig) MergeConfig(newConfig clientcmdapi.Config) error
- func (c *KubeConfig) RESTConfig() (*restclient.Config, error)
- func (c *KubeConfig) TryLoad() error
Constants ¶
const ( // UsePersistentConfig caches client config to avoid reloads. UsePersistentConfig = true )
Variables ¶
This section is empty.
Functions ¶
func ApplyYaml ¶
ApplyYaml applies a yaml manifest to the cluster from the URI. The URI can be a file path or a URL It creates CRDs first and then other objects @TODO: Make this function testable by passing a "uri reader"
func CreateOrUpdate ¶
func CreateOrUpdate(config *KubeConfig, obj client.Object) error
CreateOrUpdate creates or updates a kubernetes object Note: This only really works for Blueprint objects right now.
func Delete ¶
func Delete(config *KubeConfig, obj client.Object) error
Delete deletes a kubernetes object
func DeleteYamlObjects ¶
func DeleteYamlObjects(kc *KubeConfig, uri string) error
DeleteYamlObjects deletes all objects in the cluster that are specified in the yaml
func GetClient ¶
func GetClient(config *KubeConfig) (*kubernetes.Clientset, error)
GetClient returns a kubernetes client
func GetDynamicClient ¶
func GetDynamicClient(config *KubeConfig) (*dynamic.DynamicClient, error)
GetDynamicClient returns a dynamic kubernetes client
func WaitForNodes ¶
func WaitForNodes(client kubernetes.Interface) error
WaitForNodes waits for all nodes to be ready
func WaitForPods ¶
func WaitForPods(client kubernetes.Interface, namespace string) error
WaitForPods waits for all pods in the given namespace to be running
Types ¶
type KubeConfig ¶
type KubeConfig struct {
// contains filtered or unexported fields
}
KubeConfig tracks a kubernetes configuration.
func NewConfig ¶
func NewConfig(f *genericclioptions.ConfigFlags) *KubeConfig
NewConfig returns a new k8s config or an error if the flags are invalid.
func (*KubeConfig) ConfigAccess ¶
func (c *KubeConfig) ConfigAccess() clientcmd.ConfigAccess
ConfigAccess return the current kubeconfig api server access configuration.
func (*KubeConfig) CurrentContextName ¶
func (c *KubeConfig) CurrentContextName() (string, error)
CurrentContextName returns the currently active config context.
func (*KubeConfig) DelContext ¶
func (c *KubeConfig) DelContext(n string) error
DelContext remove a given context from the configuration.
func (*KubeConfig) GetConfigPath ¶
func (c *KubeConfig) GetConfigPath() string
func (*KubeConfig) GetContext ¶
func (c *KubeConfig) GetContext(n string) (*clientcmdapi.Context, error)
GetContext fetch a given context or error if it does not exists.
func (*KubeConfig) MergeConfig ¶
func (c *KubeConfig) MergeConfig(newConfig clientcmdapi.Config) error
MergeConfig merges a new config into the existing config and writes it back to disk.
func (*KubeConfig) RESTConfig ¶
func (c *KubeConfig) RESTConfig() (*restclient.Config, error)
func (*KubeConfig) TryLoad ¶
func (c *KubeConfig) TryLoad() error
TryLoad attempts to create a kube client and returns an error if it fails.