Commit Graph

42 Commits

Author SHA1 Message Date
Nic Cope 25ba6512d0 Set the 'Terminating' condition on blocking ProviderConfigs
This cocndition indicates that a ProviderConfig is being deleted, but blocking
because it still has users. The condition mirrors the similar PVC condition.
There is no inverse of 'Terminating', because a ProviderConfig cannot recover
from the condition.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-10-01 03:28:33 -07:00
Nic Cope be1324de71 Add a utility to track ProviderConfig usages
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-10-01 02:33:12 -07:00
Nic Cope 8f5be41347 Have GetCredentialsSecretReference operate on pointers
Credentials secrets are used by ProviderConfigs. They should be optional, since
a ProviderConfig may use a form of authentication that does not involve secrets.

This is a breaking API change, though I believe this interface was orphaned and
not actually in use anywhere.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-10-01 02:03:41 -07:00
Nic Cope 529fb076ce Add machinery for tracking ProviderConfig usage
This commit adds a reconciler and some utiltiies that allow Crossplane providers
to track the usage of their ProviderConfig resources. To do so, a provider must:

* Apply a ProviderConfigUsage each time a managed resource successfully connects
  to its external API using a ProviderConfig (or is reasonably expected to be
  about to do so). The Apply should be a no-op if there is an existing
  ProviderConfigUsage for the managed resource - the IsNotAllowed ApplyOption
  may be used to establish this.
* Start a controller that watches for ProviderConfigs and ProviderConfigUsages
  using the supplied providerconfig.Reconciler.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-10-01 02:03:41 -07:00
Nic Cope 95d71dbd91 Remove support for resource claims and classes
See https://github.com/crossplane/crossplane/issues/1670 for context.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-09-20 17:46:06 -07:00
Muvaffak Onus 367fa803d9
Add reference for ProviderConfig objects and deprecate Provider references
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2020-08-27 14:59:31 +03:00
Nic Cope 76a692ce94 Don't require composite resources to be reclaimable
https://github.com/crossplane/crossplane-runtime/pull/186

This change should have been included in the above PR; composite resources
no longer have a reclaim policy and instead are immediately deleted when
their claim (nee requirement) is deleted.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-08-18 19:33:28 -07:00
Nic Cope dbf0f9af21 Rename 'requirement' to 'claim'
Crossplane composite resources are cluster scoped, but they can be 'published'
to create a namespaced proxy resource. We called this resource a 'requirement',
despite it being conceptually quite similar to our existing (and deprecated)
'resource claim' concept. We've found that the 'publish a requirement' concept
has not resonated with the community and have decided to switch our terminology.

Under this new approach platform builders may choose to enable platform operators
to 'offer' (not publish) a composite resource to their platform consumers. The
namespaced interface to these composite resources will be known as a 'claim' or
'composite resource claim'. Note that we think platform builders and operators
are the key audience for these concepts; platform consumers will simply think of
themselves as using the resource as its kind indicates - e.g. 'a Kubernetes
cluster' or 'an SQL instance', not 'an SQL instance claim'.

