dryrun

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2022 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiffEntry

type DiffEntry struct {
	Name     string               `json:"name"`
	Kind     ManifestKind         `json:"kind"`
	DiffType DiffType             `json:"diffType,omitempty"`
	Diffs    []difflib.DiffRecord `json:"diffs,omitempty"`
	Subs     []*DiffEntry         `json:"subs,omitempty"`
}

DiffEntry records diff info of OAM object

type DiffType

type DiffType string

DiffType enums the type of diff

const (
	AddDiff    DiffType = "ADD"
	ModifyDiff DiffType = "MODIFY"
	RemoveDiff DiffType = "REMOVE"
	NoDiff     DiffType = ""
)

enum types of diff

type DryRun

type DryRun interface {
	ExecuteDryRun(ctx context.Context, app *v1beta1.Application) ([]*types.ComponentManifest, error)
}

DryRun executes dry-run on an application

type LiveDiffObject

type LiveDiffObject struct {
	*v1beta1.Application
	*v1beta1.ApplicationRevision
}

LiveDiffObject wraps the objects for diff

type LiveDiffOption

type LiveDiffOption struct {
	DryRun
	Parser *appfile.Parser
}

LiveDiffOption contains options for comparing an application with a living AppRevision in the cluster

func NewLiveDiffOption

NewLiveDiffOption creates a live-diff option

func (*LiveDiffOption) Diff

Diff does three phases, dry-run on input app, preparing manifest for diff, and calculating diff on manifests.

func (*LiveDiffOption) DiffApps

func (l *LiveDiffOption) DiffApps(ctx context.Context, app *v1beta1.Application, oldApp *v1beta1.Application) (*DiffEntry, error)

DiffApps does three phases, dry-run on input app, preparing manifest for diff, and calculating diff on manifests.

func (*LiveDiffOption) RenderlessDiff

func (l *LiveDiffOption) RenderlessDiff(ctx context.Context, base, comparor LiveDiffObject) (*DiffEntry, error)

RenderlessDiff will not compare the rendered component results but only compare the application spec and original external dependency objects such as external workflow/policies

type ManifestKind

type ManifestKind string

ManifestKind enums the kind of OAM objects

const (
	AppKind           ManifestKind = "Application"
	AppConfigCompKind ManifestKind = "AppConfigComponent"
	RawCompKind       ManifestKind = "Component"
	TraitKind         ManifestKind = "Trait"
	PolicyKind        ManifestKind = "Policy"
	WorkflowKind      ManifestKind = "Workflow"
	ReferredObject    ManifestKind = "ReferredObject"
)

enum kinds of manifest objects

type Option

type Option struct {
	Client          client.Client
	DiscoveryMapper discoverymapper.DiscoveryMapper
	PackageDiscover *packages.PackageDiscover

	// Auxiliaries are capability definitions used to parse application.
	// DryRun will use capabilities in Auxiliaries as higher priority than
	// getting one from cluster.
	Auxiliaries []oam.Object
	// contains filtered or unexported fields
}

Option contains options to execute dry-run

func NewDryRunOption

NewDryRunOption creates a dry-run option

func (*Option) ExecuteDryRun

func (d *Option) ExecuteDryRun(ctx context.Context, app *v1beta1.Application) ([]*types.ComponentManifest, error)

ExecuteDryRun simulates applying an application into cluster and returns rendered resources but not persist them into cluster.

func (*Option) ValidateApp

func (d *Option) ValidateApp(ctx context.Context, filename string) error

ValidateApp will validate app with client schema check and server side dry-run

type ReportDiffOption

type ReportDiffOption struct {
	DiffMsgs map[DiffType]string
	Context  int
	To       io.Writer
}

ReportDiffOption contains options to formats and prints diff report

func NewReportDiffOption

func NewReportDiffOption(ctx int, to io.Writer) *ReportDiffOption

NewReportDiffOption creats a new ReportDiffOption that can formats and prints diff report into an io.Writer

func (*ReportDiffOption) PrintDiffReport

func (r *ReportDiffOption) PrintDiffReport(diff *DiffEntry)

PrintDiffReport formats and prints diff data into target io.Writer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL