Skip to content

Commit

Permalink
document class filters.
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Nichols committed Feb 19, 2020
1 parent a0e734d commit 8f4dd66
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions injection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,35 @@ var _ addressableservicereconciler.Interface = (*Reconciler)(nil)
var _ addressableservicereconciler.Finalizer = (*Reconciler)(nil)
```

#### Annotation based class filters

Sometimes a reconciler only wants to reconcile a class of resource identified by
a special annotation on the Custom Resource.

This behavior can be enabled in the generators by adding the annotation class
key to the type struct:

```go
// +genreconciler:class=example.com/filter.class
```

The `genreconciler` generator code will now have the addition of
`classValue string` to `NewImpl` and `NewReconciler` (for tests):

```go
NewImpl(ctx context.Context, r Interface, classValue string, optionsFns ...controller.OptionsFn) *controller.Impl
```

```go
NewReconciler(ctx context.Context, logger *zap.SugaredLogger, client versioned.Interface, lister pubv1alpha1.BarLister, recorder record.EventRecorder, r Interface, classValue string, options ...controller.Options) controller.Reconciler
```

`ReconcileKind` and `FinalizeKind` will NOT be called for resources that DO NOT
have the provided `+genreconciler:class=<key>` key annotation. Additionally the
value of the `<key>` annotation on a resource must match the value provided to
`NewImpl` (or `NewReconcile`) for `ReconcileKind` or `FinalizeKind` to be called
for that resource.

#### Stubs

To get started, or to use as reference. It is intended to be copied out of the
Expand Down

0 comments on commit 8f4dd66

Please sign in to comment.