Documentation ¶
Index ¶
- Constants
- func CreateJinghzhuClientset(kubeconfigPath string) (*jinghzhuv1apisclientset.Clientset, error)
- type Client
- func (c *Client) Create(obj *jinghzhuv1.Jinghzhu) (*jinghzhuv1.Jinghzhu, error)
- func (c *Client) Delete(name string, opts *metav1.DeleteOptions) error
- func (c *Client) Get(name string, opts metav1.GetOptions) (*jinghzhuv1.Jinghzhu, error)
- func (c *Client) GetNamespace() string
- func (c *Client) GetPlural() string
- func (c *Client) GetWithoutOps(name string) (*jinghzhuv1.Jinghzhu, error)
- func (c *Client) List(opts metav1.ListOptions) (*jinghzhuv1.JinghzhuList, error)
- func (c *Client) Patch(name string, pt apimachinerytypes.PatchType, data []byte, ...) (*jinghzhuv1.Jinghzhu, error)
- func (c *Client) PatchJSONType(name string, ops []PatchJSONTypeOps) (*jinghzhuv1.Jinghzhu, error)
- func (c *Client) PatchSpec(name string, jinghzhuSpec *jinghzhuv1.JinghzhuSpec) (*jinghzhuv1.Jinghzhu, error)
- func (c *Client) PatchSpecAndStatus(name string, jinghzhuSpec *jinghzhuv1.JinghzhuSpec, ...) (*jinghzhuv1.Jinghzhu, error)
- func (c *Client) PatchStatus(name string, jinghzhuStatus *jinghzhuv1.JinghzhuStatus) (*jinghzhuv1.Jinghzhu, error)
- func (c *Client) Update(obj *jinghzhuv1.Jinghzhu) (*jinghzhuv1.Jinghzhu, error)
- func (c *Client) UpdateSpecAndStatus(name string, jinghzhuSpec *jinghzhuv1.JinghzhuSpec, ...) (*jinghzhuv1.Jinghzhu, error)
- func (c *Client) WaitForInstanceProcessed(name string) error
- type PatchJSONTypeOps
Constants ¶
const ( PatchJSONTypeReplace string = "replace" PatchJSONTypeAdd string = "add" )
Variables ¶
This section is empty.
Functions ¶
func CreateJinghzhuClientset ¶
func CreateJinghzhuClientset(kubeconfigPath string) (*jinghzhuv1apisclientset.Clientset, error)
CreateJinghzhuClientset returns the clientset for CRD Jinghzhu v1 in singleton way.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an API client to help perform CRUD for CRD instances.
func GetDefaultClient ¶
func GetDefaultClient() *Client
GetDefaultClient returns an API client interface for CRD Jinghzhu v1. It assumes the kubeconfig is available at default path and the target CRD namespace is the default namespace.
func NewClient ¶
NewClient accepts kubeconfig path and namespace. Return the API client interface for CRD Jinghzhu v1.
func (*Client) Create ¶
func (c *Client) Create(obj *jinghzhuv1.Jinghzhu) (*jinghzhuv1.Jinghzhu, error)
Create post an instance of CRD into Kubernetes.
func (*Client) Delete ¶
func (c *Client) Delete(name string, opts *metav1.DeleteOptions) error
Delete removes the CRD instance by given name and delete options.
func (*Client) Get ¶
func (c *Client) Get(name string, opts metav1.GetOptions) (*jinghzhuv1.Jinghzhu, error)
Get returns a pointer to the CRD instance.
func (*Client) GetNamespace ¶
GetNamespace returns the namespace the client talks to.
func (*Client) GetWithoutOps ¶
func (c *Client) GetWithoutOps(name string) (*jinghzhuv1.Jinghzhu, error)
GetWithoutOps retrieves the Jinghzhu instance without any GetOptions.
func (*Client) List ¶
func (c *Client) List(opts metav1.ListOptions) (*jinghzhuv1.JinghzhuList, error)
List returns a list of CRD instances by given list options.
func (*Client) Patch ¶
func (c *Client) Patch(name string, pt apimachinerytypes.PatchType, data []byte, subresources ...string) (*jinghzhuv1.Jinghzhu, error)
Patch applies the patch and returns the patched Jinghzhu v1 instance.
func (*Client) PatchJSONType ¶
func (c *Client) PatchJSONType(name string, ops []PatchJSONTypeOps) (*jinghzhuv1.Jinghzhu, error)
PatchJSONType uses JSON Type (RFC6902) in PATCH.
func (*Client) PatchSpec ¶
func (c *Client) PatchSpec(name string, jinghzhuSpec *jinghzhuv1.JinghzhuSpec) (*jinghzhuv1.Jinghzhu, error)
PatchSpec only updates the spec field of Jinghzhu v1, which is /spec.
func (*Client) PatchSpecAndStatus ¶
func (c *Client) PatchSpecAndStatus( name string, jinghzhuSpec *jinghzhuv1.JinghzhuSpec, jinghzhuStatus *jinghzhuv1.JinghzhuStatus, ) (*jinghzhuv1.Jinghzhu, error)
PatchSpecAndStatus performs patch for both spec and status field of Jinghzhu.
func (*Client) PatchStatus ¶
func (c *Client) PatchStatus(name string, jinghzhuStatus *jinghzhuv1.JinghzhuStatus) (*jinghzhuv1.Jinghzhu, error)
PatchStatus only updates the status field of Jinghzhu v1, which is /status.
func (*Client) Update ¶
func (c *Client) Update(obj *jinghzhuv1.Jinghzhu) (*jinghzhuv1.Jinghzhu, error)
Update puts new instance of CRD to replace the old one.
func (*Client) UpdateSpecAndStatus ¶
func (c *Client) UpdateSpecAndStatus(name string, jinghzhuSpec *jinghzhuv1.JinghzhuSpec, jinghzhuStatus *jinghzhuv1.JinghzhuStatus) (*jinghzhuv1.Jinghzhu, error)
UpdateSpecAndStatus updates the spec and status filed of Jinghzhu v1. If only want to update some sub-resource, please use Patch instead.
func (*Client) WaitForInstanceProcessed ¶
WaitForInstanceProcessed is used for monitor the creation of a CRD instance.
type PatchJSONTypeOps ¶
type PatchJSONTypeOps struct { Op string `json:"op"` Path string `json:"path"` Value interface{} `json:"value"` }
PatchJSONTypeOps describes the operations for PATCH defined in RFC6902. https://tools.ietf.org/html/rfc6902 The supported operations are: add, remove, replace, move, copy and test. When we news a Jinghzhu instance, we'll set defatule value for all fields. So, when you want to patch a Jinghzhu, DO NOT use remove. Please use replace, even if you want to keey that field "empty". Example:
things := make([]IntThingSpec, 2) things[0].Op = "replace" things[0].Path = "/status/message" things[0].Value = "1234" things[1].Op = "replace" things[1].Path = "/status/state" things[1].Value = ""