Commit Graph

54 Commits

Author SHA1 Message Date
hasheddan 10b4720142
Replace ProviderConfigSpec with embeddable CredentialsSelectors
To allow for more flexible credential methods, we provide common
selectors but do not enforce source enum or restrict from adding
additional selectors. The CredentialsSelectors are meant to be embedded
inline in a ProviderConfig's spec.credentials object.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2021-02-01 16:11:47 -06:00
hasheddan 52cc9b82b7
Move embedded API types to v1
Moves the core embedded API types out of the core/v1alpha1 directory and
into common/v1. These types are used by many mature APIs and are now
recognized as stable. This new package should be imported with alias
xpv1 by convention.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-11-19 20:01:01 -06:00
Nic Cope ab7ab7c7c2 Add docstring and enum validation for credentials secret source
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-10-07 15:20:16 -07:00
Nic Cope a0ec116066 Rename 'Native' credentials source to 'InjectedIdentity'
After some discussion amongst the community we felt this more accurately
represents a credentials source where credentials are derived from the
provider pod's identity (i.e. env vars, files, etc).

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-10-06 21:25:59 -07:00
Nic Cope 407dc9fa43 Introduce a distinct ProviderConfig credentials field
This field distinguishes credentials configuration from other (currently
hypothetical) aspects of provider configuration. It also introduces a
'spec.credentials.source' field that can be used to determine which credentials
source the provider intends to use.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-10-05 20:05:01 -07:00
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 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
Nic Cope 1121c851c5 Remove or relocate deprecated status conditions
The references resolved condition was marked deprecated in v0.8 and has no known
callers. The secret resolution success condition is only used by the target
controller.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-09-09 15:14:24 -07:00
Nic Cope 5b15db1f2a Make core status conditions CamelCase per API conventions
https://github.com/kubernetes/community/blob/493639d/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-09-09 14:47:24 -07:00
Nic Cope f5756503c5 Remove dependency on crossplane-tools
I'm not sure how we ended up with this, given it isn't used/

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-09-04 17:15:26 -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 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 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
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 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
hasheddan 7d845c0a81
Add TypedObjectReference and use in OAM reconcilers
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-03-18 21:49:28 -05: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
hasheddan 15f69fb086 Make ProviderSpec credentialsSecretRef optional
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-02-11 11:34:08 -06:00
Nic Cope e41c4d2743 Bump build submodule
https://github.com/upbound/build/pull/88

This results in a diff because we no longer run goimports on generated files.

Signed-off-by: Nic Cope <negz@rk0n.org>
2020-01-31 00:05:47 -08:00
hasheddan 653dcda743 go version: update to 1.13.5
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-01-14 23:47:52 -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 d449ca546b
make wording in conditions to cover resources other than managed ones
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2019-12-30 18:31:14 +03:00
Muvaffak Onus fb6ac48df5
add providerspec that will be used to satisfy Provider interface
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2019-12-20 12:40:54 +03:00
Nic Cope ca4b6b46c9 Mirror PersistentVolume ReclaimPolicy semantics
This commit changes the meaning of the resource claim resource policy to match
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#reclaiming as
closely as possible, minus the deprecated 'Recycle' policy. Previously the
reclaim policy dictated only what happened to the external resource when its
managed resource was deleted.

Signed-off-by: Nic Cope <negz@rk0n.org>
2019-11-19 14:43:25 -08:00
Muvaffak Onus 4ed7edad48
Add kubeconfig key to be used in connection secrets of kubernetes clusters
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2019-11-14 20:20:18 +03:00
Nic Cope bc04c33519 Resolve references on every reconcile
Reference resolution is now a no-op if nothing changes, so we run it on every
reconcile. We also run it after delete has been handled, so unresolved
references will only block creates and updates.

This commit means we'll make more get calls to the cache (or API) in order to
resolve our references each reconcile, and also risk potentially changing the
values of 'immutable' fields automatically if and when our references resources
change. I believe we should address this by having referencers be no-ops when
the field value they would set is already set.

I attempted to move reference resolution to right before we call create or
update (i.e. after observe and delete), but it turns out certain resources
(specifically GCP Connections) could need references to be resolved in order to
observe the external resource.

Signed-off-by: Nic Cope <negz@rk0n.org>
2019-10-31 16:11:10 -07:00
Nic Cope 604cfc074e Fix grammar in reference resolution condition message
Signed-off-by: Nic Cope <negz@rk0n.org>
2019-10-31 13:27:30 -07:00
Nic Cope eb0bb8b34f Work around strange deepcopy bug
Signed-off-by: Nic Cope <negz@rk0n.org>
2019-10-22 17:13:21 -07: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
Muvaffak Onus 516d642cd1 add port key to connection secret key constants
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2019-10-22 17:00:57 +03:00
soorena776 f063ec82d3 - Removing class level reference resolution if we can get away with it
- Removing the panic recovery logic
- Removing the superfluous IsConditionReady method
- Adding Nic's unit-tests for GetCondition and IsConditionTrue
- Minor other fixes

Signed-off-by: soorena776 <javad@upbound.io>
2019-10-21 17:05:15 -07:00
soorena776 8df7f7cab7 Change ReferenceResolver signature to accept CanReference type instead of Managed
Signed-off-by: soorena776 <javad@upbound.io>
2019-10-21 16:39:26 -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
soorena776 7541bae8e5 Migrate from `dep` to `go mod`
Signed-off-by: soorena776 <javad@upbound.io>
2019-10-16 11:36:49 -07:00
Hasan Turken d449ffd87a Add WithMessage method on Condition
Signed-off-by: Hasan Turken <turkenh@gmail.com>
2019-10-09 13:02:09 +03:00
Hasan Turken 2dc5eb54f1 Add UnavailableWithMessage condition helper
Signed-off-by: Hasan Turken <turkenh@gmail.com>
2019-10-08 16:24:11 +03:00
Nic Cope 25243ed326 Clean up GoDoc for API types
The GoDoc strings for the API types are used to generate user visible
documentation, for example the API documentation and CRD fields. This commit
ensures the GoDoc is complete, and makes sense in the context of user facing
documentation.

Signed-off-by: Nic Cope <negz@rk0n.org>
2019-09-13 18:21:39 -07:00
Nic Cope 633d937901 Update core APIs package doc
The groupName directive must be in doc.go and associated with the package
comment to support doc generation.

Signed-off-by: Nic Cope <negz@rk0n.org>
2019-09-11 23:19:52 -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 eb54c78f96 runtime migration: add resrource credentials secrets
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2019-08-21 10:05:00 -05:00