Documentation ¶
Overview ¶
Package resources implement the interface for accessing kubernetes resources
Index ¶
- type Client
- func (c *Client) Apply(manifest string) error
- func (c *Client) Create(obj map[string]interface{}) (map[string]interface{}, error)
- func (c *Client) Delete(kind string, name string, namespace string) error
- func (c *Client) Get(kind string, name string, namespace string) (map[string]interface{}, error)
- func (c *Client) List(kind string, namespace string) ([]map[string]interface{}, error)
- func (c *Client) Structured() StructuredOperations
- func (c *Client) Update(obj map[string]interface{}) (map[string]interface{}, error)
- func (c *Client) WithMapper(mapper meta.RESTMapper) *Client
- type StructuredOperations
- type UnstructuredOperations
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds the state to access kubernetes
func NewFromClient ¶
NewFromClient creates a new client from a dynamic Kubernetes client
func NewFromConfig ¶
NewFromConfig creates a new Client using the provided kubernetes client configuration
func (*Client) Create ¶
Create creates a resource in a kubernetes cluster from an object with its specification
func (*Client) Structured ¶
func (c *Client) Structured() StructuredOperations
Structured returns a reference to a StructuredOperations interface
func (*Client) Update ¶
Update updates a resource in a kubernetes cluster from an object with its specification
func (*Client) WithMapper ¶ added in v0.3.0
func (c *Client) WithMapper(mapper meta.RESTMapper) *Client
WithMapper specifies the RESTMapper for the client to utilize
type StructuredOperations ¶
type StructuredOperations interface { // Create creates a resource described in the runtime object given as input and returns the resource created. // The resource must be passed by value (e.g corev1.Pod) and a value (not a reference) will be returned Create(obj interface{}) (interface{}, error) // Delete deletes a resource given its kind, name and namespace Delete(kind string, name string, namespace string) error // Get retrieves a resource into the given placeholder given its kind, name and namespace Get(kind string, name string, namespace string, obj interface{}) error // List retrieves a list of resources in the given slice given their kind and namespace List(kind string, namespace string, list interface{}) error // Update updates an existing resource and returns the updated version // The resource must be passed by value (e.g corev1.Pod) and a value (not a reference) will be returned Update(obj interface{}) (interface{}, error) }
StructuredOperations defines generic operations that handles runtime objects such as corev1.Pod. It facilitates handling objects in the situations where their type is known as opposed to the UnstructuredOperations
type UnstructuredOperations ¶
type UnstructuredOperations interface { Apply(manifest string) error Create(obj map[string]interface{}) (map[string]interface{}, error) Delete(kind string, name string, namespace string) error Get(kind string, name string, namespace string) (map[string]interface{}, error) List(kind string, namespace string) ([]map[string]interface{}, error) Update(obj map[string]interface{}) (map[string]interface{}, error) }
UnstructuredOperations defines generic functions that operate on any kind of Kubernetes object