Commit Graph

890 Commits

Author SHA1 Message Date
Nic Cope 8e173f4a75 Default to deleting, not retaining, external resources.
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-08-12 16:32:55 -07:00
Nic Cope 72cd5521e6 Rename the Deletable interface to Orphanable
This interface represents a resource with a deletion policy; i.e. a resource
whose underlying external resource may either be deleted or orphaned when the
it is deleted.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-08-12 13:03:51 -07:00
Nic Cope 5c5d8932d3 Introduce a deletion policy, and deprecate the reclaim policy.
The deletion policy is a more narrowly scoped variant of the reclaim policy. It
affects only whether exeternal resources are deleted or orphaned when their
corresponding managed resource is deleted, as opposed to the reclaim policy
which also affects whether the managed resource is deleted when its bound claim
is deleted.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-08-11 18:24:16 -07:00
Nic Cope 8c96c010f5 Mark additional references to the class and claim pattern deprecated.
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-08-11 11:27:08 -07:00
Daniel Mangum 9a9a434f73
Merge pull request #182 from hasheddan/scopedrefs
Use Reference type for provider references
2020-06-29 12:09:15 -05:00
hasheddan e130a99a00
Do not use pointer for Provider references
Provider reference is a required field for types that embed it. In
practice, accessing the Name field of a Provider reference should never
result in a nil pointer dereference, but it is still an unsafe
operation. Changing the Provider reference to a non-pointer absolves the
user from checking for a nil reference each time it is used.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-06-26 10:19:28 -05:00
hasheddan c5b903fedd
Use Refernce type for provider references
We are currently using corev1.ObjectReference for provider resources.
This includes more information than needed and encourages
using helper methods that may depend on other fields in the type that we
do not intend to be utilized. This updates provider references
fields to use the Reference type, which only has a name field.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-06-25 14:59:52 -05:00
Jared Watts 4cb7486a71
Merge pull request #181 from jbw976/owners-update
governance: add OWNERS.md to define maintainers of this repo
2020-06-11 11:32:56 -07:00
Jared Watts 4ddb0c50f0
governance: add OWNERS.md to define maintainers of this repo
Signed-off-by: Jared Watts <jbw976@gmail.com>
2020-06-11 11:18:59 -07:00
Nic Cope 290de73499
Merge pull request #176 from hasheddan/resverauto
Update with object that is gotten in APIUpdatingApplicator
2020-05-12 13:45:08 -07:00
hasheddan a964b65a29
Add UpdateFn for mutating ApplyOptions
Add an UpdateFn wrapper around ApplyOption that simplifies
the interface for passing a mutating function to
APIUpdatingApplicator.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-05-12 15:35:54 -05:00
hasheddan 3420b651d6
Update with object that is gotten in APIUpdatingApplicator
This changes APIUpdatingApplicator to make its Update call
with the object it gets rather than the one passed so that
the default behavior is a no-op rather than a guaranteed
error on mismatched resource versions.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-05-12 15:15:27 -05:00
Nic Cope 926e1887b1
Merge pull request #175 from negz/somewhatbounded
Bind and unbind managed resources conservatively
2020-05-08 17:25:34 -07:00
Nic Cope 72789b40db Refuse to bind claims to controlled managed resources
This will ensure resource claims don't bind to managed resources that are part
of a composite resource while these two features live side by side. I suspect it
will also nesure resource claims don't bind to a managed resource produced by a
stack. As far as I know we don't have any use cases in which a stack creates a
managed resource that is expected to be claimable.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-05-08 15:42:08 -07:00
Nic Cope 8f8929a0a8 Ensure resources reference the claim that is trying to bind or unbind them
This gates against two possible issues:

1. Claim A dynamically provisions managed resource M. Claim B runs and wins a
   race against Claim A to bind to the newly provisioned and bindable M.
2. Claim A dynamically provisions managed resource M. Claim B explicitly sets
   its resource reference to M, and is then deleted, thereby deleting M which it
   was never bound to and did not dynamically provision.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-05-07 16:02:24 -07:00
Nic Cope 03cf9993f6
Merge pull request #174 from kasey/delete-hardest
Don't wait for IsBindable before calling AddFinalizer
2020-05-07 16:01:05 -07:00
Kasey Kirkham dccc18c2df AddFinalizer before we attempt to provision or bind to a managed resource.
Signed-off-by: Kasey Kirkham <kasey@upbound.io>
2020-05-07 14:20:15 -07:00
Nic Cope 21d9cb6ea9
Merge pull request #171 from hasheddan/4ground
Delete CRDs in foreground at end of test run
2020-04-29 12:51:44 -07:00
Nic Cope 16dbc007aa
Merge pull request #170 from muvaf/fakefix
Add missing field to fake.Composite
2020-04-29 11:47:24 -07:00
hasheddan efd76064c9
Delete CRDs in foreground at end of test run
This guards against subsequent tests failing because
they are installing the same CRDs that we being deleted.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-04-29 13:18:33 -05:00
Muvaffak Onus 1ddc2c5d8d
Add missing field to fake.Composite to satisfy resource.Composite interface
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2020-04-29 17:11:34 +03:00
Nic Cope 05ca13f8ea
Merge pull request #169 from negz/strayedfromthepath
Make it possible to distinguish fieldpath.IsNotFound errors
2020-04-28 22:42:36 -07:00
Nic Cope bd09d0c8f4 Make it possible to distinguish fieldpath.IsNotFound errors
https://github.com/crossplane/crossplane/issues/1455

See the above issue for a use case; this will allow the composition patching
functionality to ignore this error.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-28 21:36:06 -07:00
Nic Cope 4e5f08ced5
Merge pull request #167 from muvaf/mockme
Export mock secret owner structs to be used in tests outside this repo
2020-04-28 19:19:25 -07:00
Nic Cope 30263ce18b
Merge pull request #168 from muvaf/ctrl-runtime-upd
Update controller-runtime dependency to the latest release
2020-04-28 19:18:06 -07:00
Muvaffak Onus b5206ecd68
Export mock secret owner structs to be used in tests outside this repo
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2020-04-29 03:36:46 +03:00
Muvaffak Onus cc12bb7b64
Update controller-runtime dependency to the latest release.
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2020-04-29 03:13:29 +03:00
Nic Cope 3dbd603092
Merge pull request #163 from negz/woof
Add a Reviewdog Github action
2020-04-26 17:16:31 -07:00
Nic Cope d3582bab01 Add a Reviewdog Github action
https://github.com/reviewdog/

This should cause a Reviewdog bot to comment on PRs with linter violations,
replacing the sunset https://golangci.com/ service.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-26 16:37:02 -07:00
Nic Cope 5622f15b70
Merge pull request #162 from negz/justatest
Add unit tests for pkg/resource/unstructured
2020-04-26 14:56:34 -07:00
Nic Cope 51ebec91a3 Add tests for unstructured wrappers.
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-25 21:32:29 -07:00
Nic Cope 6382f8b98c Add tests for unstructured.WrapperClient
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-25 20:03:59 -07:00
Nic Cope 100af7315c unstructured.WrapperClient nitpicks
Add a package docstring, and returns a concrete type rather than an interface
where possible.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-25 18:40:05 -07:00
Nic Cope 10ecf0f09a
Merge pull request #161 from negz/outofcontrol
Expand support for unstructured types
2020-04-24 14:32:13 -07:00
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