dryrun

package
v0.0.0-...-2c539bb Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

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 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.

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"
)

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
}

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.

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(app *DiffEntry)

PrintDiffReport formats and prints diff data into target io.Writer 'app' should be a diifEntry whose top-level is an application

Jump to

Keyboard shortcuts

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