Documentation ¶
Index ¶
- func GetNode(name string) (*corev1.Node, error)
- func GetOSAndKernelVersion() (string, error)
- func GetServerVersion() (*version.Info, error)
- func ListNodes(options metav1.ListOptions) (*corev1.NodeList, error)
- func NumberOfNodes() (int, error)
- type ClientsetGetter
- type ClientsetStruct
- type ConfigGetter
- type ConfigGetters
- type ConfigMapGetter
- type Configmap
- type Delete
- type DynamicProvider
- type DynamicStruct
- type Get
- type List
- type NamespaceGetter
- type NamespaceLister
- type NamespaceStruct
- type NodeGetter
- type NodeLister
- type NodeStruct
- type ResourceApplier
- type ResourceCreateOrUpdater
- type ResourceCreateOrUpdaterOption
- type ResourceCreator
- type ResourceDeleteOptions
- type ResourceDeleter
- type ResourceGetOptions
- type ResourceGetter
- type ResourceListOptions
- type ResourceLister
- type ResourceStruct
- func (r *ResourceStruct) Create(obj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
- func (r *ResourceStruct) Delete(obj *unstructured.Unstructured, subresources ...string) error
- func (r *ResourceStruct) Get(name string, opts metav1.GetOptions, subresources ...string) (u *unstructured.Unstructured, err error)
- func (r *ResourceStruct) List(opts metav1.ListOptions) (u *unstructured.UnstructuredList, err error)
- func (r *ResourceStruct) String() string
- func (r *ResourceStruct) Update(oldobj, newobj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
- type ResourceUpdater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOSAndKernelVersion ¶
GetOSAndKernelVersion gets us the OS,Kernel version
func GetServerVersion ¶
GetServerVersion uses the client-go Discovery client to get the kubernetes version struct
func ListNodes ¶
func ListNodes(options metav1.ListOptions) (*corev1.NodeList, error)
ListNodes returns list of node instance from kubernetes cluster
func NumberOfNodes ¶
NumberOfNodes returns the number of nodes registered in a Kubernetes cluster
Types ¶
type ClientsetGetter ¶
type ClientsetGetter interface {
Get() (*kubernetes.Clientset, error)
}
ClientsetGetter abstracts fetching of kubernetes clientset
type ClientsetStruct ¶
type ClientsetStruct struct{}
ClientsetStruct is used to export a kuberneter Clientset
func (*ClientsetStruct) Get ¶
func (c *ClientsetStruct) Get() (*kubernetes.Clientset, error)
Get returns a new instance of kubernetes clientset
type ConfigGetter ¶
ConfigGetter abstracts fetching of kubernetes client config
func Config ¶
func Config() ConfigGetter
Config provides appropriate config getter instances that help in fetching kubernetes client config to invoke kubernetes API calls
type ConfigGetters ¶
type ConfigGetters []ConfigGetter
ConfigGetters holds a list of ConfigGetter instances
NOTE:
This is an implementation of ConfigGetter
func (ConfigGetters) Get ¶
func (c ConfigGetters) Get() (config *rest.Config, err error)
Get fetches the kubernetes client config that is used to make kubernetes API calls. It makes use of its list of getter instances to fetch kubernetes config.
func (ConfigGetters) Name ¶
func (c ConfigGetters) Name() string
Name returns the name of this config getter instance
type ConfigMapGetter ¶
type ConfigMapGetter interface {
Get(options metav1.GetOptions) (*corev1.ConfigMap, error)
}
ConfigMapGetter abstracts fetching of ConfigMap instance from kubernetes cluster
type Configmap ¶
type Configmap struct {
// contains filtered or unexported fields
}
Configmap is used to initialise a kubernetes Configmap struct
type Delete ¶
type Delete struct { *ResourceStruct // contains filtered or unexported fields }
Delete is a resource that is suitable to be executed as a Delete operation
func DeleteResource ¶
func DeleteResource(gvr schema.GroupVersionResource, namespace string) *Delete
DeleteResource returns a new instance of delete resource
func (*Delete) Delete ¶
func (d *Delete) Delete(obj *unstructured.Unstructured, subresources ...string) error
Delete deletes a resource from a kubernetes cluster
type DynamicProvider ¶
type DynamicProvider interface {
Provide() (k8sdynamic.Interface, error)
}
DynamicProvider abstracts providing kubernetes dynamic client interface
type DynamicStruct ¶
type DynamicStruct struct{}
DynamicStruct is used to initialise a kuberenets dynamic interface
func (*DynamicStruct) Provide ¶
func (d *DynamicStruct) Provide() (k8sdynamic.Interface, error)
Provide provides a kubernetes dynamic client capable of invoking operations against kubernetes resources
type Get ¶
type Get struct { *ResourceStruct // contains filtered or unexported fields }
Get is resource that is suitable to be executed as Get operation
func GetResource ¶
func GetResource(gvr schema.GroupVersionResource, namespace string) *Get
GetResource returns a new instance of get resource
func (*Get) Get ¶
func (g *Get) Get(name string, opts metav1.GetOptions, subresources ...string) (u *unstructured.Unstructured, err error)
Get gets a resource from a kubernetes cluster
type List ¶
type List struct { *ResourceStruct // contains filtered or unexported fields }
List is a resource resource that is suitable to be executed as a List operation
func ListResource ¶
func ListResource(gvr schema.GroupVersionResource, namespace string) *List
ListResource returns a new instance of list resource
func (*List) List ¶
func (l *List) List(options metav1.ListOptions) (u *unstructured.UnstructuredList, err error)
List lists a resource from a kubernetes cluster
type NamespaceGetter ¶
type NamespaceGetter interface {
Get(name string, options metav1.GetOptions) (*corev1.Namespace, error)
}
NamespaceGetter abstracts fetching of Namespace from kubernetes cluster
type NamespaceLister ¶
type NamespaceLister interface {
List(options metav1.ListOptions) (*corev1.NamespaceList, error)
}
NamespaceLister abstracts fetching of a list of namespaces from kubernetes cluster
type NamespaceStruct ¶
type NamespaceStruct struct{}
NamespaceStruct is used to initialise kubernetes namespace instnaces
func Namespace ¶
func Namespace() *NamespaceStruct
Namespace returns a pointer to the namespace struct
func (*NamespaceStruct) Get ¶
func (ns *NamespaceStruct) Get(name string, options metav1.GetOptions) (*corev1.Namespace, error)
Get returns a namespace instance from kubernetes cluster
func (*NamespaceStruct) List ¶
func (ns *NamespaceStruct) List(options metav1.ListOptions) (*corev1.NamespaceList, error)
List returns a slice of namespaces defined in a Kubernetes cluster
type NodeGetter ¶
NodeGetter abstracts fetching of Node details from kubernetes cluster
type NodeLister ¶
type NodeLister interface {
List(options metav1.ListOptions) (*corev1.NodeList, error)
}
NodeLister abstracts fetching of Nodes from kubernetes cluster
type NodeStruct ¶
type NodeStruct struct{}
NodeStruct returns a struct used to instantiate a kubernetes Node
func (*NodeStruct) Get ¶
func (n *NodeStruct) Get(name string, options metav1.GetOptions) (*corev1.Node, error)
Get returns a node instance from kubernetes cluster
func (*NodeStruct) List ¶
func (n *NodeStruct) List(options metav1.ListOptions) (*corev1.NodeList, error)
List returns a slice of Nodes registered in a Kubernetes cluster
type ResourceApplier ¶
type ResourceApplier interface {
Apply(obj *unstructured.Unstructured, subresources ...string) (*unstructured.Unstructured, error)
}
ResourceApplier abstracts applying an unstructured instance that may or may not be available in kubernetes cluster
type ResourceCreateOrUpdater ¶
type ResourceCreateOrUpdater struct { *ResourceStruct // Various executors required to perform Apply // This is how this instance decouples its dependencies Getter ResourceGetter Creator ResourceCreator Updater ResourceUpdater // IsSkipUpdate will not update this resource if set to true. // In other words, enabling this flag can only create the // resource in the cluster if not created previously IsSkipUpdate bool }
ResourceCreateOrUpdater as the name suggests manages to either create or update a given resource. It does so by implementing ResourceApplier interface
func NewResourceCreateOrUpdater ¶
func NewResourceCreateOrUpdater( gvr schema.GroupVersionResource, namespace string, options ...ResourceCreateOrUpdaterOption, ) *ResourceCreateOrUpdater
NewResourceCreateOrUpdater returns a new instance of ResourceCreateOrUpdater
func (*ResourceCreateOrUpdater) Apply ¶
func (r *ResourceCreateOrUpdater) Apply( obj *unstructured.Unstructured, subresources ...string, ) (resource *unstructured.Unstructured, err error)
Apply applies a resource to the kubernetes cluster. In other words, it creates a new resource if it does not exist or updates the existing resource.
func (*ResourceCreateOrUpdater) String ¶
func (r *ResourceCreateOrUpdater) String() string
String implements Stringer interface
type ResourceCreateOrUpdaterOption ¶
type ResourceCreateOrUpdaterOption func(*ResourceCreateOrUpdater)
ResourceCreateOrUpdaterOption is a typed function used to build an instance of ResourceCreateOrUpdater
NOTE:
This follows the pattern known as "functional options". It
is a function that operates on a given structure as a value to build (initialise, configure, sensible defaults, etc) this same structure.
func ResourceCreateOrUpdaterSkipUpdate ¶
func ResourceCreateOrUpdaterSkipUpdate(skip bool) ResourceCreateOrUpdaterOption
ResourceCreateOrUpdaterSkipUpdate sets IsSkipUpdate based on the provided flag
type ResourceCreator ¶
type ResourceCreator interface {
Create(obj *unstructured.Unstructured, subresources ...string) (*unstructured.Unstructured, error)
}
ResourceCreator abstracts creating an unstructured instance in kubernetes cluster
type ResourceDeleteOptions ¶
type ResourceDeleteOptions struct {
Deleter ResourceDeleter
}
ResourceDeleteOptions is a utility instance used during the resource's delete operations
type ResourceDeleter ¶
type ResourceDeleter interface {
Delete(obj *unstructured.Unstructured, subresources ...string) error
}
ResourceDeleter abstracts deletes an unstructured instance that is available in kubernetes cluster
type ResourceGetOptions ¶
type ResourceGetOptions struct {
Getter ResourceGetter
}
ResourceGetOptions is a utility instance used during the resource's get operations
type ResourceGetter ¶
type ResourceGetter interface {
Get(name string, options metav1.GetOptions, subresources ...string) (*unstructured.Unstructured, error)
}
ResourceGetter abstracts fetching an unstructured instance from kubernetes cluster
type ResourceListOptions ¶
type ResourceListOptions struct {
Lister ResourceLister
}
ResourceListOptions is a utility instance used during the resource's list operations
type ResourceLister ¶
type ResourceLister interface {
List(options metav1.ListOptions) (*unstructured.UnstructuredList, error)
}
ResourceLister abstracts fetching an unstructured list of instance from kubernetes cluster
type ResourceStruct ¶
type ResourceStruct struct {
// contains filtered or unexported fields
}
ResourceStruct is used to abstract a kubernetes struct
func Resource ¶
func Resource(gvr schema.GroupVersionResource, namespace string) *ResourceStruct
Resource returns a new resource instance
func (*ResourceStruct) Create ¶
func (r *ResourceStruct) Create(obj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
Create creates a new resource in kubernetes cluster
func (*ResourceStruct) Delete ¶
func (r *ResourceStruct) Delete(obj *unstructured.Unstructured, subresources ...string) error
Delete deletes a existing resource in kubernetes cluster
func (*ResourceStruct) Get ¶
func (r *ResourceStruct) Get(name string, opts metav1.GetOptions, subresources ...string) (u *unstructured.Unstructured, err error)
Get returns a specific resource from kubernetes cluster
func (*ResourceStruct) List ¶
func (r *ResourceStruct) List(opts metav1.ListOptions) (u *unstructured.UnstructuredList, err error)
List returns a list of specific resource at kubernetes cluster
func (*ResourceStruct) String ¶
func (r *ResourceStruct) String() string
String implements Stringer interface
func (*ResourceStruct) Update ¶
func (r *ResourceStruct) Update(oldobj, newobj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
Update updates the resource at kubernetes cluster
type ResourceUpdater ¶
type ResourceUpdater interface {
Update(oldobj, newobj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
}
ResourceUpdater abstracts updating an unstructured instance found in kubernetes cluster