Commit Graph

956 Commits

Author SHA1 Message Date
Nic Cope da8cc179e7 Remove unused fake.Workload
This was for an OAM workload, that moved out to oam-kubernetes-runtime.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-24 12:06:27 -07:00
Nic Cope 477b9e592e Add fake composed, composite, and requirement resources.
We could also use pkg/resource/unstructured in tests, but I think this will
require a little less boilerplate to setup tests.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-23 21:34:33 -07:00
Nic Cope 3060371afd Remove unstructured.ObjectTyper
runtime.Scheme already does this.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-23 14:28:17 -07:00
Nic Cope 70b21471b6 Add a generic ConnectionPropagator
This is effectively identical to the existing ManagedConnectionPropagator, but
propagates from any ConnectionSecretOwner, rather than requiring the much larger
and more specific Managed interface. This allows this propagator to be used to
propagate from managed resources to claims and also from composite resources to
requirements.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-23 13:04:38 -07:00
Nic Cope ca1fe097be Expand and refactor unstructured types
This switches names around from unstructured.Composite (for example) to
composite.Unstructured, mostly to allow several unstructured types to use
identically named options like WithGroupVersionKind. It also adds a few
getters and setters required for resource publications, and introduces the
resource.Requirement type that represents an application's requirement for a
published composite resource.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-23 12:48:22 -07:00
Nic Cope dfff858421
Merge pull request #160 from negz/outofcontrol
Add a "controller engine" that manages the lifecycles of controllers
2020-04-23 12:42:53 -07:00
Nic Cope 1cd8a32c4f
Merge pull request #159 from muvaf/setowner
AddOwnerRef should update
2020-04-23 12:31:57 -07:00
Nic Cope 357942c02d Add a "controller engine" that manages the lifecycles of controllers
A controller engine is somewhat like a controller "sub-manager", in that it's
effectively a group of controllers. Unlike a typical controller manager, the
lifecycle of the controllers an engine manages are not coupled to the lifecycle
of the engine itself. An engine may be used by a parent controller to start and
stop child controllers in accordance with configuration provided by the custom
resource that the parent controller watches.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-23 01:51:27 -07:00
Nic Cope 8fe8833cc3 Pin controller-runtime to master
https://github.com/kubernetes-sigs/controller-runtime/pull/863

