Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import (
- "k8s.io/apimachinery/pkg/runtime"
- "sigs.k8s.io/controller-runtime/pkg/reconcile"
- "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
- "github.com/crossplaneio/crossplane/pkg/apis/cooltype/v1alpha1"
- )
- // Result of a Sync or Delete call.
- type Result struct {
- reconcile.Result
- NeedsUpdate []NeedsUpdate
- }
- // NeedsUpdate is an Object that needs to be updated as a side effect of
- // a Sync or Delete operation on a different Object. For example a
- // Secret that must be updated when a ResourceType is synced.
- type NeedsUpdate struct {
- Object runtime.Object
- MutateFn controllerutil.UpdateFn
- }
- // Update (or create) the Object that needs an update.
- func (u NeedsUpdate) Update(ctx context.Context, c client.Client) (controllerutil.OperationResult, error) {
- return controllerutil.CreateOrUpdate(ctx, c, u.Object, u.MutateFn)
- }
- // A Syncer can sync resources with an external store - e.g. the AWS API.
- type Syncer interface {
- // Sync the supplied resource with the external store.
- Sync(ctx context.Context, r *v1alpha1.ResourceType) Result
- }
- // A Deleter can delete resources from an external store - e.g. the AWS API.
- type Deleter interface {
- // Delete the supplied resource from the external store.
- Delete(ctx context.Context, r *v1alpha1.ResourceType) Result
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement