Commit Graph

7 Commits

Author SHA1 Message Date
hasheddan 1d97e32d05
Accept TypedReference in AsOwner and AsController
This updates the AsOwner and AsController to use TypedReference, which
is a more scoped version of ObjectReference that still contains all
necessary fields to create a controller or owner reference for an
object.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-09-08 10:13:15 -05:00
Nic Cope 3face651ef Support selecting and resolving arrays of references
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-16 19:51:16 -07:00
Nic Cope 211e232f1a Remove unused reference.Resolver interface
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-16 18:06:40 -07:00
Nic Cope e8ebeb9b32 Add convenience methods for references that resolve to a pointer string
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-16 18:05:03 -07:00
Nic Cope c8339c6c71 Return an error when reference resolution results in empty value
This will be the case when the referenced managed resource exists, but the field
from which we want to extract a value is empty. Consider for example a status
field that does not have a useful value until the resource has been created.
Blocking on the referenced resource field being non-zero is roughly equivalent
to blocking on the referenced resource being in condition Ready.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-15 19:00:24 -07:00
Nic Cope 1ac8ded427 Docstring fixes.
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-15 14:48:38 -07:00
Nic Cope b9255d7fcc Simplify resource references, and introduce reference selection
This commit introduces managed.APISimpleReferenceResolver, which satisfies the
managed.ReferenceResolver interface. This variant requires much less plumbing
and reflection because it expects that managed resources expose a single
ResolveReferences method that will optionally select and then resolve any
resource references. It also adds a new pkg/reference which contains a library
that managed resource authors _may_ choose to use to avoid reimplementing common
reference selection and resolution logic.

The existing managed.APIReferenceResolver implementation remains the default,
but is marked deprecated and will be removed once all managed resources use the
APISimpleReferenceResolver. Notably, the "reference resolution" condition is no
longer set by managed.Reconciler - managed resources will report reference
resolution issues via the Synced condition (i.e. as a ReconcileError).

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-15 13:59:53 -07:00