In some cases our existing but deprecated resource claim concept has name
conflicts with this new take on the claim concept - i.e. the resource.Claim
interface. In those cases I've named the new type CompositeClaim to distinguish
it.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-08-18 19:33:28 -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
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
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 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 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 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
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 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
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 57df15c56c
Make WorkloadReferencer use non-pointer types
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-03-19 16:54:20 -05:00
hasheddan 7d845c0a81
Add TypedObjectReference and use in OAM reconcilers
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-03-18 21:49:28 -05:00
Muvaffak Onus 34f8959f86
Implement GetExternalTags to return Crossplane tags for managed resource controllers to tag their external resources
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2020-03-04 11:18:24 +03:00
hasheddan 16aa98bd07 Update go mod and refs with crossplane org name
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-02-18 18:17:32 -06:00
Daniel Mangum 5ece4af54b Implement Target interface and reconciler (#103)
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-01-14 12:36:41 -08:00
Muvaffak Onus f2f4e36608
api: Provider interface corrected
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2019-12-20 23:14:34 +03:00
Muvaffak Onus 912af9daab
Add Provider interface for consumers to be able to identify provider type resources
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2019-12-06 21:54:26 +03:00
Nic Cope d7b4db0562 Add claim scheduling and defaulting controllers
Signed-off-by: Nic Cope <negz@rk0n.org>
2019-10-22 17:13:21 -07:00
Nic Cope a2e24876e0 Use custom types for secret references
This allows us to require that name (and namespace where appropriate) are set at
the CRD level. In the case of cluster scoped resources that reference secrets
this is less surprising than defaulting to the `default` namespace when the
namespace is omitted.

Signed-off-by: Nic Cope <negz@rk0n.org>
2019-10-22 17:13:21 -07:00
Nic Cope 9f5188e0cb Assume resources, classes, and providers are cluster scoped
Signed-off-by: Nic Cope <negz@rk0n.org>
2019-10-22 17:13:21 -07:00
Nic Cope a310ee6a4a Remove support for portable resource classes
This commit renames "non portable resource class" back to "resource class", and
requires that resource claims reference a (non portable) resource class in any
namespace.

Signed-off-by: Nic Cope <negz@rk0n.org>
2019-10-22 17:12:36 -07:00
soorena776 1c6cccad93 Adding GetCondition to the Managed API
Signed-off-by: soorena776 <javad@upbound.io>
2019-10-21 16:39:26 -07:00
hasheddan 06cc35d1e3 class to nonportable class
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2019-09-11 22:59:59 -05:00
hasheddan 161ab47fb3 portable and nonportable
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2019-09-11 16:23:44 -05:00
hasheddan 80eeac1347 implement portable classes
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2019-09-10 19:06:05 -05:00
hasheddan 7d786e2dff runtime migration: strip apis and update dependencies
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2019-08-20 09:27:20 -05:00
hasheddan a72525edae kubebuilderv2: update core packages and tooling
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Co-authored-by: Muvaffak Onus <onus.muvaffak@gmail.com>
Co-authored-by: Jared Watts <jbw976@gmail.com>
Co-authored-by: hasheddan <georgedanielmangum@gmail.com>
2019-08-13 17:39:59 -05:00
hasheddan 9c60da21bc strongly typed phase one: implement default class reconciler for strongly typed resource classes
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Co-authored-by: Nic Cope <negz@rk0n.org>
2019-08-02 09:59:19 -05:00
Nic Cope d0240a6a02 Require Managed resources to support setting conditions
This will allow us to set conditions as part of a generic managed resource
reconciler that operates on the Managed interface.

Signed-off-by: Nic Cope <negz@rk0n.org>
2019-07-18 19:53:09 -07:00
Nic Cope fcb9e3663a Create managed resources in their resource class's namespace
https://github.com/crossplaneio/crossplane/issues/92

This returns to our historical behaviour of creating managed resources in the
namespace of thier resource class, not that of their resource claim. I believe
this pattern to be flawed, but mostly changed it in order to leverage owner
references (which cannot cross namespaces) in order to allow a claim to watch
the resources it controls.

Instead we maintain the historical behaviour for the time being, using a custom
event handler to enqueue requests for a resource's claim (reference).

Signed-off-by: Nic Cope <negz@rk0n.org>
2019-06-27 00:20:40 -07:00
Nic Cope 6e3d341349 Follow API conventions for object reference fields
I had previously attempted to standardise on fooReference for an ObjectReference
to a Foo, because we had a mix of fooRef and fooReference. Turns out the API
conventions document has a position on this and says we should use fooRef. I've
kept the actual Go fields named 'FooReference' for readability, but renamed the
struct tags to 'fooRef'. I've also renamed 'writeConnectionSecretTo' to
'writeConnectionSecretToRef' since it is also a reference.

https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#object-references

Signed-off-by: Nic Cope <negz@rk0n.org>
2019-06-26 11:40:11 -07:00
Nic Cope a893baf2e8 Rename the ManagedResource interface to Managed
This way it reads resource.Managed, not resource.ManagedResource.

Signed-off-by: Nic Cope <negz@rk0n.org>
2019-06-24 16:10:18 -07:00
Nic Cope 4f2af2ec96 Replace the core resource and claim interfaces
Signed-off-by: Nic Cope <negz@rk0n.org>
2019-06-24 11:51:22 -07:00