parse

package
v1.14.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RenderingInProgress means that the configs are still being rendered by Config Sync.
	RenderingInProgress string = "Rendering is still in progress"

	// RenderingSucceeded means that the configs have been rendered successfully.
	RenderingSucceeded string = "Rendering succeeded"

	// RenderingFailed means that the configs have failed to be rendered.
	RenderingFailed string = "Rendering failed"

	// RenderingSkipped means that the configs don't need to be rendered.
	RenderingSkipped string = "Rendering skipped"
)

Variables

This section is empty.

Functions

func BadScopeErr

func BadScopeErr(resource client.Object, want declared.Scope) status.ResourceError

BadScopeErr reports that the passed resource declares a Namespace for a different Namespace repository.

func OptionsForScope

func OptionsForScope(options validate.Options, scope declared.Scope) validate.Options

OptionsForScope returns new Options that have been updated for the given Scope.

func Run

func Run(ctx context.Context, p Parser)

Run keeps checking whether a parse-apply-watch loop is necessary and starts a loop if needed.

func UpdateConflictManagerStatus

func UpdateConflictManagerStatus(ctx context.Context, conflictErrs []status.ManagementConflictError, k8sClient client.Client)

UpdateConflictManagerStatus reports the conflict in the conflicting manager.

Types

type FileSource

type FileSource struct {
	// SourceDir is the path to the symbolic link of the source repository.
	SourceDir cmpath.Absolute
	// HydratedRoot is the path to the root of the hydrated directory.
	HydratedRoot string
	// RepoRoot is the absolute path to the parent directory of SourceRoot and HydratedRoot.
	RepoRoot cmpath.Absolute
	// HydratedLink is the relative path to the symbolic link of the hydrated configs.
	HydratedLink string
	// SyncDir is the path to the directory of policies within the source repository.
	SyncDir cmpath.Relative
	// SourceType is the type of the source repository, must be git or oci.
	SourceType v1beta1.SourceType
	// SourceRepo is the source repo to sync.
	SourceRepo string
	// SourceBranch is the branch of the source repo to sync.
	SourceBranch string
	// SourceRev is the revision of the source repo to sync.
	SourceRev string
}

FileSource includes all settings to configure where a Parser reads files from.

type Parser

type Parser interface {
	SetSyncStatus(ctx context.Context, errs status.MultiError) error

	// SetReconciling sets the field indicating whether the reconciler is reconciling a change.
	SetReconciling(value bool)
	// Reconciling returns whether the reconciler is reconciling a change.
	Reconciling() bool
	// ApplierErrors returns the errors surfaced by the applier.
	ApplierErrors() status.MultiError
	// RemediatorConflictErrors returns the conflict errors detected by the remediator.
	RemediatorConflictErrors() []status.ManagementConflictError
	// K8sClient returns the Kubernetes client that talks to the API server.
	K8sClient() client.Client
	// contains filtered or unexported methods
}

Parser represents a parser that can be pointed at and continuously parse a source.

func NewNamespaceRunner

func NewNamespaceRunner(clusterName, syncName, reconcilerName string, scope declared.Scope, fileReader reader.Reader, c client.Client, pollingFrequency time.Duration, resyncPeriod time.Duration, fs FileSource, dc discovery.DiscoveryInterface, resources *declared.Resources, app applier.Interface, rem remediator.Interface) (Parser, error)

NewNamespaceRunner creates a new runnable parser for parsing a Namespace repo.

func NewRootRunner

func NewRootRunner(clusterName, syncName, reconcilerName string, format filesystem.SourceFormat, fileReader reader.Reader, c client.Client, pollingFrequency time.Duration, resyncPeriod time.Duration, fs FileSource, dc discovery.DiscoveryInterface, resources *declared.Resources, app applier.Interface, rem remediator.Interface) (Parser, error)

NewRootRunner creates a new runnable parser for parsing a Root repository.

Jump to

Keyboard shortcuts

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