Documentation ¶
Index ¶
- func LoadObjectsFromFilesystem(p string) ([]*unstructured.Unstructured, error)
- func ParseObjects(r io.Reader) ([]*unstructured.Unstructured, error)
- func RunPlan(ctx context.Context, opt *PlanOptions) error
- type Action
- type ActionType
- type ClusterTarget
- type FieldDiff
- type FieldPath
- type ObjectDiff
- type Plan
- type PlanOptions
- type PlanSpec
- type Planner
- type PrettyPrintOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadObjectsFromFilesystem ¶
func LoadObjectsFromFilesystem(p string) ([]*unstructured.Unstructured, error)
LoadObjectsFromFilesystem parses yaml objects from the provided directory or file path.
func ParseObjects ¶
func ParseObjects(r io.Reader) ([]*unstructured.Unstructured, error)
ParseObjects parses yaml objects from the provided reader.
Types ¶
type Action ¶
type Action struct { Type ActionType `json:"action,omitempty"` APIVersion string `json:"apiVersion,omitempty"` Kind string `json:"kind,omitempty"` Name string `json:"name,omitempty"` Namespace string `json:"namespace,omitempty"` Object *unstructured.Unstructured `json:"object,omitempty"` Diff *ObjectDiff `json:"diff,omitempty"` }
Action represents an individual object change.
type ActionType ¶
type ActionType string
ActionType is an enum type for the type of change (no-change/create/update etc).
const ( ActionTypeUnchanged ActionType = "Unchanged" ActionTypeCreate ActionType = "Create" ActionTypeApplyChanges ActionType = "ApplyChanges" ActionTypeError ActionType = "Error" )
type ClusterTarget ¶
type ClusterTarget struct {
// contains filtered or unexported fields
}
ClusterTarget supports actions against a running kubernetes cluster.
func NewClusterTarget ¶
func (*ClusterTarget) ResourceForGVK ¶
func (c *ClusterTarget) ResourceForGVK(ctx context.Context, gvk schema.GroupVersionKind) (*clusterResourceTarget, error)
ResourceForGVK gets the GVR / Scope for the specified object.
type ObjectDiff ¶
type ObjectDiff struct { OldObject *unstructured.Unstructured `json:"oldObject,omitempty"` Fields []FieldDiff `json:"fields,omitempty"` }
func BuildObjectDiff ¶
func BuildObjectDiff(oldObj, newObj *unstructured.Unstructured) (*ObjectDiff, error)
func (*ObjectDiff) PrettyPrintTo ¶
func (d *ObjectDiff) PrettyPrintTo(newObject *unstructured.Unstructured, options PrettyPrintOptions, out io.Writer) error
func (*ObjectDiff) PrintStructuredTo ¶
func (d *ObjectDiff) PrintStructuredTo(out io.Writer)
type Plan ¶
Plan stores the expected changes when applying changes to a cluster. For consistency, we represent it as a KRM object, but we don't expect it to be applied to a cluster.
type PlanOptions ¶
type PlanOptions struct { Out io.Writer Objects []*unstructured.Unstructured RESTConfig *rest.Config HTTPClient *http.Client }
PlanOptions holds options for a plan operation.
type PlanSpec ¶
type PlanSpec struct {
Actions []Action `json:"actions,omitempty"`
}
PlanSpec is the Spec for a Plan object.
type Planner ¶
type Planner struct { }
Planner holds the core planning logic and state.
func (*Planner) BuildPlan ¶
func (r *Planner) BuildPlan(ctx context.Context, objects []*unstructured.Unstructured, target *ClusterTarget) (*Plan, error)
BuildPlan is the entry point for building a plan.