apiextensions

package
v1.20.4-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 12 Imported by: 37

Documentation

Index

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

New builds a new apiextensions client.

func NewForConfig

func NewForConfig(c *rest.Config) (*Client, error)

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) DeleteCRD

func (c *Client) DeleteCRD(fullName string) error

DeleteCRD deletes the CRD for the given complete name (plural.group)

func (*Client) GetCRD

GetCRD returns a crd by name

func (*Client) ListCRDs

ListCRDs list all CRD resources

func (*Client) RegisterCRD

RegisterCRD creates the given custom resource

func (*Client) SetConfig

func (c *Client) SetConfig(cfg *rest.Config)

SetConfig sets the config and resets the client.

func (*Client) UpdateCRD

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 Instance

func Instance() Ops

Instance returns a singleton instance of the client.

func NewInstanceFromConfigFile

func NewInstanceFromConfigFile(config string) (Ops, error)

NewInstanceFromConfigFile returns new instance of client by using given config file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL