diff --git a/.github/workflows/configurations.yml b/.github/workflows/configurations.yml
new file mode 100644
index 000000000..c9201870f
--- /dev/null
+++ b/.github/workflows/configurations.yml
@@ -0,0 +1,130 @@
+name: Configurations
+
+on:
+ push:
+ branches:
+ - master
+ - release-*
+ workflow_dispatch: {}
+
+env:
+ DOCKER_USR: ${{ secrets.UPBOUND_XP_ROBOT_USR }}
+
+jobs:
+ getting-started-with-aws:
+ runs-on: ubuntu-18.04
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ submodules: true
+ fetch-depth: 0
+ # The tagger step uses the same logic in the build submodule to generate package tag
+ # https://github.com/upbound/build/blob/4f64913157a952dbe77cd9e05457d9abe695a1d4/makelib/common.mk#L193
+ - name: Set tag
+ run: echo "::set-output name=VERSION_TAG::$(git describe --dirty --always --tags | sed 's/-/./2' | sed 's/-/./2' )"
+ id: tagger
+ - name: Login to Docker
+ uses: docker/login-action@v1
+ if: env.DOCKER_USR != ''
+ with:
+ registry: registry.upbound.io
+ username: ${{ secrets.UPBOUND_XP_ROBOT_USR }}
+ password: ${{ secrets.UPBOUND_XP_ROBOT_PSW }}
+ - name: Build
+ uses: crossplane-contrib/xpkg-action@v0.2.0
+ with:
+ channel: master
+ version: current
+ command: build configuration -f docs/snippets/package/aws --name=getting-started-with-aws.xpkg
+ - name: Push
+ uses: crossplane-contrib/xpkg-action@v0.2.0
+ with:
+ command: push configuration -f docs/snippets/package/aws/getting-started-with-aws.xpkg registry.upbound.io/xp/getting-started-with-aws:${{ steps.tagger.outputs.VERSION_TAG }}
+
+ getting-started-with-aws-with-vpc:
+ runs-on: ubuntu-18.04
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ submodules: true
+ fetch-depth: 0
+ - name: Set tag
+ run: echo "::set-output name=VERSION_TAG::$(git describe --dirty --always --tags | sed 's/-/./2' | sed 's/-/./2' )"
+ id: tagger
+ - name: Login to Docker
+ uses: docker/login-action@v1
+ if: env.DOCKER_USR != ''
+ with:
+ registry: registry.upbound.io
+ username: ${{ secrets.UPBOUND_XP_ROBOT_USR }}
+ password: ${{ secrets.UPBOUND_XP_ROBOT_PSW }}
+ - name: Build
+ uses: crossplane-contrib/xpkg-action@v0.2.0
+ with:
+ channel: master
+ version: current
+ command: build configuration -f docs/snippets/package/aws-with-vpc --name=getting-started-with-aws-with-vpc.xpkg
+ - name: Push
+ uses: crossplane-contrib/xpkg-action@v0.2.0
+ with:
+ command: push configuration -f docs/snippets/package/aws-with-vpc/getting-started-with-aws-with-vpc.xpkg registry.upbound.io/xp/getting-started-with-aws-with-vpc:${{ steps.tagger.outputs.VERSION_TAG }}
+
+ getting-started-with-gcp:
+ runs-on: ubuntu-18.04
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ submodules: true
+ fetch-depth: 0
+ - name: Set tag
+ run: echo "::set-output name=VERSION_TAG::$(git describe --dirty --always --tags | sed 's/-/./2' | sed 's/-/./2' )"
+ id: tagger
+ - name: Login to Docker
+ uses: docker/login-action@v1
+ if: env.DOCKER_USR != ''
+ with:
+ registry: registry.upbound.io
+ username: ${{ secrets.UPBOUND_XP_ROBOT_USR }}
+ password: ${{ secrets.UPBOUND_XP_ROBOT_PSW }}
+ - name: Build
+ uses: crossplane-contrib/xpkg-action@v0.2.0
+ with:
+ channel: master
+ version: current
+ command: build configuration -f docs/snippets/package/gcp --name=getting-started-with-gcp.xpkg
+ - name: Push
+ uses: crossplane-contrib/xpkg-action@v0.2.0
+ with:
+ command: push configuration -f docs/snippets/package/gcp/getting-started-with-gcp.xpkg registry.upbound.io/xp/getting-started-with-gcp:${{ steps.tagger.outputs.VERSION_TAG }}
+
+ getting-started-with-azure:
+ runs-on: ubuntu-18.04
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ submodules: true
+ fetch-depth: 0
+ - name: Set tag
+ run: echo "::set-output name=VERSION_TAG::$(git describe --dirty --always --tags | sed 's/-/./2' | sed 's/-/./2' )"
+ id: tagger
+ - name: Login to Docker
+ uses: docker/login-action@v1
+ if: env.DOCKER_USR != ''
+ with:
+ registry: registry.upbound.io
+ username: ${{ secrets.UPBOUND_XP_ROBOT_USR }}
+ password: ${{ secrets.UPBOUND_XP_ROBOT_PSW }}
+ - name: Build
+ uses: crossplane-contrib/xpkg-action@v0.2.0
+ with:
+ channel: master
+ version: current
+ command: build configuration -f docs/snippets/package/azure --name=getting-started-with-azure.xpkg
+ - name: Push
+ uses: crossplane-contrib/xpkg-action@v0.2.0
+ with:
+ command: push configuration -f docs/snippets/package/azure/getting-started-with-azure.xpkg registry.upbound.io/xp/getting-started-with-azure:${{ steps.tagger.outputs.VERSION_TAG }}
diff --git a/docs/concepts/managed-resources.md b/docs/concepts/managed-resources.md
index 4a99a73d7..5a4f4dc1e 100644
--- a/docs/concepts/managed-resources.md
+++ b/docs/concepts/managed-resources.md
@@ -40,7 +40,7 @@ of Crossplane managed resources. Following is an example of a managed resource:
-The AWS provider supports provisioning an [RDS] instance via the `RDSInstance`
+The AWS provider supports provisioning an [RDS][rds] instance via the `RDSInstance`
managed resource it adds to Crossplane.
```yaml
@@ -89,7 +89,7 @@ kubectl delete rdsinstance rdspostgresql
-The GCP provider supports provisioning a [CloudSQL] instance with the
+The GCP provider supports provisioning a [CloudSQL][cloudsql] instance with the
`CloudSQLInstance` managed resource it adds to Crossplane.
```yaml
@@ -438,6 +438,8 @@ using needs to store `annotations` and `spec` fields, which most tools do
including Velero.
[term-xrm]: terminology.md#crossplane-resource-model
+[rds]: https://aws.amazon.com/rds/
+[cloudsql]: https://cloud.google.com/sql
[composition]: composition.md
[api-versioning]: https://kubernetes.io/docs/reference/using-api/api-overview/#api-versioning
[velero]: https://velero.io/
diff --git a/docs/getting-started/create-configuration.md b/docs/getting-started/create-configuration.md
index e01e09eee..a8cfbcc7d 100644
--- a/docs/getting-started/create-configuration.md
+++ b/docs/getting-started/create-configuration.md
@@ -591,7 +591,7 @@ you may specify a specific package by using the `-f` flag.
```console
# Set this to the Docker Hub username or OCI registry you wish to use.
REG=my-package-repo
-kubectl crossplane push configuration ${REG}/getting-started-with-aws:v1.7.0
+kubectl crossplane push configuration ${REG}/getting-started-with-aws:v1.7.2
```
> Note that the Crossplane CLI will not follow symbolic links for files in the
@@ -631,7 +631,7 @@ you may specify a specific package by using the `-f` flag.
```console
# Set this to the Docker Hub username or OCI registry you wish to use.
REG=my-package-repo
-kubectl crossplane push configuration ${REG}/getting-started-with-aws-with-vpc:v1.7.0
+kubectl crossplane push configuration ${REG}/getting-started-with-aws-with-vpc:v1.7.2
```
> Note that the Crossplane CLI will not follow symbolic links for files in the
@@ -670,7 +670,7 @@ you may specify a specific package by using the `-f` flag.
```console
# Set this to the Docker Hub username or OCI registry you wish to use.
REG=my-package-repo
-kubectl crossplane push configuration ${REG}/getting-started-with-gcp:v1.7.0
+kubectl crossplane push configuration ${REG}/getting-started-with-gcp:v1.7.2
```
> Note that the Crossplane CLI will not follow symbolic links for files in the
@@ -709,7 +709,7 @@ you may specify a specific package by using the `-f` flag.
```console
# Set this to the Docker Hub username or OCI registry you wish to use.
REG=my-package-repo
-kubectl crossplane push configuration ${REG}/getting-started-with-azure:v1.7.0
+kubectl crossplane push configuration ${REG}/getting-started-with-azure:v1.7.2
```
> Note that the Crossplane CLI will not follow symbolic links for files in the
diff --git a/docs/getting-started/install-configure.md b/docs/getting-started/install-configure.md
index 445332e3b..2b35edd38 100644
--- a/docs/getting-started/install-configure.md
+++ b/docs/getting-started/install-configure.md
@@ -243,7 +243,7 @@ provider that can satisfy a `PostgreSQLInstance`. Let's get started!
> section.
```console
-kubectl crossplane install configuration registry.upbound.io/xp/getting-started-with-aws:v1.7.0
+kubectl crossplane install configuration registry.upbound.io/xp/getting-started-with-aws:v1.7.2
```
Wait until all packages become healthy:
@@ -300,7 +300,7 @@ kubectl apply -f https://raw.githubusercontent.com/crossplane/crossplane/release
> section.
```console
-kubectl crossplane install configuration registry.upbound.io/xp/getting-started-with-aws-with-vpc:v1.7.0
+kubectl crossplane install configuration registry.upbound.io/xp/getting-started-with-aws-with-vpc:v1.7.2
```
Wait until all packages become healthy:
@@ -357,7 +357,7 @@ kubectl apply -f https://raw.githubusercontent.com/crossplane/crossplane/release
> section.
```console
-kubectl crossplane install configuration registry.upbound.io/xp/getting-started-with-gcp:v1.7.0
+kubectl crossplane install configuration registry.upbound.io/xp/getting-started-with-gcp:v1.7.2
```
Wait until all packages become healthy:
@@ -430,7 +430,7 @@ spec:
> section.
```console
-kubectl crossplane install configuration registry.upbound.io/xp/getting-started-with-azure:v1.7.0
+kubectl crossplane install configuration registry.upbound.io/xp/getting-started-with-azure:v1.7.2
```
Wait until all packages become healthy:
diff --git a/docs/reference/xpkg.md b/docs/reference/xpkg.md
index 3e4b1bd17..e78f035f4 100644
--- a/docs/reference/xpkg.md
+++ b/docs/reference/xpkg.md
@@ -14,9 +14,9 @@ installing objects that configure new resource types, and starting controllers
to reconcile them. An OCI image that contains valid Crossplane package content
is commonly referred to as an `xpkg` ("ex-package"). This document provides the
specification for a valid `xpkg`, which can be considered a superset of the
-requirements detailed in [OCI image specification]. It is divided into two broad
-sections: requirements related to OCI image format and requirements related to
-Crossplane `package.yaml` contents.
+requirements detailed in the [OCI image specification]. It is divided into two
+broad sections: requirements related to OCI image format and requirements
+related to Crossplane `package.yaml` contents.
- [OCI Image Format](#oci-image-format)
- [Indexes](#indexes)
diff --git a/internal/controller/apiextensions/claim/reconciler.go b/internal/controller/apiextensions/claim/reconciler.go
index a2f9a43e5..be79cb1ce 100644
--- a/internal/controller/apiextensions/claim/reconciler.go
+++ b/internal/controller/apiextensions/claim/reconciler.go
@@ -408,7 +408,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reco
}
if err := r.claim.AddFinalizer(ctx, cm); err != nil {
- log.Debug(errAddFinalizer, "error")
+ log.Debug(errAddFinalizer, "error", err)
err = errors.Wrap(err, errAddFinalizer)
record.Event(cm, event.Warning(reasonBind, err))
return reconcile.Result{}, err
diff --git a/internal/controller/apiextensions/claim/reconciler_test.go b/internal/controller/apiextensions/claim/reconciler_test.go
index c7331c1ff..203d8596b 100644
--- a/internal/controller/apiextensions/claim/reconciler_test.go
+++ b/internal/controller/apiextensions/claim/reconciler_test.go
@@ -18,6 +18,7 @@ package claim
import (
"context"
+ "io"
"testing"
"github.com/google/go-cmp/cmp"
@@ -26,11 +27,13 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/client"
+ "sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
"github.com/crossplane/crossplane-runtime/pkg/errors"
+ "github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/crossplane/crossplane-runtime/pkg/resource/fake"
"github.com/crossplane/crossplane-runtime/pkg/resource/unstructured/claim"
@@ -40,6 +43,7 @@ import (
func TestReconcile(t *testing.T) {
errBoom := errors.New("boom")
+ testLog := logging.NewLogrLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(io.Discard)).WithName("testlog"))
name := "coolclaim"
type args struct {
@@ -487,7 +491,7 @@ func TestReconcile(t *testing.T) {
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
- r := NewReconciler(tc.args.mgr, tc.args.of, tc.args.with, tc.args.opts...)
+ r := NewReconciler(tc.args.mgr, tc.args.of, tc.args.with, append(tc.args.opts, WithLogger(testLog))...)
got, err := r.Reconcile(context.Background(), reconcile.Request{})
if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" {
diff --git a/internal/controller/apiextensions/composite/reconciler.go b/internal/controller/apiextensions/composite/reconciler.go
index 8f576dc4a..246fd68ee 100644
--- a/internal/controller/apiextensions/composite/reconciler.go
+++ b/internal/controller/apiextensions/composite/reconciler.go
@@ -414,7 +414,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reco
}
if err := r.composite.RemoveFinalizer(ctx, cr); err != nil {
- log.Debug(errRemoveFinalizer, "error")
+ log.Debug(errRemoveFinalizer, "error", err)
err = errors.Wrap(err, errRemoveFinalizer)
r.record.Event(cr, event.Warning(reasonDelete, err))
return reconcile.Result{}, err
@@ -425,7 +425,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reco
}
if err := r.composite.AddFinalizer(ctx, cr); err != nil {
- log.Debug(errAddFinalizer, "error")
+ log.Debug(errAddFinalizer, "error", err)
err = errors.Wrap(err, errAddFinalizer)
r.record.Event(cr, event.Warning(reasonInit, err))
return reconcile.Result{}, err
diff --git a/internal/controller/apiextensions/composite/reconciler_test.go b/internal/controller/apiextensions/composite/reconciler_test.go
index 34c01079e..d7c96ea8d 100644
--- a/internal/controller/apiextensions/composite/reconciler_test.go
+++ b/internal/controller/apiextensions/composite/reconciler_test.go
@@ -18,6 +18,7 @@ package composite
import (
"context"
+ "io"
"testing"
"github.com/google/go-cmp/cmp"
@@ -27,10 +28,12 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/utils/pointer"
"sigs.k8s.io/controller-runtime/pkg/client"
+ "sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"github.com/crossplane/crossplane-runtime/pkg/errors"
+ "github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/crossplane/crossplane-runtime/pkg/reconciler/managed"
"github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/crossplane/crossplane-runtime/pkg/resource/fake"
@@ -42,6 +45,7 @@ import (
func TestReconcile(t *testing.T) {
errBoom := errors.New("boom")
+ testLog := logging.NewLogrLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(io.Discard)).WithName("testlog"))
cd := managed.ConnectionDetails{"a": []byte("b")}
type args struct {
@@ -840,7 +844,7 @@ func TestReconcile(t *testing.T) {
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
- r := NewReconciler(tc.args.mgr, tc.args.of, tc.args.opts...)
+ r := NewReconciler(tc.args.mgr, tc.args.of, append(tc.args.opts, WithLogger(testLog))...)
got, err := r.Reconcile(context.Background(), reconcile.Request{})
if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" {
diff --git a/internal/controller/apiextensions/composition/reconciler_test.go b/internal/controller/apiextensions/composition/reconciler_test.go
index 3e3616c6c..ee9656b0d 100644
--- a/internal/controller/apiextensions/composition/reconciler_test.go
+++ b/internal/controller/apiextensions/composition/reconciler_test.go
@@ -18,6 +18,7 @@ package composition
import (
"context"
+ "io"
"testing"
"github.com/google/go-cmp/cmp"
@@ -26,11 +27,13 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
+ "sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
"github.com/crossplane/crossplane-runtime/pkg/errors"
+ "github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/crossplane/crossplane-runtime/pkg/resource/fake"
"github.com/crossplane/crossplane-runtime/pkg/test"
v1 "github.com/crossplane/crossplane/apis/apiextensions/v1"
@@ -39,6 +42,7 @@ import (
func TestReconcile(t *testing.T) {
errBoom := errors.New("boom")
+ testLog := logging.NewLogrLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(io.Discard)).WithName("testlog"))
ctrl := true
comp := &v1.Composition{
@@ -324,7 +328,7 @@ func TestReconcile(t *testing.T) {
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
- r := NewReconciler(tc.args.mgr, tc.args.opts...)
+ r := NewReconciler(tc.args.mgr, append(tc.args.opts, WithLogger(testLog))...)
got, err := r.Reconcile(context.Background(), reconcile.Request{})
if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" {
diff --git a/internal/controller/apiextensions/definition/reconciler_test.go b/internal/controller/apiextensions/definition/reconciler_test.go
index 467ef3ed7..5f549fd42 100644
--- a/internal/controller/apiextensions/definition/reconciler_test.go
+++ b/internal/controller/apiextensions/definition/reconciler_test.go
@@ -18,6 +18,7 @@ package definition
import (
"context"
+ "io"
"testing"
"github.com/google/go-cmp/cmp"
@@ -29,11 +30,13 @@ import (
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
kcontroller "sigs.k8s.io/controller-runtime/pkg/controller"
+ "sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"github.com/crossplane/crossplane-runtime/pkg/controller"
"github.com/crossplane/crossplane-runtime/pkg/errors"
+ "github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/crossplane/crossplane-runtime/pkg/resource/fake"
"github.com/crossplane/crossplane-runtime/pkg/test"
@@ -61,6 +64,7 @@ func (m *MockEngine) Err(name string) error {
func TestReconcile(t *testing.T) {
errBoom := errors.New("boom")
+ testLog := logging.NewLogrLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(io.Discard)).WithName("testlog"))
now := metav1.Now()
owner := types.UID("definitely-a-uuid")
ctrlr := true
@@ -656,7 +660,7 @@ func TestReconcile(t *testing.T) {
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
- r := NewReconciler(tc.args.mgr, tc.args.opts...)
+ r := NewReconciler(tc.args.mgr, append(tc.args.opts, WithLogger(testLog))...)
got, err := r.Reconcile(context.Background(), reconcile.Request{})
if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" {
diff --git a/internal/controller/apiextensions/offered/reconciler_test.go b/internal/controller/apiextensions/offered/reconciler_test.go
index f7d616d91..36a56a181 100644
--- a/internal/controller/apiextensions/offered/reconciler_test.go
+++ b/internal/controller/apiextensions/offered/reconciler_test.go
@@ -18,6 +18,7 @@ package offered
import (
"context"
+ "io"
"testing"
"github.com/google/go-cmp/cmp"
@@ -29,11 +30,13 @@ import (
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
kcontroller "sigs.k8s.io/controller-runtime/pkg/controller"
+ "sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"github.com/crossplane/crossplane-runtime/pkg/controller"
"github.com/crossplane/crossplane-runtime/pkg/errors"
+ "github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/crossplane/crossplane-runtime/pkg/resource/fake"
"github.com/crossplane/crossplane-runtime/pkg/test"
@@ -61,6 +64,7 @@ func (m *MockEngine) Err(name string) error {
func TestReconcile(t *testing.T) {
errBoom := errors.New("boom")
+ testLog := logging.NewLogrLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(io.Discard)).WithName("testlog"))
now := metav1.Now()
owner := types.UID("definitely-a-uuid")
ctrlr := true
@@ -663,7 +667,7 @@ func TestReconcile(t *testing.T) {
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
- r := NewReconciler(tc.args.mgr, tc.args.opts...)
+ r := NewReconciler(tc.args.mgr, append(tc.args.opts, WithLogger(testLog))...)
got, err := r.Reconcile(context.Background(), reconcile.Request{})
if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" {
diff --git a/internal/controller/pkg/manager/reconciler_test.go b/internal/controller/pkg/manager/reconciler_test.go
index 83982f5c2..c3d24bb50 100644
--- a/internal/controller/pkg/manager/reconciler_test.go
+++ b/internal/controller/pkg/manager/reconciler_test.go
@@ -18,6 +18,7 @@ package manager
import (
"context"
+ "io"
"testing"
"github.com/google/go-cmp/cmp"
@@ -27,6 +28,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
+ "sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"github.com/crossplane/crossplane-runtime/pkg/errors"
@@ -54,6 +56,7 @@ func (m *MockRevisioner) Revision(context.Context, v1.Package) (string, error) {
func TestReconcile(t *testing.T) {
errBoom := errors.New("boom")
+ testLog := logging.NewLogrLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(io.Discard)).WithName("testlog"))
pullAlways := corev1.PullAlways
trueVal := true
revHistory := int64(1)
@@ -81,7 +84,7 @@ func TestReconcile(t *testing.T) {
client: resource.ClientApplicator{
Client: &test.MockClient{MockGet: test.NewMockGetFn(kerrors.NewNotFound(schema.GroupResource{}, ""))},
},
- log: logging.NewNopLogger(),
+ log: testLog,
},
},
want: want{
@@ -97,7 +100,7 @@ func TestReconcile(t *testing.T) {
client: resource.ClientApplicator{
Client: &test.MockClient{MockGet: test.NewMockGetFn(errBoom)},
},
- log: logging.NewNopLogger(),
+ log: testLog,
},
},
want: want{
@@ -117,7 +120,7 @@ func TestReconcile(t *testing.T) {
MockList: test.NewMockListFn(errBoom),
},
},
- log: logging.NewNopLogger(),
+ log: testLog,
record: event.NewNopRecorder(),
},
},
@@ -164,7 +167,7 @@ func TestReconcile(t *testing.T) {
pkg: &MockRevisioner{
MockRevision: NewMockRevisionFn("test-1234567", nil),
},
- log: logging.NewNopLogger(),
+ log: testLog,
record: event.NewNopRecorder(),
},
},
@@ -213,7 +216,7 @@ func TestReconcile(t *testing.T) {
pkg: &MockRevisioner{
MockRevision: NewMockRevisionFn("test-1234567", nil),
},
- log: logging.NewNopLogger(),
+ log: testLog,
record: event.NewNopRecorder(),
},
},
@@ -260,7 +263,7 @@ func TestReconcile(t *testing.T) {
pkg: &MockRevisioner{
MockRevision: NewMockRevisionFn("test-1234567", nil),
},
- log: logging.NewNopLogger(),
+ log: testLog,
record: event.NewNopRecorder(),
},
},
@@ -318,7 +321,7 @@ func TestReconcile(t *testing.T) {
pkg: &MockRevisioner{
MockRevision: NewMockRevisionFn("test-1234567", nil),
},
- log: logging.NewNopLogger(),
+ log: testLog,
record: event.NewNopRecorder(),
},
},
@@ -396,7 +399,7 @@ func TestReconcile(t *testing.T) {
pkg: &MockRevisioner{
MockRevision: NewMockRevisionFn("test-1234567", nil),
},
- log: logging.NewNopLogger(),
+ log: testLog,
record: event.NewNopRecorder(),
},
},
@@ -455,7 +458,7 @@ func TestReconcile(t *testing.T) {
pkg: &MockRevisioner{
MockRevision: NewMockRevisionFn("test-1234567", nil),
},
- log: logging.NewNopLogger(),
+ log: testLog,
record: event.NewNopRecorder(),
},
},
@@ -515,7 +518,7 @@ func TestReconcile(t *testing.T) {
pkg: &MockRevisioner{
MockRevision: NewMockRevisionFn("test-1234567", nil),
},
- log: logging.NewNopLogger(),
+ log: testLog,
record: event.NewNopRecorder(),
},
},
@@ -612,7 +615,7 @@ func TestReconcile(t *testing.T) {
pkg: &MockRevisioner{
MockRevision: NewMockRevisionFn("test-1234567", nil),
},
- log: logging.NewNopLogger(),
+ log: testLog,
record: event.NewNopRecorder(),
},
},
@@ -691,7 +694,7 @@ func TestReconcile(t *testing.T) {
pkg: &MockRevisioner{
MockRevision: NewMockRevisionFn("test-1234567", nil),
},
- log: logging.NewNopLogger(),
+ log: testLog,
record: event.NewNopRecorder(),
},
},
diff --git a/internal/controller/pkg/resolver/reconciler.go b/internal/controller/pkg/resolver/reconciler.go
index 064c2ca88..1e846c15b 100644
--- a/internal/controller/pkg/resolver/reconciler.go
+++ b/internal/controller/pkg/resolver/reconciler.go
@@ -259,7 +259,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reco
// NOTE(hasheddan): consider creating event on package revision
// dictating constraints.
if addVer == "" {
- log.Debug(errNoValidVersion, errors.Errorf(errNoValidVersionFmt, dep.Identifier(), dep.Constraints))
+ log.Debug(errNoValidVersion, "error", errors.Errorf(errNoValidVersionFmt, dep.Identifier(), dep.Constraints))
return reconcile.Result{Requeue: false}, nil
}
diff --git a/internal/controller/pkg/resolver/reconciler_test.go b/internal/controller/pkg/resolver/reconciler_test.go
index 85beaf5bf..e03855f1a 100644
--- a/internal/controller/pkg/resolver/reconciler_test.go
+++ b/internal/controller/pkg/resolver/reconciler_test.go
@@ -18,6 +18,7 @@ package resolver
import (
"context"
+ "io"
"testing"
"github.com/google/go-cmp/cmp"
@@ -25,10 +26,12 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
+ "sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"github.com/crossplane/crossplane-runtime/pkg/errors"
+ "github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/crossplane/crossplane-runtime/pkg/resource/fake"
"github.com/crossplane/crossplane-runtime/pkg/test"
@@ -41,6 +44,7 @@ import (
func TestReconcile(t *testing.T) {
errBoom := errors.New("boom")
+ testLog := logging.NewLogrLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(io.Discard)).WithName("testlog"))
type args struct {
mgr manager.Manager
@@ -489,7 +493,7 @@ func TestReconcile(t *testing.T) {
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
- r := NewReconciler(tc.args.mgr, tc.args.rec...)
+ r := NewReconciler(tc.args.mgr, append(tc.args.rec, WithLogger(testLog))...)
got, err := r.Reconcile(context.Background(), reconcile.Request{})
if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" {
diff --git a/internal/controller/pkg/revision/reconciler_test.go b/internal/controller/pkg/revision/reconciler_test.go
index 826d091d1..883b91d63 100644
--- a/internal/controller/pkg/revision/reconciler_test.go
+++ b/internal/controller/pkg/revision/reconciler_test.go
@@ -31,11 +31,13 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/pointer"
"sigs.k8s.io/controller-runtime/pkg/client"
+ "sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
"github.com/crossplane/crossplane-runtime/pkg/errors"
+ "github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/crossplane/crossplane-runtime/pkg/parser"
"github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/crossplane/crossplane-runtime/pkg/resource/fake"
@@ -153,6 +155,7 @@ spec:
func TestReconcile(t *testing.T) {
errBoom := errors.New("boom")
+ testLog := logging.NewLogrLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(io.Discard)).WithName("testlog"))
now := metav1.Now()
pullPolicy := corev1.PullNever
trueVal := true
@@ -1411,7 +1414,7 @@ func TestReconcile(t *testing.T) {
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
- r := NewReconciler(tc.args.mgr, tc.args.rec...)
+ r := NewReconciler(tc.args.mgr, append(tc.args.rec, WithLogger(testLog))...)
got, err := r.Reconcile(context.Background(), reconcile.Request{})
if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" {
diff --git a/internal/controller/rbac/definition/reconciler_test.go b/internal/controller/rbac/definition/reconciler_test.go
index 9721a5ec5..4fe3160b5 100644
--- a/internal/controller/rbac/definition/reconciler_test.go
+++ b/internal/controller/rbac/definition/reconciler_test.go
@@ -18,6 +18,7 @@ package definition
import (
"context"
+ "io"
"testing"
"github.com/google/go-cmp/cmp"
@@ -27,10 +28,12 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/client"
+ "sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"github.com/crossplane/crossplane-runtime/pkg/errors"
+ "github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/crossplane/crossplane-runtime/pkg/resource/fake"
"github.com/crossplane/crossplane-runtime/pkg/test"
@@ -39,6 +42,7 @@ import (
func TestReconcile(t *testing.T) {
errBoom := errors.New("boom")
+ testLog := logging.NewLogrLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(io.Discard)).WithName("testlog"))
now := metav1.Now()
type args struct {
@@ -178,7 +182,7 @@ func TestReconcile(t *testing.T) {
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
- r := NewReconciler(tc.args.mgr, tc.args.opts...)
+ r := NewReconciler(tc.args.mgr, append(tc.args.opts, WithLogger(testLog))...)
got, err := r.Reconcile(context.Background(), reconcile.Request{})
if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" {
diff --git a/internal/controller/rbac/namespace/reconciler_test.go b/internal/controller/rbac/namespace/reconciler_test.go
index 384de076d..a985bf0ef 100644
--- a/internal/controller/rbac/namespace/reconciler_test.go
+++ b/internal/controller/rbac/namespace/reconciler_test.go
@@ -18,6 +18,7 @@ package namespace
import (
"context"
+ "io"
"testing"
"github.com/google/go-cmp/cmp"
@@ -28,10 +29,12 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/client"
+ "sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"github.com/crossplane/crossplane-runtime/pkg/errors"
+ "github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/crossplane/crossplane-runtime/pkg/resource/fake"
"github.com/crossplane/crossplane-runtime/pkg/test"
@@ -39,6 +42,7 @@ import (
func TestReconcile(t *testing.T) {
errBoom := errors.New("boom")
+ testLog := logging.NewLogrLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(io.Discard)).WithName("testlog"))
now := metav1.Now()
type args struct {
@@ -198,7 +202,7 @@ func TestReconcile(t *testing.T) {
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
- r := NewReconciler(tc.args.mgr, tc.args.opts...)
+ r := NewReconciler(tc.args.mgr, append(tc.args.opts, WithLogger(testLog))...)
got, err := r.Reconcile(context.Background(), reconcile.Request{})
if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" {
diff --git a/internal/controller/rbac/provider/binding/reconciler_test.go b/internal/controller/rbac/provider/binding/reconciler_test.go
index ac388fa66..dfc5999e4 100644
--- a/internal/controller/rbac/provider/binding/reconciler_test.go
+++ b/internal/controller/rbac/provider/binding/reconciler_test.go
@@ -18,6 +18,7 @@ package binding
import (
"context"
+ "io"
"testing"
"github.com/google/go-cmp/cmp"
@@ -26,10 +27,12 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/client"
+ "sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"github.com/crossplane/crossplane-runtime/pkg/errors"
+ "github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/crossplane/crossplane-runtime/pkg/resource/fake"
"github.com/crossplane/crossplane-runtime/pkg/test"
@@ -38,6 +41,7 @@ import (
func TestReconcile(t *testing.T) {
errBoom := errors.New("boom")
+ testLog := logging.NewLogrLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(io.Discard)).WithName("testlog"))
now := metav1.Now()
type args struct {
@@ -193,7 +197,7 @@ func TestReconcile(t *testing.T) {
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
- r := NewReconciler(tc.args.mgr, tc.args.opts...)
+ r := NewReconciler(tc.args.mgr, append(tc.args.opts, WithLogger(testLog))...)
got, err := r.Reconcile(context.Background(), reconcile.Request{})
if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" {
diff --git a/internal/controller/rbac/provider/roles/reconciler_test.go b/internal/controller/rbac/provider/roles/reconciler_test.go
index 939aa5793..da9b354da 100644
--- a/internal/controller/rbac/provider/roles/reconciler_test.go
+++ b/internal/controller/rbac/provider/roles/reconciler_test.go
@@ -18,6 +18,7 @@ package roles
import (
"context"
+ "io"
"testing"
"github.com/google/go-cmp/cmp"
@@ -28,10 +29,12 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/client"
+ "sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"github.com/crossplane/crossplane-runtime/pkg/errors"
+ "github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/crossplane/crossplane-runtime/pkg/resource/fake"
"github.com/crossplane/crossplane-runtime/pkg/test"
@@ -40,6 +43,7 @@ import (
func TestReconcile(t *testing.T) {
errBoom := errors.New("boom")
+ testLog := logging.NewLogrLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(io.Discard)).WithName("testlog"))
now := metav1.Now()
type args struct {
@@ -250,7 +254,7 @@ func TestReconcile(t *testing.T) {
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
- r := NewReconciler(tc.args.mgr, tc.args.opts...)
+ r := NewReconciler(tc.args.mgr, append(tc.args.opts, WithLogger(testLog))...)
got, err := r.Reconcile(context.Background(), reconcile.Request{})
if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" {