I thought this would help with compatibility, but unfortunately this
package has breaking changes that will affect anyone who was using these
types regardless.
Signed-off-by: Nic Cope <nicc@rk0n.org>
This required some updates to our implementations of client.Client,
which now has a generic SubResource sub-client.
Signed-off-by: Nic Cope <nicc@rk0n.org>
I tried to address this TODO today, but found that I kind of prefer how our
implementation works. I've found from time to time while writing tests that
I was accidentally wrapping my errors with the wrong context (i.e. message),
which is not something the cmpopts variant tests for.
Signed-off-by: Nic Cope <negz@rk0n.org>
This updates the controller-runtime and all of its dependencies to the
latest release.
This includes a bunch of changes which break backwards compatibility
introduced by controller-runtime 0.7.0 and 0.8.0, for example:
> A number of methods that previously took runtime.Object & internally
> type-asserted them to metav1.Object now take client.Object (for non-list
> objects) or client.ObjectList (for lists). The practical upshot of this
> is more type-safety and clarity around what's required for particular
> methods.
> All concrete API types (anything that implements runtime.Object & has
> a metadata field) already implement client.Object or client.ObjectList,
> so practical impact should be limited to folks who pass around
> runtime.Object values instead of concrete types.
Signed-off-by: Sascha Grunert <mail@saschagrunert.de>
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>
This guards against subsequent tests failing because
they are installing the same CRDs that we being deleted.
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
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>
There's _a lot_ going on in this commit. I've updated all resources to use the
embedded ResourceSpec, ResourceStatus, ResourceClaimSpec, etc structs and added
methods to ensure they satisfy the Resource and Claim interfaces.
I've also updated all controllers to suit. I've tried my best to limit the scope
of these changes to switching all controllers and their tests to:
* Use the new ConditionedStatus
* Use their WriteConnectionSecretTo field instead of generating a secret name
* Use the new ProviderReference field (which supports referencing Providers in
a different namespace)
I also updated many tests to use the '-want, +got' style annotation. This came
into scope mostly for my own sanity, as it allows me to read all test output the
same way when updating tests across many packages.
Signed-off-by: Nic Cope <negz@rk0n.org>
In all cases these updates address the fact that go-cmp requires the caller to
specify explicitly how it should handle unexported fields; cmp.Diff will
panic if it encounters an unexpected unexported field.
In many cases we encounter unexported fields while comparing errors types from
github.com/pkg/error. I've added an EquateErrors() comparer that maintains the
error comparison semantics of https://github.com/go-test/deep.
In most other cases I've also attempted to maintain the comparison semantics of
https://github.com/go-test/deep, which is to ignore unexported fields. In cases
where the test appeared to intend to compare the unexported fields of a type
under our control, and where comparing those unexported fields did not break the
test, I updated the test to compare unexported fields. In cases where the test
appeared to intend to compare unexported fields, but doing so broke the test, I
added a BUG comment.
Signed-off-by: Nic Cope <negz@rk0n.org>
Note this refers to 'complex workloads' under the workload.crossplane.io API
group. An earlier version of the workload and scheduler controllers exists
under compute.crossplane.io.
Signed-off-by: Nic Cope <negz@rk0n.org>
Both of these are false positives. We don't know exactly how long the slice will
be when we declare it. We should keep an eye on this linter to see how often it
catches real issues.
Signed-off-by: Nic Cope <negz@rk0n.org>
A name is said to 'stutter' when its name begins with the package name, so
callers would for example type `foo.FooClient` rather than `foo.Client`.
Signed-off-by: Nic Cope <negz@rk0n.org>
This commit should only touch comments, or make types private to avoid them
needing a comment when they're not consumed outside their own package.
Signed-off-by: Nic Cope <negz@rk0n.org>
I've experimented with a new pattern for the CloudMemorystore controller. My
goal was to achieve the testability of the existing blessed pattern (i.e.
replacable connect, create, sync, and delete methods), but with a stronger
decoupling of the components we'd like to test separately.
In my design Reconciler takes a connecter interface that knows how to return a
createsyncdeleter, i.e. an interface that can create, sync, and delete instances
with some external store. We instantiate a new createsyncdeleter on each
reconcile loop, allowing us to potentially use different credentials each run.
I also removed use of the Kubernetes clientset, which was used a few places in
other controllers despite (as best I can tell) being functionally equivalent to
the controller runtime client.Client.
Signed-off-by: Nic Cope <negz@rk0n.org>