Documentation ¶
Index ¶
- Constants
- func Error(err error) status.Error
- func ErrorForResource(err error, id core.ID) status.Error
- func InventoryID(name, namespace string) string
- func KptManagementConflictError(resource client.Object) status.Error
- func PruneErrorForResource(err error, id core.ID) status.Error
- func SkipErrorForResource(err error, id core.ID, strategy actuation.ActuationStrategy) status.Error
- type Applier
- type ApplyStats
- type DisabledObjStats
- type Interface
- type ObjectStatus
- type ObjectStatusMap
Constants ¶
const ( // StatusEnabled is used to allow kpt applier to inject the actuation status // into the ResourceGroup object. StatusEnabled = "enabled" // StatusDisabled is used to stop kpt applier to inject the actuation status // into the ResourceGroup object. StatusDisabled = "disabled" // StatusModeKey annotates a ResourceGroup CR // to communicate with the ResourceGroup controller. // When the value is set to "disabled", the ResourceGroup controller // ignores the ResourceGroup CR. StatusModeKey = configsync.ConfigSyncPrefix + "status" )
const ApplierErrorCode = "2009"
ApplierErrorCode is the error code for apply failures.
Variables ¶
This section is empty.
Functions ¶
func ErrorForResource ¶
ErrorForResource indicates that the applier failed to apply the given resource.
func InventoryID ¶
InventoryID returns the inventory id of an inventory object. The inventory object generated by ConfigSync is in the same namespace as RootSync or RepoSync. The inventory ID is assigned as <NAMESPACE>_<NAME>.
func KptManagementConflictError ¶
KptManagementConflictError indicates that the passed resource is illegally declared in multiple repositories. TODO: merge with status.ManagementConflictError if cli-utils supports reporting the conflicting manager in InventoryOverlapError.
func PruneErrorForResource ¶
PruneErrorForResource indicates that the applier failed to prune the given resource.
func SkipErrorForResource ¶
SkipErrorForResource indicates that the applier skipped apply or delete of the given resource.
Types ¶
type Applier ¶
type Applier struct {
// contains filtered or unexported fields
}
Applier declares the Applier component in the Multi Repo Reconciler Process.
func NewNamespaceApplier ¶
func NewNamespaceApplier(c client.Client, configFlags *genericclioptions.ConfigFlags, namespace declared.Scope, syncName string, statusMode string, reconcileTimeout time.Duration) (*Applier, error)
NewNamespaceApplier initializes an applier that fetches a certain namespace's resources from the API server.
func NewRootApplier ¶
func NewRootApplier(c client.Client, configFlags *genericclioptions.ConfigFlags, syncName, statusMode string, reconcileTimeout time.Duration) (*Applier, error)
NewRootApplier initializes an applier that can fetch all resources from the API server.
func (*Applier) Apply ¶
func (a *Applier) Apply(ctx context.Context, desiredResource []client.Object) (map[schema.GroupVersionKind]struct{}, status.MultiError)
Apply implements Interface.
func (*Applier) Errors ¶
func (a *Applier) Errors() status.MultiError
Errors implements Interface. Errors returns the errors encountered during apply.
type ApplyStats ¶
type ApplyStats struct { ApplyEvent applyEventStats PruneEvent pruneEventStats WaitEvent waitEventStats DisableObjs DisabledObjStats // ErrorTypeEvents tracks the number of ErrorType events ErrorTypeEvents uint64 }
ApplyStats tracks the stats for all the events
type DisabledObjStats ¶
type DisabledObjStats struct { // Total tracks the number of objects to be disabled Total uint64 // Succeeded tracks how many ojbects were disabled successfully Succeeded uint64 }
DisabledObjStats tracks the stats for dsiabled objects
type Interface ¶
type Interface interface { // Apply updates the resource API server with the latest parsed git resource. // This is called when a new change in the git resource is detected. It also // returns a map of the GVKs which were successfully applied by the Applier. Apply(ctx context.Context, desiredResources []client.Object) (map[schema.GroupVersionKind]struct{}, status.MultiError) // Errors returns the errors encountered during apply. Errors() status.MultiError // Syncing indicates whether the applier is syncing. Syncing() bool }
Interface is a fake-able subset of the interface Applier implements.
Placed here to make discovering the production implementation (above) easier.
type ObjectStatus ¶
type ObjectStatus struct { // Strategy indicates the method of actuation (apply or delete) used or planned to be used. Strategy actuation.ActuationStrategy // Actuation indicates whether actuation has been performed yet and how it went. Actuation actuation.ActuationStatus // Reconcile indicates whether reconciliation has been performed yet and how it went. Reconcile actuation.ReconcileStatus }
ObjectStatus is a subset of actuation.ObjectStatus for tracking object status as a map value instead of a list value.
type ObjectStatusMap ¶
type ObjectStatusMap map[core.ID]*ObjectStatus
ObjectStatusMap is a map of object IDs to ObjectStatus.
func (ObjectStatusMap) Filter ¶
func (m ObjectStatusMap) Filter( strategy actuation.ActuationStrategy, actuation actuation.ActuationStatus, reconcile actuation.ReconcileStatus, ) []core.ID
Filter returns an unsorted list of IDs that satisfy the specified constraints. Use -1 to specify the constraint is not required.
func (ObjectStatusMap) Log ¶
func (m ObjectStatusMap) Log(logger infofLogger)
Log uses the specified logger to log object statuses. This produces multiple log entries, if the logger is enabled. Takes a minimal logger interface in order to make testing easier, but is designed for use with a leveled klog, like klog.V(3)