Documentation
¶
Index ¶
- func SetInstance(i Ops)
- type CRDOps
- type Client
- func (c *Client) CreateCRD(resource CustomResource) error
- func (c *Client) DeleteCRD(fullName string) error
- func (c *Client) GetCRD(name string, options metav1.GetOptions) (*apiextensionsv1beta1.CustomResourceDefinition, error)
- func (c *Client) ListCRDs() (*apiextensionsv1beta1.CustomResourceDefinitionList, error)
- func (c *Client) RegisterCRD(crd *apiextensionsv1beta1.CustomResourceDefinition) error
- func (c *Client) SetConfig(cfg *rest.Config)
- func (c *Client) UpdateCRD(crd *apiextensionsv1beta1.CustomResourceDefinition) (*apiextensionsv1beta1.CustomResourceDefinition, error)
- func (c *Client) ValidateCRD(resource CustomResource, timeout, retryInterval time.Duration) error
- type CustomResource
- type Ops
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetInstance ¶
func SetInstance(i Ops)
SetInstance replaces the instance with the provided one. Should be used only for testing purposes.
Types ¶
type CRDOps ¶
type CRDOps interface { // CreateCRD creates the given custom resource // This API will be deprecated soon. Use RegisterCRD instead CreateCRD(resource CustomResource) error // RegisterCRD creates the given custom resource RegisterCRD(crd *apiextensionsv1beta1.CustomResourceDefinition) error // UpdateCRD updates the existing crd UpdateCRD(crd *apiextensionsv1beta1.CustomResourceDefinition) (*apiextensionsv1beta1.CustomResourceDefinition, error) // GetCRD returns a crd by name GetCRD(name string, options metav1.GetOptions) (*apiextensionsv1beta1.CustomResourceDefinition, error) // ValidateCRD checks if the given CRD is registered ValidateCRD(resource CustomResource, timeout, retryInterval time.Duration) error // DeleteCRD deletes the CRD for the given complete name (plural.group) DeleteCRD(fullName string) error // ListCRDs list all the CRDs ListCRDs() (*apiextensionsv1beta1.CustomResourceDefinitionList, error) }
CRDOps is an interface to perfrom k8s Customer Resource operations
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a wrapper for kubernetes extension interface.
func New ¶
func New(client apiextensionsclient.Interface) *Client
New builds a new apiextensions client.
func NewForConfig ¶
NewForConfig builds a new apiextensions client for the given config.
func (*Client) CreateCRD ¶
func (c *Client) CreateCRD(resource CustomResource) error
CreateCRD creates the given custom resource This API will be deprecated soon. Use RegisterCRD instead
func (*Client) GetCRD ¶
func (c *Client) GetCRD(name string, options metav1.GetOptions) (*apiextensionsv1beta1.CustomResourceDefinition, error)
GetCRD returns a crd by name
func (*Client) ListCRDs ¶
func (c *Client) ListCRDs() (*apiextensionsv1beta1.CustomResourceDefinitionList, error)
ListCRDs list all CRD resources
func (*Client) RegisterCRD ¶
func (c *Client) RegisterCRD(crd *apiextensionsv1beta1.CustomResourceDefinition) error
RegisterCRD creates the given custom resource
func (*Client) UpdateCRD ¶
func (c *Client) UpdateCRD(crd *apiextensionsv1beta1.CustomResourceDefinition) (*apiextensionsv1beta1.CustomResourceDefinition, error)
UpdateCRD updates the existing crd
func (*Client) ValidateCRD ¶
func (c *Client) ValidateCRD(resource CustomResource, timeout, retryInterval time.Duration) error
ValidateCRD checks if the given CRD is registered
type CustomResource ¶
type CustomResource struct { // Name of the custom resource Name string // ShortNames are short names for the resource. It must be all lowercase. ShortNames []string // Plural of the custom resource in plural Plural string // Group the custom resource belongs to Group string // Version which should be defined in a const above Version string // Scope of the CRD. Namespaced or cluster Scope apiextensionsv1beta1.ResourceScope // Kind is the serialized interface of the resource. Kind string }
CustomResource is for creating a Kubernetes TPR/CRD
type Ops ¶
type Ops interface { CRDOps // SetConfig sets the config and resets the client. SetConfig(config *rest.Config) }
Ops is an interface to perform kubernetes related operations on the crd resources.
func NewInstanceFromConfigFile ¶
NewInstanceFromConfigFile returns new instance of client by using given config file