Documentation ¶
Overview ¶
Package dryrun implements clusterctl dryrun functionality.
Index ¶
- type ChangeSummary
- type Client
- func (c *Client) Changes(ctx context.Context) (*ChangeSummary, error)
- func (c *Client) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
- func (c *Client) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
- func (c *Client) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
- func (c *Client) Get(ctx context.Context, key client.ObjectKey, obj client.Object, ...) error
- func (c *Client) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
- func (c *Client) Patch(ctx context.Context, obj client.Object, patch client.Patch, ...) error
- func (c *Client) RESTMapper() meta.RESTMapper
- func (c *Client) Scheme() *runtime.Scheme
- func (c *Client) Status() client.StatusWriter
- func (c *Client) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
- type PatchSummary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeSummary ¶
type ChangeSummary struct { // Created is the list of objects that are created during the dry run execution. Created []*unstructured.Unstructured // Modified is the list of summary of objects that are modified (Updated, Patched and/or deleted and re-created) during the dry run execution. Modified []*PatchSummary // Deleted is the list of objects that are deleted during the dry run execution. Deleted []*unstructured.Unstructured }
ChangeSummary defines all the changes detected by the Dryrun execution. Nb. Only a single operation is reported for each object, flattening operations to show difference between the initial and final states.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements a dry run Client, that is a fake.Client that logs write operations.
func NewClient ¶
NewClient returns a new dry run Client. A dry run client mocks interactions with an api server using a fake internal object tracker. The objects passed will be used to initialize the fake internal object tracker when creating a new dry run client. If an apiReader client is passed the dry run client will use it as a fall back client for read operations (Get, List) when the objects are not found in the internal object tracker. Typically the apiReader passed would be a reader client to a real Kubernetes Cluster.
func (*Client) Changes ¶
func (c *Client) Changes(ctx context.Context) (*ChangeSummary, error)
Changes generates a summary of all the changes observed from the creation of the dry run client to when this function is called.
func (*Client) Delete ¶
Delete deletes the given obj from internal object tracker. Delete will not affect objects in the Kubernetes Cluster.
func (*Client) DeleteAllOf ¶
func (c *Client) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
DeleteAllOf deletes all objects of the given type matching the given options. NOTE: Topology reconciler does not use DeleteAllOf, so we are skipping implementation for now.
func (*Client) Get ¶
func (c *Client) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error
Get retrieves an object for the given object key from the internal object tracker. If the object does not exist in the internal object tracker it tries to fetch the object from the Kubernetes Cluster using the apiReader client (if apiReader is not nil).
func (*Client) List ¶
func (c *Client) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
List retrieves list of objects for a given namespace and list options. List function returns the union of the lists from the internal object tracker and the Kubernetes Cluster. Nb. For objects that exist both in the internal object tracker and the Kubernetes Cluster, internal object tracker takes precedence.
func (*Client) Patch ¶
func (c *Client) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error
Patch patches the given obj in the internal object tracker. The patch operation will be tracked if the object does not exist in the internal object tracker but exists in the Kubernetes Cluster.
func (*Client) RESTMapper ¶
func (c *Client) RESTMapper() meta.RESTMapper
RESTMapper returns the rest this client is using.
func (*Client) Status ¶
func (c *Client) Status() client.StatusWriter
Status returns a client which can update the status subresource for Kubernetes objects.
type PatchSummary ¶
type PatchSummary struct { // Initial state of the object. Before *unstructured.Unstructured // Final state of the object. After *unstructured.Unstructured }
PatchSummary defines the patch observed on an object.