Documentation
¶
Index ¶
- func ParseStatusError(err error) error
- type APIError
- type NamespacedClient
- func (c *NamespacedClient) Apply(ctx context.Context, desc resources.Descriptor, name string, ...) (*unstructured.Unstructured, error)
- func (c *NamespacedClient) Create(ctx context.Context, desc resources.Descriptor, obj *unstructured.Unstructured, ...) (*unstructured.Unstructured, error)
- func (c *NamespacedClient) Delete(ctx context.Context, desc resources.Descriptor, name string, ...) error
- func (c *NamespacedClient) Get(ctx context.Context, desc resources.Descriptor, name string, ...) (*unstructured.Unstructured, error)
- func (c *NamespacedClient) GetMultiple(ctx context.Context, desc resources.Descriptor, names []string, ...) ([]unstructured.Unstructured, error)
- func (c *NamespacedClient) List(ctx context.Context, desc resources.Descriptor, opts metav1.ListOptions) (*unstructured.UnstructuredList, error)
- func (c *NamespacedClient) Update(ctx context.Context, desc resources.Descriptor, obj *unstructured.Unstructured, ...) (*unstructured.Unstructured, error)
- type VersionedClient
- func (c *VersionedClient) Get(ctx context.Context, desc resources.Descriptor, name string, ...) (*unstructured.Unstructured, error)
- func (c *VersionedClient) GetMultiple(ctx context.Context, desc resources.Descriptor, names []string, ...) ([]unstructured.Unstructured, error)
- func (c *VersionedClient) List(ctx context.Context, desc resources.Descriptor, opts metav1.ListOptions) (*unstructured.UnstructuredList, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseStatusError ¶
ParseStatusError parses a Kubernetes API status from an error.
Types ¶
type APIError ¶
type APIError struct {
// contains filtered or unexported fields
}
APIError is an error that wraps a Kubernetes API status. It formats the error message in a more readable format (since Kubernetes natively will only log the message, which could sometimes be simply "unknown").
type NamespacedClient ¶
type NamespacedClient struct {
// contains filtered or unexported fields
}
NamespacedClient is a dynamic client with a namespace and a discovery registry.
func NewDefaultNamespacedClient ¶
func NewDefaultNamespacedClient(cfg config.NamespacedRESTConfig) (*NamespacedClient, error)
NewDefaultNamespacedClient creates a new namespaced dynamic client using the default discovery registry.
func NewNamespacedClient ¶
func NewNamespacedClient(namespace string, client dynamic.Interface) *NamespacedClient
NewNamespacedClient creates a new namespaced dynamic client.
func (*NamespacedClient) Apply ¶
func (c *NamespacedClient) Apply( ctx context.Context, desc resources.Descriptor, name string, obj *unstructured.Unstructured, opts metav1.ApplyOptions, ) (*unstructured.Unstructured, error)
Apply applies a resource on the server.
func (*NamespacedClient) Create ¶
func (c *NamespacedClient) Create( ctx context.Context, desc resources.Descriptor, obj *unstructured.Unstructured, opts metav1.CreateOptions, ) (*unstructured.Unstructured, error)
Create creates a resource on the server.
func (*NamespacedClient) Delete ¶
func (c *NamespacedClient) Delete( ctx context.Context, desc resources.Descriptor, name string, opts metav1.DeleteOptions, ) error
Delete deletes a resource on the server.
func (*NamespacedClient) Get ¶
func (c *NamespacedClient) Get( ctx context.Context, desc resources.Descriptor, name string, opts metav1.GetOptions, ) (*unstructured.Unstructured, error)
Get gets a resource from the server.
func (*NamespacedClient) GetMultiple ¶
func (c *NamespacedClient) GetMultiple( ctx context.Context, desc resources.Descriptor, names []string, opts metav1.GetOptions, ) ([]unstructured.Unstructured, error)
GetMultiple gets multiple resources from the server.
Kubernetes does not support getting multiple resources by name, so instead we list all resources and filter on the client side.
Ideally we'd like to use field selectors, but Kubernetes does not support set-based operators in field selectors (only in labels).
func (*NamespacedClient) List ¶
func (c *NamespacedClient) List( ctx context.Context, desc resources.Descriptor, opts metav1.ListOptions, ) (*unstructured.UnstructuredList, error)
List lists resources from the server.
When opts.Limit > 0, a single direct API call is made and the response (including its Continue token) is returned as-is. This enables callers to detect truncated results and display pagination hints.
When opts.Limit == 0, the client-go pager fetches all pages transparently.
func (*NamespacedClient) Update ¶
func (c *NamespacedClient) Update( ctx context.Context, desc resources.Descriptor, obj *unstructured.Unstructured, opts metav1.UpdateOptions, ) (*unstructured.Unstructured, error)
Update updates a resource on the server.
type VersionedClient ¶
type VersionedClient struct {
*NamespacedClient
}
VersionedClient is a dynamic client that supports automatic version switching. It will automatically switch to the correct version of the resource based on the stored version.
func NewDefaultVersionedClient ¶
func NewDefaultVersionedClient(cfg config.NamespacedRESTConfig) (*VersionedClient, error)
NewDefaultVersionedClient creates a new versioned client using the default namespaced client.
func WrapNamespacedClient ¶
func WrapNamespacedClient(client *NamespacedClient) *VersionedClient
WrapNamespacedClient wraps a namespaced client in a versioned client.
func (*VersionedClient) Get ¶
func (c *VersionedClient) Get( ctx context.Context, desc resources.Descriptor, name string, opts metav1.GetOptions, ) (*unstructured.Unstructured, error)
Get gets a resource from the server.
func (*VersionedClient) GetMultiple ¶
func (c *VersionedClient) GetMultiple( ctx context.Context, desc resources.Descriptor, names []string, opts metav1.GetOptions, ) ([]unstructured.Unstructured, error)
GetMultiple gets multiple resources from the server. It will automatically re-fetch resources which need to be fetched using the stored version.
func (*VersionedClient) List ¶
func (c *VersionedClient) List( ctx context.Context, desc resources.Descriptor, opts metav1.ListOptions, ) (*unstructured.UnstructuredList, error)
List lists resources from the server. It will automatically re-fetch resources which need to be fetched using the stored version.