Documentation ¶
Index ¶
- Constants
- func DeleteErrorForResource(err error, id core.ID) status.Error
- 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 ObjMetaFromObject(obj client.Object) object.ObjMetadata
- func PruneErrorForResource(err error, id core.ID) status.Error
- func SkipErrorForResource(err error, id core.ID, strategy actuation.ActuationStrategy) status.Error
- func WaitErrorForResource(err error, id core.ID) status.Error
- type Applier
- type ClientSet
- type Destroyer
- type KptApplier
- type KptDestroyer
- type ObjectStatus
- type ObjectStatusMap
- type Supervisor
- func NewNamespaceSupervisor(cs *ClientSet, namespace declared.Scope, syncName string, ...) (Supervisor, error)
- func NewRootSupervisor(cs *ClientSet, syncName string, reconcileTimeout time.Duration) (Supervisor, error)
- func NewSupervisor(cs *ClientSet, scope declared.Scope, syncName string, ...) (Supervisor, error)
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 DeleteErrorForResource ¶ added in v1.15.1
DeleteErrorForResource indicates that the applier failed to delete the given resource.
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 ObjMetaFromObject ¶ added in v1.15.1
func ObjMetaFromObject(obj client.Object) object.ObjMetadata
ObjMetaFromObject constructs an ObjMetadata representing the Object.
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 interface { // Apply creates, updates, or prunes all managed resources, depending on // the new desired resource objects. // Returns the set of GVKs which were successfully applied and any errors. // This is called by the reconciler when changes are detected in the // source of truth (git, OCI, helm) and periodically. Apply(ctx context.Context, desiredResources []client.Object) (map[schema.GroupVersionKind]struct{}, status.MultiError) // Errors returns the errors encountered during apply. // This method may be called while Destroy is running, to get the set of // errors encountered so far. Errors() status.MultiError }
Applier is a bulk client for applying a set of desired resource objects and tracking them in a ResourceGroup inventory. This enables pruning objects by removing them from the list of desired resource objects and re-applying.
type ClientSet ¶ added in v1.15.1
type ClientSet struct { KptApplier KptApplier KptDestroyer KptDestroyer InvClient inventory.Client Client client.Client Mapper meta.RESTMapper StatusMode string }
ClientSet wraps the various Kubernetes clients required for building a Config Sync applier.Applier.
func NewClientSet ¶ added in v1.15.1
func NewClientSet(c client.Client, configFlags *genericclioptions.ConfigFlags, statusMode string) (*ClientSet, error)
NewClientSet constructs a new ClientSet.
type Destroyer ¶ added in v1.15.1
type Destroyer interface { // Destroy deletes all managed resources. // Returns any errors encountered while destroying. // This is called by the reconciler finalizer when deletion propagation is // enabled. Destroy(ctx context.Context) status.MultiError // Errors returns the errors encountered during destroy. // This method may be called while Destroy is running, to get the set of // errors encountered so far. Errors() status.MultiError }
Destroyer is a bulk client for deleting all the managed resource objects tracked in a single ResourceGroup inventory.
type KptApplier ¶ added in v1.15.1
type KptApplier interface {
Run(context.Context, inventory.Info, object.UnstructuredSet, apply.ApplierOptions) <-chan event.Event
}
KptApplier is the interface exposed by cli-utils apply.Applier. Using an interface, instead of the concrete struct, allows for easier testing.
type KptDestroyer ¶ added in v1.15.1
type KptDestroyer interface {
Run(context.Context, inventory.Info, apply.DestroyerOptions) <-chan event.Event
}
KptDestroyer is the interface exposed by cli-utils apply.Destroyer. Using an interface, instead of the concrete struct, allows for easier testing.
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)
type Supervisor ¶ added in v1.15.1
Supervisor is a bulk client for applying and deleting a mutable set of resource objects. Managed objects are tracked in a ResourceGroup inventory object.
Supervisor satisfies both the Applier and Destroyer interfaces, with a shared lock, preventing Apply and Destroy from running concurrently.
The Applier and Destroyer share an error cache. So the Errors method will return the last errors from Apply or the Destroy, whichever came last.
func NewNamespaceSupervisor ¶ added in v1.15.1
func NewNamespaceSupervisor(cs *ClientSet, namespace declared.Scope, syncName string, reconcileTimeout time.Duration) (Supervisor, error)
NewNamespaceSupervisor constructs a Supervisor that can manage resource objects in a single namespace.
func NewRootSupervisor ¶ added in v1.15.1
func NewRootSupervisor(cs *ClientSet, syncName string, reconcileTimeout time.Duration) (Supervisor, error)
NewRootSupervisor constructs a Supervisor that can manage both cluster-level and namespace-level resource objects in a single cluster.
func NewSupervisor ¶ added in v1.15.1
func NewSupervisor(cs *ClientSet, scope declared.Scope, syncName string, reconcileTimeout time.Duration) (Supervisor, error)
NewSupervisor constructs either a cluster-level or namespace-level Supervisor, based on the specified scope.