Documentation
¶
Index ¶
- func AddToschema(schema *runtime.Scheme)
- func Apply[T client.Object](ctx context.Context, config *rest.Config, resources []T, options ...Option) error
- func AutoClientConfig() (*rest.Config, error)
- func CreateByYamlOrJson(ctx context.Context, cfg *rest.Config, yamlOrJson []byte) error
- func CreatePatchContent(origin, modified interface{}) ([]byte, error)
- func DeleteByYamlOrJson(ctx context.Context, cfg *rest.Config, yamlOrJson []byte) error
- func GetKubeClient(kubeconfig []byte) (*rest.Config, *kubernetes.Clientset, error)
- func GetKubeRestConfig(kubeconfig []byte) (*rest.Config, error)
- func GetKubeconfigInfos(kubeconfig []byte) (apiserver string, cert, key, ca []byte, err error)
- func GetScheme() *runtime.Scheme
- func NewClient(config *rest.Config) (client.Client, error)
- func ParseResource(raw []byte) ([]*unstructured.Unstructured, error)
- func Remove[T client.Object](ctx context.Context, config *rest.Config, resources []T, options ...Option) error
- type JsonPatchType
- type NoopClient
- func (NoopClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
- func (NoopClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
- func (NoopClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
- func (NoopClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error
- func (NoopClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
- func (NoopClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, ...) error
- func (NoopClient) RESTMapper() meta.RESTMapper
- func (NoopClient) Scheme() *runtime.Scheme
- func (c NoopClient) Status() client.StatusWriter
- func (NoopClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddToschema ¶
func AddToschema(schema *runtime.Scheme)
func Apply ¶
func Apply[T client.Object](ctx context.Context, config *rest.Config, resources []T, options ...Option) error
func AutoClientConfig ¶
func AutoClientConfig() (*rest.Config, error)
AutoClientConfig 自动获取当前环境 restConfig 1. 先尝试使用InClusterConfig, 2. 若不存在则使用 ~/.kube/config, 3. 否不存在则失败
func CreateByYamlOrJson ¶
func CreateByYamlOrJson(ctx context.Context, cfg *rest.Config, yamlOrJson []byte) error
func CreatePatchContent ¶
func CreatePatchContent(origin, modified interface{}) ([]byte, error)
func DeleteByYamlOrJson ¶
func DeleteByYamlOrJson(ctx context.Context, cfg *rest.Config, yamlOrJson []byte) error
func GetKubeClient ¶
func GetKubeClient(kubeconfig []byte) (*rest.Config, *kubernetes.Clientset, error)
func GetKubeRestConfig ¶
func GetKubeRestConfig(kubeconfig []byte) (*rest.Config, error)
func GetKubeconfigInfos ¶
func GetKubeconfigInfos(kubeconfig []byte) (apiserver string, cert, key, ca []byte, err error)
func ParseResource ¶
func ParseResource(raw []byte) ([]*unstructured.Unstructured, error)
Types ¶
type JsonPatchType ¶
type JsonPatchType struct {
From client.Object
}
type NoopClient ¶ added in v1.22.0
type NoopClient struct{}
func (NoopClient) Create ¶ added in v1.22.0
func (NoopClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
Create saves the object obj in the Kubernetes cluster.
func (NoopClient) Delete ¶ added in v1.22.0
func (NoopClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
Delete deletes the given obj from Kubernetes cluster.
func (NoopClient) DeleteAllOf ¶ added in v1.22.0
func (NoopClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
DeleteAllOf deletes all objects of the given type matching the given options.
func (NoopClient) Get ¶ added in v1.22.0
func (NoopClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error
Get retrieves an obj for the given object key from the Kubernetes Cluster. obj must be a struct pointer so that obj can be updated with the response returned by the Server.
func (NoopClient) List ¶ added in v1.22.0
func (NoopClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
List retrieves list of objects for a given namespace and list options. On a successful call, Items field in the list will be populated with the result returned from the server.
func (NoopClient) Patch ¶ added in v1.22.0
func (NoopClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error
Patch patches the given obj in the Kubernetes cluster. obj must be a struct pointer so that obj can be updated with the content returned by the Server.
func (NoopClient) RESTMapper ¶ added in v1.22.0
func (NoopClient) RESTMapper() meta.RESTMapper
RESTMapper returns the rest this client is using.
type Option ¶
type Option func(*Options)
func WithCreateNamespace ¶
func WithCreateNamespace() Option