Documentation ¶
Overview ¶
Package reconcile contains Reconcilers for the Syncer's controllers.
Index ¶
- func AllVersionNames(resources map[schema.GroupVersionKind][]*unstructured.Unstructured, ...) map[string]bool
- func AsUnstructured(o client.Object) (*unstructured.Unstructured, status.Error)
- func AsUnstructuredSanitized(o client.Object) (*unstructured.Unstructured, status.Error)
- func FightWarning(frequency float64, resource client.Object) status.ResourceError
- func HandleDiff(ctx context.Context, applier Applier, diff *differ.Diff, ...) (bool, status.Error)
- func NewClusterConfigReconciler(c *syncerclient.Client, applier Applier, reader client.Reader, ...) reconcile.Reconciler
- func NewConfigManagementError(config *v1.ClusterConfig, err error) v1.ConfigManagementError
- func NewNamespaceConfigReconciler(c *syncerclient.Client, applier Applier, reader client.Reader, ...) reconcile.Reconciler
- func NewRepoStatus(sClient *syncclient.Client, now func() metav1.Time) reconcile.Reconciler
- func SetClusterConfigStatus(ctx context.Context, c *syncerclient.Client, config *v1.ClusterConfig, ...) status.Error
- func SetFightThreshold(updatesPerMinute float64)
- func SyncedAt(obj client.Object, token string)
- type Applier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllVersionNames ¶
func AllVersionNames(resources map[schema.GroupVersionKind][]*unstructured.Unstructured, gk schema.GroupKind) map[string]bool
AllVersionNames returns the set of names of all resources with the specified GroupKind.
func AsUnstructured ¶
func AsUnstructured(o client.Object) (*unstructured.Unstructured, status.Error)
AsUnstructured attempts to convert a client.Object to an *unstructured.Unstructured. TODO: This adds .status and .metadata.creationTimestamp to
everything. Evaluate every use, and convert to using AsUnstructuredSanitized if possible.
func AsUnstructuredSanitized ¶
func AsUnstructuredSanitized(o client.Object) (*unstructured.Unstructured, status.Error)
AsUnstructuredSanitized converts o to an Unstructured and removes problematic fields: - metadata.creationTimestamp - status
There is no other way to do this without defining our own versions of the Kubernetes type definitions. Explanation of why: https://www.sohamkamani.com/golang/2018-07-19-golang-omitempty/
func FightWarning ¶
func FightWarning(frequency float64, resource client.Object) status.ResourceError
FightWarning represents when the Syncer is fighting over a resource with some other process on a Kubernetes cluster.
func HandleDiff ¶
func HandleDiff(ctx context.Context, applier Applier, diff *differ.Diff, recorder record.EventRecorder) (bool, status.Error)
HandleDiff updates objects on the cluster based on the difference between actual and declared resources.
func NewClusterConfigReconciler ¶
func NewClusterConfigReconciler(c *syncerclient.Client, applier Applier, reader client.Reader, recorder record.EventRecorder, decoder decode.Decoder, now func() metav1.Time, toSync []schema.GroupVersionKind, mgrInitTime metav1.Time) reconcile.Reconciler
NewClusterConfigReconciler returns a new clusterConfigReconciler. ctx is the ambient context to use for all reconciler operations.
func NewConfigManagementError ¶
func NewConfigManagementError(config *v1.ClusterConfig, err error) v1.ConfigManagementError
NewConfigManagementError returns a ConfigManagementError corresponding to the given ClusterConfig and error.
func NewNamespaceConfigReconciler ¶
func NewNamespaceConfigReconciler(c *syncerclient.Client, applier Applier, reader client.Reader, recorder record.EventRecorder, decoder decode.Decoder, now func() metav1.Time, toSync []schema.GroupVersionKind, mgrInitTime metav1.Time) reconcile.Reconciler
NewNamespaceConfigReconciler returns a new NamespaceConfigReconciler.
func NewRepoStatus ¶
func NewRepoStatus(sClient *syncclient.Client, now func() metav1.Time) reconcile.Reconciler
NewRepoStatus returns a reconciler for maintaining the status field of the Repo resource.
func SetClusterConfigStatus ¶
func SetClusterConfigStatus(ctx context.Context, c *syncerclient.Client, config *v1.ClusterConfig, initTime metav1.Time, now func() metav1.Time, errs []v1.ConfigManagementError, rcs []v1.ResourceCondition) status.Error
SetClusterConfigStatus updates the status sub-resource of the ClusterConfig based on reconciling the ClusterConfig. initTime is the syncer-controller's instantiation time. It is used to avoid updating the sync state and the sync time for the imported stale configs, so that the repostatus-reconciler can force-update the stalled configs on startup.
func SetFightThreshold ¶
func SetFightThreshold(updatesPerMinute float64)
SetFightThreshold updates the maximum allowed rate of updates to a resource per minute before we begin logging warnings to the user.
Types ¶
type Applier ¶
type Applier interface { Create(ctx context.Context, obj *unstructured.Unstructured) (bool, status.Error) Update(ctx context.Context, intendedState, currentState *unstructured.Unstructured) (bool, status.Error) // RemoveNomosMeta performs a PUT (rather than a PATCH) to ensure that labels and annotations are removed. RemoveNomosMeta(ctx context.Context, intent *unstructured.Unstructured) (bool, status.Error) Delete(ctx context.Context, obj *unstructured.Unstructured) (bool, status.Error) GetClient() client.Client }
Applier updates a resource from its current state to its intended state using apply operations.
func NewApplier ¶
NewApplier returns a new clientApplier.
func NewApplierForMultiRepo ¶
NewApplierForMultiRepo returns a new clientApplier for callers with multi repo feature enabled.