Documentation
¶
Overview ¶
Package apply server-side-applies arbitrary unstructured Kubernetes objects from the CLI. Used by deploy to push the four platform CRs after the operator chart is installed.
Server-side apply is preferred over kubectl-style client-side apply: it converges multiple CLI runs cleanly, surfaces conflict errors with the field-owning manager, and matches how the operator itself writes back to .status (so co-ownership of .spec stays clean).
Index ¶
- Constants
- type Client
- func (c *Client) Apply(ctx context.Context, obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
- func (c *Client) Delete(ctx context.Context, gvk schema.GroupVersionKind, namespace, name string) error
- func (c *Client) Get(ctx context.Context, gvk schema.GroupVersionKind, namespace, name string) (*unstructured.Unstructured, error)
- func (c *Client) InvalidateDiscovery()
Constants ¶
const FieldManager = "educates-cli"
FieldManager is the SSA owner the CLI claims for fields it sets.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps dynamic.Interface + RESTMapper for server-side apply. One Client per `educates admin platform deploy` run.
func New ¶
func New(getter genericclioptions.RESTClientGetter) (*Client, error)
New builds a Client from a kubectl-style RESTClientGetter.
func (*Client) Apply ¶
func (c *Client) Apply(ctx context.Context, obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
Apply server-side-applies one Unstructured. force=true so re-runs after the operator stamps defaults into .spec don't deadlock on field conflicts the operator caused.
func (*Client) Delete ¶
func (c *Client) Delete(ctx context.Context, gvk schema.GroupVersionKind, namespace, name string) error
Delete removes one object by GVK + name. Idempotent: missing → nil.
func (*Client) Get ¶
func (c *Client) Get(ctx context.Context, gvk schema.GroupVersionKind, namespace, name string) (*unstructured.Unstructured, error)
Get returns the live object for a GVK + name, or NotFound. Used by callers that need to poll a status field (e.g. CRD Established) without also pulling in the wait package.
func (*Client) InvalidateDiscovery ¶
func (c *Client) InvalidateDiscovery()
InvalidateDiscovery clears the cached discovery snapshot and resets the deferred mapper. Call this after applying CRDs so the next RESTMapping lookup re-fetches `/apis` and picks up the newly registered kinds. Without it, the mapper's reset-on-NoMatchError retry path rebuilds from the same stale cache and the new GVK stays invisible.