We'd like to use the above PR, which is not yet included in a controller-runtime
release. Updating controller-runtime requires updating a few other dependencies,
which changed the signature of client-go clientset methods. This commit removes
the only two uses of clientset from crossplane-runtime. pkg/test/integration now
uses a controller-runtime client.Client. pkg/test.Env has been removed, as it no
longer has any known users.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-22 19:14:42 -07:00
Muvaffak Onus 48c7c448d3
AddOwnerReference should always set the owner ref array to be able to modify the existing reference
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2020-04-22 23:31:04 +03:00
Nic Cope 7d330ebf3c
Merge pull request #158 from negz/completion
Add a fieldpath.PaveObject convenience method
2020-04-22 12:55:31 -07:00
Nic Cope ae9aa170fc Add a fieldpath.PaveObject convenience method
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-21 23:15:04 -07:00
Nic Cope be37c50cc2
Merge pull request #157 from muvaf/unclient
Client for unstructured Crossplane types
2020-04-21 14:10:18 -07:00
Nic Cope 903cf3eff8
Merge pull request #155 from negz/noam
Remove OAM code, which has moved to crossplane/oam-runtime
2020-04-21 13:10:34 -07:00
Nic Cope b268c36fd8
Merge pull request #156 from negz/completion
Tweaks to the new composite and composed types
2020-04-21 13:10:09 -07:00
Muvaffak Onus 9357d0ab18
Controller-runtime client wrapper for objects that are wrappers of unstructured.Unstructured
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2020-04-21 17:42:04 +03:00
Nic Cope 8ada1fa72b Compose the Composite interface of smaller interfaces
This also removes Bindable from the Composite interface, which I believe we will
not need.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-20 22:00:04 -07:00
Nic Cope 90d2786f90 Add a test for GetValueInto
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-20 21:29:10 -07:00
Nic Cope 44099db82c Remove OAM code, which has moved to crossplane/oam-runtime
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-20 20:55:51 -07:00
Nic Cope 634c4e2859
Merge pull request #154 from muvaf/compolella
Add composition interfaces and unstructured composition structs.
2020-04-20 20:46:46 -07:00
Muvaffak Onus 4a7ece2ff5
Add composition interfaces and unstructured composition structs.
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2020-04-21 03:11:24 +03:00
Nic Cope dab52011b1
Merge pull request #153 from negz/refref
Additional reference selection and resolution helpers
2020-04-17 14:32:25 -07: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 55a4bb6323
Merge pull request #149 from muvaf/applyfix
apply should work for objects with only generateName
2020-04-15 22:01:04 -07:00
Nic Cope 375029a89e
Merge pull request #151 from negz/tinyref
Simplify resource references, and introduce reference selection
2020-04-15 22:00:18 -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
Nic Cope 6bbfa9e0d6 Add Reference and Selector types
These will be used for cross resource references, though they could also be used
in other contexts.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-14 17:57:29 -07:00
Nic Cope bc4cf86077
Merge pull request #147 from muvaf/finalizeme
Make APIFinalizer interface compatible with all Kubernetes resources
2020-04-14 11:07:23 -07:00
Muvaffak Onus 3301bfef95
apply should work for objects with only generateName
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2020-04-14 20:35:44 +03:00
Nic Cope 642fd735ca
Merge pull request #145 from hasheddan/ownoam
Pass workload kind to trait reconciler
2020-04-13 13:32:36 -07:00
Muvaffak Onus fbeeb71921
Make APIFinalizer interface compatible with all Kubernetes resources
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2020-04-13 17:02:04 +03:00
hasheddan 993994446a
Pass workload kind to trait reconciler
Because we no longer include the UID of
the workload in a trait's workloadRef it
is necessary to pass the workload kind to
the trait reconciler so that we can get the
referenced workload on each reconcile and
use its UID for ensuring the corresponding
translation is controllable by it.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-04-10 07:34:52 -05:00
Nic Cope 82a0ff50fd
Merge pull request #144 from hasheddan/ownoam
Update OAM trait and workload reconcilers to use MustBeControllableBy
2020-04-09 13:33:47 -07:00
hasheddan 294db229df
Update OAM trait and workload reconcilers to use MustBeControllableBy
In order to enable backup and restore of OAM traits
and workloads, resources they own should be able to
be regained control of if they are not already
controlled by a different owner.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-04-09 15:27:52 -05:00
Nic Cope f9d4e859f4
Merge pull request #126 from hasheddan/intignore
Ignore previously cleaned up CRDs in integration tests
2020-04-05 19:09:56 -07:00
Nic Cope ce29ee9055
Merge pull request #142 from negz/secretive
Make connection secret propagation UID-agnostic
2020-04-05 15:41:00 -07:00
Nic Cope cf8d3a6a26 Make connection secret propagation UID-agnostic
This allows propagation to function even when the propagating and/or propagated
secrets have been deleted and recreated, and thus allocated new UIDs.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-05 15:16:25 -07:00
hasheddan 8d3f52dd66
Format tmp dir hash as hex
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-04-04 10:00:47 -05:00
hasheddan 18caa604b9
Ignore previously cleaned up CRDs in integration tests
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-04-04 10:00:46 -05:00
Nic Cope 067847f938 Rename ExternalNameAnnotationKey to AnnotationKeyExternalName
We typically include the type hint at the start of enum-ish types, e.g.
AnnotationKeyFoo and ExternalResourceTagKeyBar. This was the one exception
to that pattern. Presumably this should not be noticed by most consumers of
this API, which use meta.GetExternalName to get this field.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-03 20:28:30 -07:00
Nic Cope b92f0dbb8d
Merge pull request #139 from negz/secretive
Introduce a distinct secret type for connection secrets
2020-04-02 17:17:25 -07:00
Nic Cope b8b606426d Introduce an updating Applicator
This is roughly the same functionality as controllerutil.CreateOrUpdate, albeit
a little simpler. This variant is useful to us because it satisfies our
Applicator interface.

The key difference between the patching and updating applicators is that the
patching applicator will leave any existing, unset fields untouched (to the
extent that a JSON merge patch allows), while the updating applicator will
always update any existing object to exactly match the desired object.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-02 14:28:38 -07:00
Nic Cope ee9b68e00c Introduce a distinct secret type for connection secrets
This allows resource claims and managed resources to adopt existing orphaned
connection secrets without needing to be concerned with the fact that they
might be adopting an existing secret that is unrelated to Crossplane.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-02 14:28:38 -07:00
Nic Cope ff8a47bab6 Add a MustBeControllableBy ApplyOption
This option replaces ControllersMustMatch. It works slightly differently in that
it takes the expected controller UID explicitly instead of inferring it from the
desired object, and considers current objects with no controller reference to be
controllable. Presumable objects with no controller reference will be adopted.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-01 22:20:18 -07:00
Nic Cope 51d293df2f Don't require callers to pass a client.Client to Applicator implementations
The Apply method of the resource.Applicator interface took a client.Client
largely because it was extracted from the pre-existing resource.Apply function
to allow pluggable Apply implementations. Now that we have types that satisfy
resource.Applicator it makes more sense for those types to include a client,
rather than being passed one for every Apply call.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-01 18:23:17 -07:00
Nic Cope 03316b1fbc
Merge pull request #135 from crossplane/dev-guide-link-fix
updates outdated link to the developer guide in README
2020-03-26 17:34:16 -07:00