Documentation ¶
Index ¶
- type DiffEntry
- type DiffType
- type DryRun
- type GenerateAppFileFunc
- type LiveDiffObject
- type LiveDiffOption
- func (l *LiveDiffOption) Diff(ctx context.Context, app *v1beta1.Application, ...) (*DiffEntry, error)
- func (l *LiveDiffOption) DiffApps(ctx context.Context, app *v1beta1.Application, oldApp *v1beta1.Application) (*DiffEntry, error)
- func (l *LiveDiffOption) RenderlessDiff(ctx context.Context, base, comparor LiveDiffObject) (*DiffEntry, error)
- type ManifestKind
- type Option
- func (d *Option) ExecuteDryRun(ctx context.Context, application *v1beta1.Application) ([]*types.ComponentManifest, []*unstructured.Unstructured, error)
- func (d *Option) ExecuteDryRunWithPolicies(ctx context.Context, application *v1beta1.Application, buff *bytes.Buffer) error
- func (d *Option) PrintDryRun(buff *bytes.Buffer, appName string, comps []*types.ComponentManifest, ...) error
- func (d *Option) ValidateApp(ctx context.Context, filename string) error
- type ReportDiffOption
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 DryRun ¶
type DryRun interface {
ExecuteDryRun(ctx context.Context, app *v1beta1.Application) ([]*types.ComponentManifest, []*unstructured.Unstructured, error)
}
DryRun executes dry-run on an application
type GenerateAppFileFunc ¶ added in v1.8.0
type GenerateAppFileFunc func(ctx context.Context, app *v1beta1.Application) (*appfile.Appfile, error)
GenerateAppFileFunc generate the app file model from an application
type LiveDiffObject ¶
type LiveDiffObject struct { *v1beta1.Application *v1beta1.ApplicationRevision }
LiveDiffObject wraps the objects for diff
type LiveDiffOption ¶
LiveDiffOption contains options for comparing an application with a living AppRevision in the cluster
func NewLiveDiffOption ¶
func NewLiveDiffOption(c client.Client, cfg *rest.Config, dm discoverymapper.DiscoveryMapper, pd *packages.PackageDiscover, as []oam.Object) *LiveDiffOption
NewLiveDiffOption creates a live-diff option
func (*LiveDiffOption) Diff ¶
func (l *LiveDiffOption) Diff(ctx context.Context, app *v1beta1.Application, appRevision *v1beta1.ApplicationRevision) (*DiffEntry, error)
Diff does three phases, dry-run on input app, preparing manifest for diff, and calculating diff on manifests. TODO(wonderflow): vela live-diff don't diff for policies now.
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. TODO(wonderflow): vela live-diff don't diff for policies now.
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 Parser *appfile.Parser GenerateAppFile GenerateAppFileFunc // 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 ¶
func NewDryRunOption(c client.Client, cfg *rest.Config, dm discoverymapper.DiscoveryMapper, pd *packages.PackageDiscover, as []oam.Object, serverSideDryRun bool) *Option
NewDryRunOption creates a dry-run option
func (*Option) ExecuteDryRun ¶
func (d *Option) ExecuteDryRun(ctx context.Context, application *v1beta1.Application) ([]*types.ComponentManifest, []*unstructured.Unstructured, error)
ExecuteDryRun simulates applying an application into cluster and returns rendered resources but not persist them into cluster.
func (*Option) ExecuteDryRunWithPolicies ¶ added in v1.7.0
func (d *Option) ExecuteDryRunWithPolicies(ctx context.Context, application *v1beta1.Application, buff *bytes.Buffer) error
ExecuteDryRunWithPolicies is similar to ExecuteDryRun func, but considers deploy workflow step and topology+override policies
func (*Option) PrintDryRun ¶ added in v1.5.0
func (d *Option) PrintDryRun(buff *bytes.Buffer, appName string, comps []*types.ComponentManifest, policies []*unstructured.Unstructured) error
PrintDryRun will print the result of dry-run
type ReportDiffOption ¶
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