Commit Graph

22 Commits

Author SHA1 Message Date
Nic Cope 0c7b1eb549 Bump golangci-lint, copy config from c/c
This copies the latest config from c/c and addresses all the linter
errors that config produces.

Signed-off-by: Nic Cope <nicc@rk0n.org>
2024-02-20 03:45:27 -08:00
Hasan Turken 11e9468944
Cleanup deprecated stuff that are no longer used
Signed-off-by: Hasan Turken <turkenh@gmail.com>
2023-08-11 13:02:54 +03:00
Nic Cope bce61005a1
Merge pull request #355 from nokia/respect_finalizers
Support foreground cascading deletion
2022-10-11 18:39:34 -07:00
Bob Haddleton da77f4e104 Add blockOwnerDeletion: true and compositeDeletePolicy
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
2022-10-11 09:35:04 -05:00
Alper Rifat Ulucinar eaa6119f23
Add meta.IsPaused that checks whether reconciliations are paused for the managed resource
Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
2022-09-30 01:24:50 +03:00
Nic Cope af4e148a11 Replace github.com/pkg/errors with our own pkg/errors.
Signed-off-by: Nic Cope <negz@rk0n.org>
2021-09-09 07:50:57 +00:00
Nic Cope 8e780ecd6d Don't rely on removal of the external-create-pending annotation
The retry logic we use to persist critical annotations makes it difficult to
delete an annotation without potentially also deleting annotations added by
another controller (e.g. the composition logic). This commit therefore changes
the way we detect whether we might have created an external resource but not
recorded the result. Previously we relied on the presence of the 'pending'
annotation to detect this state. Now we check whether the 'pending' annotation
is newer than any 'succeeded' or 'failed' annotation.

Signed-off-by: Nic Cope <negz@rk0n.org>
2021-09-03 04:41:00 +00:00
Nic Cope a3a59c95b6 Account for two different kinds of consistency issues
This commit is intended to address two issues that we diagnosed while
investigating https://github.com/crossplane/provider-aws/issues/802.

The first issue is that controller-runtime does not guarantee reads from cache
will return the freshest version of a resource. It's possible we could create an
external resource in one reconcile, then shortly after trigger another in which
it appears that the managed resource was never created because we didn't record
its external-name. This only affects the subset of managed resources with
non-deterministic external-names that are assigned during creation.

The second issue is that some external APIs are eventually consistent. A newly
created external resource may take some time before our ExternalClient's observe
call can confirm it exists. AWS EC2 is an example of one such API.

This commit attempts to address the first issue by making an Update to a managed
resource immediately before Create it called. This Update call will be rejected
by the API server if the managed resource we read from cache was not the latest
version.

It attempts to address the second issue by allowing managed resource controller
authors to configure an optional grace period that begins when an external
resource is successfully created. During this grace period we'll requeue and
keep waiting if Observe determines that the external resource doesn't exist,
rather than (re)creating it.

Signed-off-by: Nic Cope <negz@rk0n.org>
2021-09-01 06:04:31 +00:00
hasheddan 0b27607592
Update core/v1alpha1 imports to common/v1
Updates all core/v1alpha1 imports to the common/v1, which is the new
home of these embedded API types.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-11-19 20:03:48 -06:00
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
hasheddan c9515a5a0e
Add TypedReferenceTo meta utility
Adds a TypedReferenceTo utility function that matches the ReferenceTo
implementation for ObjectReference, but returns a TypedReference
instead.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-09-07 12:34:48 -05: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
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
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
muvaffak onus d72012f1c2 Use managed resource name as external name (#45)
* - Introduces Initializer hook to managed reconciler.
- ManagedNameAsExternalName is introduced and used
  by default by all managed reconcilers.

Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>

* GetExternalName and SetExternalName functions are implemented

Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>

* - Unit tests for ManagedNameAsExternalName struct
- Move ExternalNameAnnotationKey into meta package.

Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>

* Remove Establisher mechanism and port existing
establisher to Initializer.

Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>

* Fix claim's external name annotation propagation to
the managed resource.

Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2019-10-15 10:23:05 -07: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
Nic Cope b3da55f2be Update all copyrights to 2019
This commit was generated via s/Copyright 2018/Copyright 2019/g

Signed-off-by: Nic Cope <negz@rk0n.org>
2019-07-10 20:16:40 -07:00
Nic Cope 68a7580935 Add new resource claim reconciler.
Signed-off-by: Nic Cope <negz@rk0n.org>
2019-06-24 23:47:11 -07:00
Nic Cope 362f74e468 Add a handful more handy metadata utilities
Signed-off-by: Nic Cope <negz@rk0n.org>
2019-06-24 16:10:18 -07:00
Nic Cope 705d4407c5 Refactor ReferenceTo to take an explicit Group, Version, and Kind.
We don't seem to be able to rely on Go objects retaining type metadata
when deserialised. I've read (but not confirmed) that the decoding process
strips out TypeMeta, and observed TypeMeta disappearing during an Update()
call.

This API mirrors that of metav1.NewControllerRef. The caller can still attempt
to use TypeMeta if it is known to exist, i.e.:

```go
ref := meta.ReferenceTo(o, o.GetObjectKind().GroupVersionKind())
```

Signed-off-by: Nic Cope <negz@rk0n.org>
2019-06-11 12:58:04 -07:00
Nic Cope 5698dd7243 Add a metadata package
This contains some utilities moved out of util, as well as some new tools.

Signed-off-by: Nic Cope <negz@rk0n.org>
2019-06-11 12:49:03 -07:00