Documentation ¶
Index ¶
- Constants
- func CreateJinghzhuClientset(kubeconfigPath string) (*jinghzhuv1apisclientset.Clientset, error)
- type Client
- func (c *Client) Create(obj *jinghzhuv1.Jinghzhu, opts metav1.CreateOptions) (*jinghzhuv1.Jinghzhu, error)
- func (c *Client) CreateDefault(obj *jinghzhuv1.Jinghzhu) (*jinghzhuv1.Jinghzhu, error)
- func (c *Client) Delete(name string, opts metav1.DeleteOptions) error
- func (c *Client) DeleteDefault(name string) error
- func (c *Client) Get(name string, opts metav1.GetOptions) (*jinghzhuv1.Jinghzhu, error)
- func (c *Client) GetContext() context.Context
- func (c *Client) GetDefault(name string) (*jinghzhuv1.Jinghzhu, error)
- func (c *Client) GetNamespace() string
- func (c *Client) GetPlural() string
- func (c *Client) List(opts metav1.ListOptions) (*jinghzhuv1.JinghzhuList, error)
- func (c *Client) ListDefaultDefault() (*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, opts metav1.UpdateOptions) (*jinghzhuv1.Jinghzhu, error)
- func (c *Client) UpdateDefault(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, opts metav1.CreateOptions) (*jinghzhuv1.Jinghzhu, error)
Create post an instance of CRD into Kubernetes with given create options.
func (*Client) CreateDefault ¶ added in v1.18.0
func (c *Client) CreateDefault(obj *jinghzhuv1.Jinghzhu) (*jinghzhuv1.Jinghzhu, error)
CreateDefault post an instance of CRD into Kubernetes without create options.
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) DeleteDefault ¶ added in v1.18.0
DeleteDefault removes the CRD instance without 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) GetContext ¶ added in v1.18.0
GetContext returns the context of client.
func (*Client) GetDefault ¶ added in v1.18.0
func (c *Client) GetDefault(name string) (*jinghzhuv1.Jinghzhu, error)
GetDefault retrieves the crd instance without get options.
func (*Client) GetNamespace ¶
GetNamespace returns the namespace the client talks to.
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) ListDefaultDefault ¶ added in v1.18.0
func (c *Client) ListDefaultDefault() (*jinghzhuv1.JinghzhuList, error)
ListDefaultDefault returns a list of CRD instances without 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, opts metav1.UpdateOptions) (*jinghzhuv1.Jinghzhu, error)
Update puts new instance of CRD to replace the old one by given update options.
func (*Client) UpdateDefault ¶ added in v1.18.0
func (c *Client) UpdateDefault(obj *jinghzhuv1.Jinghzhu) (*jinghzhuv1.Jinghzhu, error)
UpdateDefault puts new instance of CRD to replace the old one without update options.
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 CRD. 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 default value for all fields. So, when you want to patch a Jinghzhu, DO NOT use remove. Please use replace, even if you want to keep 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 = ""