From d56176a9382926332dc1fe64ac7adf8f83c07f7e Mon Sep 17 00:00:00 2001 From: Riccardo Capraro Date: Sun, 19 Oct 2025 17:11:03 +0200 Subject: [PATCH] Update crossplane runtime to v2 - Update crossplane-runtime from v1.20.0 to v2.0.0 - Implement missing interface methods for crossplane-runtime v2 compatibility: - Add GetUsers/SetUsers for UserCounter interface on ProviderConfig - Add GetItems for ProviderConfigUsageList interface - Add SetResourceReference/GetResourceReference for ProviderConfigUsage - Add compile-time interface validation with var _ assignments - Fix JQ expression syntax in e2e test examples: - Remove problematic outer parentheses from URL expressions - Fix Authorization header secret injection syntax - Add interface casting tests to prevent runtime panics - Update go.mod and go.sum for crossplane-runtime v2 dependencies - Use chainsaw for e2e tests Signed-off-by: Riccardo Capraro --- Makefile | 4 +- .../v1alpha1/disposablerequest_types.go | 2 +- .../v1alpha1/zz_generated.managed.go | 151 ++++++++-------- .../v1alpha1/zz_generated.managedlist.go | 29 ---- .../v1alpha2/disposablerequest_types.go | 2 +- .../v1alpha2/zz_generated.managed.go | 151 ++++++++-------- .../v1alpha2/zz_generated.managedlist.go | 29 ---- apis/http.go | 8 +- apis/request/v1alpha1/request_types.go | 2 +- apis/request/v1alpha1/zz_generated.managed.go | 151 ++++++++-------- .../v1alpha1/zz_generated.managedlist.go | 29 ---- apis/request/v1alpha2/request_types.go | 2 +- apis/request/v1alpha2/zz_generated.managed.go | 151 ++++++++-------- .../v1alpha2/zz_generated.managedlist.go | 29 ---- apis/v1alpha1/providerconfig_types.go | 27 ++- apis/v1alpha1/providerconfigusage_types.go | 26 ++- apis/v1alpha1/zz_generated.pc.go | 40 ----- apis/v1alpha1/zz_generated.pcu.go | 40 ----- apis/v1alpha1/zz_generated.pculist.go | 29 ---- build | 2 +- cmd/provider/main.go | 8 +- examples/sample/request.yaml | 10 +- go.mod | 2 +- go.sum | 4 +- .../APIVERSION/KIND_LOWER_types.go.tmpl | 2 +- .../controller/KIND_LOWER/KIND_LOWER.go.tmpl | 12 +- .../KIND_LOWER/KIND_LOWER_test.go.tmpl | 6 +- internal/clients/http/client.go | 2 +- internal/controller/config/config.go | 11 +- .../disposablerequest/disposablerequest.go | 24 +-- .../disposablerequest_test.go | 8 +- internal/controller/http.go | 2 +- .../request/observe/is_deleted_check.go | 2 +- .../request/observe/is_deleted_check_test.go | 4 +- .../request/observe/is_synced_check.go | 2 +- .../request/observe/is_synced_check_test.go | 4 +- .../controller/request/observe/jq_check.go | 2 +- .../request/observe/jq_check_test.go | 4 +- internal/controller/request/observe_test.go | 4 +- internal/controller/request/request.go | 24 +-- internal/controller/request/request_test.go | 8 +- .../request/requestgen/request_generator.go | 2 +- .../requestgen/request_generator_test.go | 4 +- .../request/requestmapping/mapping.go | 2 +- .../request/requestmapping/mapping_test.go | 4 +- .../request_processing_test.go | 2 +- .../request/statushandler/status.go | 2 +- .../request/statushandler/status_test.go | 4 +- internal/data-patcher/parser.go | 2 +- internal/data-patcher/parser_test.go | 4 +- internal/data-patcher/patch.go | 2 +- internal/data-patcher/patch_test.go | 4 +- internal/data-patcher/secret_patcher.go | 2 +- internal/data-patcher/secret_patcher_test.go | 2 +- internal/jq/parser_test.go | 2 +- internal/kube-handler/client_test.go | 2 +- internal/utils/set_status_test.go | 2 +- internal/utils/validate_test.go | 2 +- ...http.crossplane.io_disposablerequests.yaml | 162 ------------------ package/crds/http.crossplane.io_requests.yaml | 162 ------------------ 60 files changed, 433 insertions(+), 984 deletions(-) delete mode 100644 apis/disposablerequest/v1alpha1/zz_generated.managedlist.go delete mode 100644 apis/disposablerequest/v1alpha2/zz_generated.managedlist.go delete mode 100644 apis/request/v1alpha1/zz_generated.managedlist.go delete mode 100644 apis/request/v1alpha2/zz_generated.managedlist.go delete mode 100644 apis/v1alpha1/zz_generated.pc.go delete mode 100644 apis/v1alpha1/zz_generated.pcu.go delete mode 100644 apis/v1alpha1/zz_generated.pculist.go diff --git a/Makefile b/Makefile index 66613c7..a8efe73 100644 --- a/Makefile +++ b/Makefile @@ -92,9 +92,9 @@ CROSSPLANE_NAMESPACE = crossplane-system UPTEST_EXAMPLE_LIST := $(shell find ./examples/sample -path '*.yaml' | paste -s -d ',' - ) -uptest: $(UPTEST) $(KUBECTL) $(KUTTL) +uptest: $(UPTEST) $(KUBECTL) $(CHAINSAW) $(CROSSPLANE_CLI) @$(INFO) running automated tests - @KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) CROSSPLANE_NAMESPACE=$(CROSSPLANE_NAMESPACE) $(UPTEST) e2e "$(UPTEST_EXAMPLE_LIST)" --setup-script=cluster/test/setup.sh || $(FAIL) + @KUBECTL=$(KUBECTL) CHAINSAW=$(CHAINSAW) CROSSPLANE_CLI=$(CROSSPLANE_CLI) CROSSPLANE_NAMESPACE=$(CROSSPLANE_NAMESPACE) $(UPTEST) e2e "$(UPTEST_EXAMPLE_LIST)" --setup-script=cluster/test/setup.sh || $(FAIL) @$(OK) running automated tests local-dev: controlplane.up diff --git a/apis/disposablerequest/v1alpha1/disposablerequest_types.go b/apis/disposablerequest/v1alpha1/disposablerequest_types.go index 814275e..9f0edeb 100644 --- a/apis/disposablerequest/v1alpha1/disposablerequest_types.go +++ b/apis/disposablerequest/v1alpha1/disposablerequest_types.go @@ -22,7 +22,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" ) // DisposableRequestParameters are the configurable fields of a DisposableRequest. diff --git a/apis/disposablerequest/v1alpha1/zz_generated.managed.go b/apis/disposablerequest/v1alpha1/zz_generated.managed.go index 1a249e8..1191607 100644 --- a/apis/disposablerequest/v1alpha1/zz_generated.managed.go +++ b/apis/disposablerequest/v1alpha1/zz_generated.managed.go @@ -1,80 +1,71 @@ -/* -Copyright 2020 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -// Code generated by angryjet. DO NOT EDIT. - -package v1alpha1 - -import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - -// GetCondition of this DisposableRequest. -func (mg *DisposableRequest) GetCondition(ct xpv1.ConditionType) xpv1.Condition { - return mg.Status.GetCondition(ct) -} - -// GetDeletionPolicy of this DisposableRequest. -func (mg *DisposableRequest) GetDeletionPolicy() xpv1.DeletionPolicy { - return mg.Spec.DeletionPolicy -} - -// GetManagementPolicies of this DisposableRequest. -func (mg *DisposableRequest) GetManagementPolicies() xpv1.ManagementPolicies { - return mg.Spec.ManagementPolicies -} - -// GetProviderConfigReference of this DisposableRequest. -func (mg *DisposableRequest) GetProviderConfigReference() *xpv1.Reference { - return mg.Spec.ProviderConfigReference -} - -// GetPublishConnectionDetailsTo of this DisposableRequest. -func (mg *DisposableRequest) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { - return mg.Spec.PublishConnectionDetailsTo -} - -// GetWriteConnectionSecretToReference of this DisposableRequest. -func (mg *DisposableRequest) GetWriteConnectionSecretToReference() *xpv1.SecretReference { - return mg.Spec.WriteConnectionSecretToReference -} - -// SetConditions of this DisposableRequest. -func (mg *DisposableRequest) SetConditions(c ...xpv1.Condition) { - mg.Status.SetConditions(c...) -} - -// SetDeletionPolicy of this DisposableRequest. -func (mg *DisposableRequest) SetDeletionPolicy(r xpv1.DeletionPolicy) { - mg.Spec.DeletionPolicy = r -} - -// SetManagementPolicies of this DisposableRequest. -func (mg *DisposableRequest) SetManagementPolicies(r xpv1.ManagementPolicies) { - mg.Spec.ManagementPolicies = r -} - -// SetProviderConfigReference of this DisposableRequest. -func (mg *DisposableRequest) SetProviderConfigReference(r *xpv1.Reference) { - mg.Spec.ProviderConfigReference = r -} - -// SetPublishConnectionDetailsTo of this DisposableRequest. -func (mg *DisposableRequest) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { - mg.Spec.PublishConnectionDetailsTo = r -} - -// SetWriteConnectionSecretToReference of this DisposableRequest. -func (mg *DisposableRequest) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { - mg.Spec.WriteConnectionSecretToReference = r -} +/* +Copyright 2020 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by angryjet. DO NOT EDIT. + +package v1alpha1 + +import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + +// GetCondition of this DisposableRequest. +func (mg *DisposableRequest) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this DisposableRequest. +func (mg *DisposableRequest) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetManagementPolicies of this DisposableRequest. +func (mg *DisposableRequest) GetManagementPolicies() xpv1.ManagementPolicies { + return mg.Spec.ManagementPolicies +} + +// GetProviderConfigReference of this DisposableRequest. +func (mg *DisposableRequest) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +// GetWriteConnectionSecretToReference of this DisposableRequest. +func (mg *DisposableRequest) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this DisposableRequest. +func (mg *DisposableRequest) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this DisposableRequest. +func (mg *DisposableRequest) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetManagementPolicies of this DisposableRequest. +func (mg *DisposableRequest) SetManagementPolicies(r xpv1.ManagementPolicies) { + mg.Spec.ManagementPolicies = r +} + +// SetProviderConfigReference of this DisposableRequest. +func (mg *DisposableRequest) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +// SetWriteConnectionSecretToReference of this DisposableRequest. +func (mg *DisposableRequest) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} \ No newline at end of file diff --git a/apis/disposablerequest/v1alpha1/zz_generated.managedlist.go b/apis/disposablerequest/v1alpha1/zz_generated.managedlist.go deleted file mode 100644 index f2bea17..0000000 --- a/apis/disposablerequest/v1alpha1/zz_generated.managedlist.go +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright 2020 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -// Code generated by angryjet. DO NOT EDIT. - -package v1alpha1 - -import resource "github.com/crossplane/crossplane-runtime/pkg/resource" - -// GetItems of this DisposableRequestList. -func (l *DisposableRequestList) GetItems() []resource.Managed { - items := make([]resource.Managed, len(l.Items)) - for i := range l.Items { - items[i] = &l.Items[i] - } - return items -} diff --git a/apis/disposablerequest/v1alpha2/disposablerequest_types.go b/apis/disposablerequest/v1alpha2/disposablerequest_types.go index aabbe32..f97cce6 100644 --- a/apis/disposablerequest/v1alpha2/disposablerequest_types.go +++ b/apis/disposablerequest/v1alpha2/disposablerequest_types.go @@ -23,7 +23,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "github.com/crossplane-contrib/provider-http/apis/common" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" ) // DisposableRequestParameters are the configurable fields of a DisposableRequest. diff --git a/apis/disposablerequest/v1alpha2/zz_generated.managed.go b/apis/disposablerequest/v1alpha2/zz_generated.managed.go index e77daa5..01185de 100644 --- a/apis/disposablerequest/v1alpha2/zz_generated.managed.go +++ b/apis/disposablerequest/v1alpha2/zz_generated.managed.go @@ -1,80 +1,71 @@ -/* -Copyright 2020 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -// Code generated by angryjet. DO NOT EDIT. - -package v1alpha2 - -import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - -// GetCondition of this DisposableRequest. -func (mg *DisposableRequest) GetCondition(ct xpv1.ConditionType) xpv1.Condition { - return mg.Status.GetCondition(ct) -} - -// GetDeletionPolicy of this DisposableRequest. -func (mg *DisposableRequest) GetDeletionPolicy() xpv1.DeletionPolicy { - return mg.Spec.DeletionPolicy -} - -// GetManagementPolicies of this DisposableRequest. -func (mg *DisposableRequest) GetManagementPolicies() xpv1.ManagementPolicies { - return mg.Spec.ManagementPolicies -} - -// GetProviderConfigReference of this DisposableRequest. -func (mg *DisposableRequest) GetProviderConfigReference() *xpv1.Reference { - return mg.Spec.ProviderConfigReference -} - -// GetPublishConnectionDetailsTo of this DisposableRequest. -func (mg *DisposableRequest) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { - return mg.Spec.PublishConnectionDetailsTo -} - -// GetWriteConnectionSecretToReference of this DisposableRequest. -func (mg *DisposableRequest) GetWriteConnectionSecretToReference() *xpv1.SecretReference { - return mg.Spec.WriteConnectionSecretToReference -} - -// SetConditions of this DisposableRequest. -func (mg *DisposableRequest) SetConditions(c ...xpv1.Condition) { - mg.Status.SetConditions(c...) -} - -// SetDeletionPolicy of this DisposableRequest. -func (mg *DisposableRequest) SetDeletionPolicy(r xpv1.DeletionPolicy) { - mg.Spec.DeletionPolicy = r -} - -// SetManagementPolicies of this DisposableRequest. -func (mg *DisposableRequest) SetManagementPolicies(r xpv1.ManagementPolicies) { - mg.Spec.ManagementPolicies = r -} - -// SetProviderConfigReference of this DisposableRequest. -func (mg *DisposableRequest) SetProviderConfigReference(r *xpv1.Reference) { - mg.Spec.ProviderConfigReference = r -} - -// SetPublishConnectionDetailsTo of this DisposableRequest. -func (mg *DisposableRequest) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { - mg.Spec.PublishConnectionDetailsTo = r -} - -// SetWriteConnectionSecretToReference of this DisposableRequest. -func (mg *DisposableRequest) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { - mg.Spec.WriteConnectionSecretToReference = r -} +/* +Copyright 2020 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by angryjet. DO NOT EDIT. + +package v1alpha2 + +import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + +// GetCondition of this DisposableRequest. +func (mg *DisposableRequest) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this DisposableRequest. +func (mg *DisposableRequest) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetManagementPolicies of this DisposableRequest. +func (mg *DisposableRequest) GetManagementPolicies() xpv1.ManagementPolicies { + return mg.Spec.ManagementPolicies +} + +// GetProviderConfigReference of this DisposableRequest. +func (mg *DisposableRequest) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +// GetWriteConnectionSecretToReference of this DisposableRequest. +func (mg *DisposableRequest) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this DisposableRequest. +func (mg *DisposableRequest) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this DisposableRequest. +func (mg *DisposableRequest) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetManagementPolicies of this DisposableRequest. +func (mg *DisposableRequest) SetManagementPolicies(r xpv1.ManagementPolicies) { + mg.Spec.ManagementPolicies = r +} + +// SetProviderConfigReference of this DisposableRequest. +func (mg *DisposableRequest) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +// SetWriteConnectionSecretToReference of this DisposableRequest. +func (mg *DisposableRequest) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} diff --git a/apis/disposablerequest/v1alpha2/zz_generated.managedlist.go b/apis/disposablerequest/v1alpha2/zz_generated.managedlist.go deleted file mode 100644 index c55775f..0000000 --- a/apis/disposablerequest/v1alpha2/zz_generated.managedlist.go +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright 2020 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -// Code generated by angryjet. DO NOT EDIT. - -package v1alpha2 - -import resource "github.com/crossplane/crossplane-runtime/pkg/resource" - -// GetItems of this DisposableRequestList. -func (l *DisposableRequestList) GetItems() []resource.Managed { - items := make([]resource.Managed, len(l.Items)) - for i := range l.Items { - items[i] = &l.Items[i] - } - return items -} diff --git a/apis/http.go b/apis/http.go index 3e48468..c535d7c 100644 --- a/apis/http.go +++ b/apis/http.go @@ -20,8 +20,8 @@ package apis import ( "k8s.io/apimachinery/pkg/runtime" - disposablerequestv1alpha1 "github.com/crossplane-contrib/provider-http/apis/disposablerequest/v1alpha2" - requestv1alpha1 "github.com/crossplane-contrib/provider-http/apis/request/v1alpha2" + disposablerequestv1alpha2 "github.com/crossplane-contrib/provider-http/apis/disposablerequest/v1alpha2" + requestv1alpha2 "github.com/crossplane-contrib/provider-http/apis/request/v1alpha2" httpv1alpha1 "github.com/crossplane-contrib/provider-http/apis/v1alpha1" ) @@ -29,8 +29,8 @@ func init() { // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back AddToSchemes = append(AddToSchemes, httpv1alpha1.SchemeBuilder.AddToScheme, - disposablerequestv1alpha1.SchemeBuilder.AddToScheme, - requestv1alpha1.SchemeBuilder.AddToScheme, + disposablerequestv1alpha2.SchemeBuilder.AddToScheme, + requestv1alpha2.SchemeBuilder.AddToScheme, ) } diff --git a/apis/request/v1alpha1/request_types.go b/apis/request/v1alpha1/request_types.go index dad3fcf..fa73569 100644 --- a/apis/request/v1alpha1/request_types.go +++ b/apis/request/v1alpha1/request_types.go @@ -22,7 +22,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" ) // RequestParameters are the configurable fields of a Request. diff --git a/apis/request/v1alpha1/zz_generated.managed.go b/apis/request/v1alpha1/zz_generated.managed.go index 4096310..08ec898 100644 --- a/apis/request/v1alpha1/zz_generated.managed.go +++ b/apis/request/v1alpha1/zz_generated.managed.go @@ -1,80 +1,71 @@ -/* -Copyright 2020 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -// Code generated by angryjet. DO NOT EDIT. - -package v1alpha1 - -import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - -// GetCondition of this Request. -func (mg *Request) GetCondition(ct xpv1.ConditionType) xpv1.Condition { - return mg.Status.GetCondition(ct) -} - -// GetDeletionPolicy of this Request. -func (mg *Request) GetDeletionPolicy() xpv1.DeletionPolicy { - return mg.Spec.DeletionPolicy -} - -// GetManagementPolicies of this Request. -func (mg *Request) GetManagementPolicies() xpv1.ManagementPolicies { - return mg.Spec.ManagementPolicies -} - -// GetProviderConfigReference of this Request. -func (mg *Request) GetProviderConfigReference() *xpv1.Reference { - return mg.Spec.ProviderConfigReference -} - -// GetPublishConnectionDetailsTo of this Request. -func (mg *Request) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { - return mg.Spec.PublishConnectionDetailsTo -} - -// GetWriteConnectionSecretToReference of this Request. -func (mg *Request) GetWriteConnectionSecretToReference() *xpv1.SecretReference { - return mg.Spec.WriteConnectionSecretToReference -} - -// SetConditions of this Request. -func (mg *Request) SetConditions(c ...xpv1.Condition) { - mg.Status.SetConditions(c...) -} - -// SetDeletionPolicy of this Request. -func (mg *Request) SetDeletionPolicy(r xpv1.DeletionPolicy) { - mg.Spec.DeletionPolicy = r -} - -// SetManagementPolicies of this Request. -func (mg *Request) SetManagementPolicies(r xpv1.ManagementPolicies) { - mg.Spec.ManagementPolicies = r -} - -// SetProviderConfigReference of this Request. -func (mg *Request) SetProviderConfigReference(r *xpv1.Reference) { - mg.Spec.ProviderConfigReference = r -} - -// SetPublishConnectionDetailsTo of this Request. -func (mg *Request) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { - mg.Spec.PublishConnectionDetailsTo = r -} - -// SetWriteConnectionSecretToReference of this Request. -func (mg *Request) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { - mg.Spec.WriteConnectionSecretToReference = r -} +/* +Copyright 2020 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by angryjet. DO NOT EDIT. + +package v1alpha1 + +import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + +// GetCondition of this Request. +func (mg *Request) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this Request. +func (mg *Request) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetManagementPolicies of this Request. +func (mg *Request) GetManagementPolicies() xpv1.ManagementPolicies { + return mg.Spec.ManagementPolicies +} + +// GetProviderConfigReference of this Request. +func (mg *Request) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +// GetWriteConnectionSecretToReference of this Request. +func (mg *Request) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this Request. +func (mg *Request) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this Request. +func (mg *Request) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetManagementPolicies of this Request. +func (mg *Request) SetManagementPolicies(r xpv1.ManagementPolicies) { + mg.Spec.ManagementPolicies = r +} + +// SetProviderConfigReference of this Request. +func (mg *Request) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +// SetWriteConnectionSecretToReference of this Request. +func (mg *Request) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} \ No newline at end of file diff --git a/apis/request/v1alpha1/zz_generated.managedlist.go b/apis/request/v1alpha1/zz_generated.managedlist.go deleted file mode 100644 index badb290..0000000 --- a/apis/request/v1alpha1/zz_generated.managedlist.go +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright 2020 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -// Code generated by angryjet. DO NOT EDIT. - -package v1alpha1 - -import resource "github.com/crossplane/crossplane-runtime/pkg/resource" - -// GetItems of this RequestList. -func (l *RequestList) GetItems() []resource.Managed { - items := make([]resource.Managed, len(l.Items)) - for i := range l.Items { - items[i] = &l.Items[i] - } - return items -} diff --git a/apis/request/v1alpha2/request_types.go b/apis/request/v1alpha2/request_types.go index a1abe4c..d2258c8 100644 --- a/apis/request/v1alpha2/request_types.go +++ b/apis/request/v1alpha2/request_types.go @@ -23,7 +23,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "github.com/crossplane-contrib/provider-http/apis/common" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" ) const ( diff --git a/apis/request/v1alpha2/zz_generated.managed.go b/apis/request/v1alpha2/zz_generated.managed.go index 97a8d05..804c4a4 100644 --- a/apis/request/v1alpha2/zz_generated.managed.go +++ b/apis/request/v1alpha2/zz_generated.managed.go @@ -1,80 +1,71 @@ -/* -Copyright 2020 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -// Code generated by angryjet. DO NOT EDIT. - -package v1alpha2 - -import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - -// GetCondition of this Request. -func (mg *Request) GetCondition(ct xpv1.ConditionType) xpv1.Condition { - return mg.Status.GetCondition(ct) -} - -// GetDeletionPolicy of this Request. -func (mg *Request) GetDeletionPolicy() xpv1.DeletionPolicy { - return mg.Spec.DeletionPolicy -} - -// GetManagementPolicies of this Request. -func (mg *Request) GetManagementPolicies() xpv1.ManagementPolicies { - return mg.Spec.ManagementPolicies -} - -// GetProviderConfigReference of this Request. -func (mg *Request) GetProviderConfigReference() *xpv1.Reference { - return mg.Spec.ProviderConfigReference -} - -// GetPublishConnectionDetailsTo of this Request. -func (mg *Request) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { - return mg.Spec.PublishConnectionDetailsTo -} - -// GetWriteConnectionSecretToReference of this Request. -func (mg *Request) GetWriteConnectionSecretToReference() *xpv1.SecretReference { - return mg.Spec.WriteConnectionSecretToReference -} - -// SetConditions of this Request. -func (mg *Request) SetConditions(c ...xpv1.Condition) { - mg.Status.SetConditions(c...) -} - -// SetDeletionPolicy of this Request. -func (mg *Request) SetDeletionPolicy(r xpv1.DeletionPolicy) { - mg.Spec.DeletionPolicy = r -} - -// SetManagementPolicies of this Request. -func (mg *Request) SetManagementPolicies(r xpv1.ManagementPolicies) { - mg.Spec.ManagementPolicies = r -} - -// SetProviderConfigReference of this Request. -func (mg *Request) SetProviderConfigReference(r *xpv1.Reference) { - mg.Spec.ProviderConfigReference = r -} - -// SetPublishConnectionDetailsTo of this Request. -func (mg *Request) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { - mg.Spec.PublishConnectionDetailsTo = r -} - -// SetWriteConnectionSecretToReference of this Request. -func (mg *Request) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { - mg.Spec.WriteConnectionSecretToReference = r -} +/* +Copyright 2020 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by angryjet. DO NOT EDIT. + +package v1alpha2 + +import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + +// GetCondition of this Request. +func (mg *Request) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this Request. +func (mg *Request) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetManagementPolicies of this Request. +func (mg *Request) GetManagementPolicies() xpv1.ManagementPolicies { + return mg.Spec.ManagementPolicies +} + +// GetProviderConfigReference of this Request. +func (mg *Request) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +// GetWriteConnectionSecretToReference of this Request. +func (mg *Request) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this Request. +func (mg *Request) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this Request. +func (mg *Request) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetManagementPolicies of this Request. +func (mg *Request) SetManagementPolicies(r xpv1.ManagementPolicies) { + mg.Spec.ManagementPolicies = r +} + +// SetProviderConfigReference of this Request. +func (mg *Request) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +// SetWriteConnectionSecretToReference of this Request. +func (mg *Request) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} \ No newline at end of file diff --git a/apis/request/v1alpha2/zz_generated.managedlist.go b/apis/request/v1alpha2/zz_generated.managedlist.go deleted file mode 100644 index 565b460..0000000 --- a/apis/request/v1alpha2/zz_generated.managedlist.go +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright 2020 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -// Code generated by angryjet. DO NOT EDIT. - -package v1alpha2 - -import resource "github.com/crossplane/crossplane-runtime/pkg/resource" - -// GetItems of this RequestList. -func (l *RequestList) GetItems() []resource.Managed { - items := make([]resource.Managed, len(l.Items)) - for i := range l.Items { - items[i] = &l.Items[i] - } - return items -} diff --git a/apis/v1alpha1/providerconfig_types.go b/apis/v1alpha1/providerconfig_types.go index 2e825d1..31f04ba 100644 --- a/apis/v1alpha1/providerconfig_types.go +++ b/apis/v1alpha1/providerconfig_types.go @@ -22,9 +22,13 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" ) +// verify casting done in controller +var _ resource.ProviderConfig = &ProviderConfig{} + // A ProviderConfigSpec defines the desired state of a ProviderConfig. type ProviderConfigSpec struct { // Credentials required to authenticate to this provider. @@ -77,6 +81,27 @@ var ( ProviderConfigGroupVersionKind = SchemeGroupVersion.WithKind(ProviderConfigKind) ) +// GetCondition returns the condition for the given ConditionType if exists, +// otherwise returns nil +func (pc *ProviderConfig) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return pc.Status.GetCondition(ct) +} + +// SetConditions sets the conditions on the resource status +func (pc *ProviderConfig) SetConditions(c ...xpv1.Condition) { + pc.Status.SetConditions(c...) +} + +// GetUsers returns the number of users of this ProviderConfig. +func (pc *ProviderConfig) GetUsers() int64 { + return pc.Status.Users +} + +// SetUsers sets the number of users of this ProviderConfig. +func (pc *ProviderConfig) SetUsers(i int64) { + pc.Status.Users = i +} + func init() { SchemeBuilder.Register(&ProviderConfig{}, &ProviderConfigList{}) } diff --git a/apis/v1alpha1/providerconfigusage_types.go b/apis/v1alpha1/providerconfigusage_types.go index ea4dd4a..3c8207b 100644 --- a/apis/v1alpha1/providerconfigusage_types.go +++ b/apis/v1alpha1/providerconfigusage_types.go @@ -22,9 +22,14 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" ) +// verify casting done in controller +var _ resource.ProviderConfigUsage = &ProviderConfigUsage{} +var _ resource.ProviderConfigUsageList = &ProviderConfigUsageList{} + // +kubebuilder:object:root=true // A ProviderConfigUsage indicates that a resource is using a ProviderConfig. @@ -62,6 +67,25 @@ var ( ProviderConfigUsageListGroupVersionKind = SchemeGroupVersion.WithKind(ProviderConfigUsageListKind) ) +// SetResourceReference sets the resource reference. +func (pcu *ProviderConfigUsage) SetResourceReference(r xpv1.TypedReference) { + pcu.ResourceReference = r +} + +// GetResourceReference gets the resource reference. +func (pcu *ProviderConfigUsage) GetResourceReference() xpv1.TypedReference { + return pcu.ResourceReference +} + +// GetItems returns the list of ProviderConfigUsage items. +func (pcul *ProviderConfigUsageList) GetItems() []resource.ProviderConfigUsage { + items := make([]resource.ProviderConfigUsage, len(pcul.Items)) + for i := range pcul.Items { + items[i] = &pcul.Items[i] + } + return items +} + func init() { SchemeBuilder.Register(&ProviderConfigUsage{}, &ProviderConfigUsageList{}) } diff --git a/apis/v1alpha1/zz_generated.pc.go b/apis/v1alpha1/zz_generated.pc.go deleted file mode 100644 index 28fad33..0000000 --- a/apis/v1alpha1/zz_generated.pc.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2020 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -// Code generated by angryjet. DO NOT EDIT. - -package v1alpha1 - -import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - -// GetCondition of this ProviderConfig. -func (p *ProviderConfig) GetCondition(ct xpv1.ConditionType) xpv1.Condition { - return p.Status.GetCondition(ct) -} - -// GetUsers of this ProviderConfig. -func (p *ProviderConfig) GetUsers() int64 { - return p.Status.Users -} - -// SetConditions of this ProviderConfig. -func (p *ProviderConfig) SetConditions(c ...xpv1.Condition) { - p.Status.SetConditions(c...) -} - -// SetUsers of this ProviderConfig. -func (p *ProviderConfig) SetUsers(i int64) { - p.Status.Users = i -} diff --git a/apis/v1alpha1/zz_generated.pcu.go b/apis/v1alpha1/zz_generated.pcu.go deleted file mode 100644 index 710c6c6..0000000 --- a/apis/v1alpha1/zz_generated.pcu.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2020 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -// Code generated by angryjet. DO NOT EDIT. - -package v1alpha1 - -import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - -// GetProviderConfigReference of this ProviderConfigUsage. -func (p *ProviderConfigUsage) GetProviderConfigReference() xpv1.Reference { - return p.ProviderConfigReference -} - -// GetResourceReference of this ProviderConfigUsage. -func (p *ProviderConfigUsage) GetResourceReference() xpv1.TypedReference { - return p.ResourceReference -} - -// SetProviderConfigReference of this ProviderConfigUsage. -func (p *ProviderConfigUsage) SetProviderConfigReference(r xpv1.Reference) { - p.ProviderConfigReference = r -} - -// SetResourceReference of this ProviderConfigUsage. -func (p *ProviderConfigUsage) SetResourceReference(r xpv1.TypedReference) { - p.ResourceReference = r -} diff --git a/apis/v1alpha1/zz_generated.pculist.go b/apis/v1alpha1/zz_generated.pculist.go deleted file mode 100644 index 468bad0..0000000 --- a/apis/v1alpha1/zz_generated.pculist.go +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright 2020 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -// Code generated by angryjet. DO NOT EDIT. - -package v1alpha1 - -import resource "github.com/crossplane/crossplane-runtime/pkg/resource" - -// GetItems of this ProviderConfigUsageList. -func (p *ProviderConfigUsageList) GetItems() []resource.ProviderConfigUsage { - items := make([]resource.ProviderConfigUsage, len(p.Items)) - for i := range p.Items { - items[i] = &p.Items[i] - } - return items -} diff --git a/build b/build index 0a8b884..99c79f0 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 0a8b8840306079292b7a3746ce1d5382b6868af8 +Subproject commit 99c79f0c310d02157495f457f99b95370200c389 diff --git a/cmd/provider/main.go b/cmd/provider/main.go index 1c47923..2cedde1 100644 --- a/cmd/provider/main.go +++ b/cmd/provider/main.go @@ -28,10 +28,10 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/log/zap" - "github.com/crossplane/crossplane-runtime/pkg/controller" - "github.com/crossplane/crossplane-runtime/pkg/feature" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/feature" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/ratelimiter" "github.com/crossplane-contrib/provider-http/apis" template "github.com/crossplane-contrib/provider-http/internal/controller" diff --git a/examples/sample/request.yaml b/examples/sample/request.yaml index 16deb07..4aa7340 100644 --- a/examples/sample/request.yaml +++ b/examples/sample/request.yaml @@ -11,7 +11,7 @@ spec: Content-Type: - application/json Authorization: - - ("Bearer {{ auth:default:token }}") + - "Bearer {{ auth:default:token }}" payload: baseUrl: http://flask-api.default.svc.cluster.local/v1/users body: | @@ -37,14 +37,14 @@ spec: Content-Type: - application/json Authorization: - - ("Bearer {{ auth:default:token }}") + - "Bearer {{ auth:default:token }}" Extra-Header-For-Post: - extra-value # Scenario 2: Action specified, method not specified (defaults to GET for OBSERVE) - action: OBSERVE # method: "GET" - url: (.payload.baseUrl + "/" + (.response.body.id|tostring)) + url: .payload.baseUrl + "/" + (.response.body.id | tostring) # If the ID of the external resource is known in advance, ownership of the resource can be attempted: # url: (.payload.baseUrl + "/1234567890") @@ -56,12 +56,12 @@ spec: email: .payload.body.email, age: .payload.body.age } - url: (.payload.baseUrl + "/" + (.response.body.id|tostring)) + url: .payload.baseUrl + "/" + (.response.body.id | tostring) # Scenario 4: Action specified, method not specified (defaults to DELETE for REMOVE) - action: REMOVE # method: "DELETE" - url: (.payload.baseUrl + "/" + (.response.body.id|tostring)) + url: .payload.baseUrl + "/" + (.response.body.id | tostring) # expectedResponseCheck is optional. If not specified or if the type is "DEFAULT", # the resource is considered up to date if the GET response containes the PUT body. diff --git a/go.mod b/go.mod index c440025..dd9259b 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.24.0 toolchain go1.24.6 require ( - github.com/crossplane/crossplane-runtime v1.20.0 + github.com/crossplane/crossplane-runtime/v2 v2.0.0 github.com/crossplane/crossplane-tools v0.0.0-20240522174801-1ad3d4c87f21 github.com/google/go-cmp v0.7.0 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 4f84974..8170a5e 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,8 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/crossplane/crossplane-runtime v1.20.0 h1:I54uipRIecqZyms+vz1J/l62yjVQ7HV5w+Nh3RMrUtc= -github.com/crossplane/crossplane-runtime v1.20.0/go.mod h1:lfV1VJenDc9PNVLxDC80YjPoTm+JdSZ13xlS2h37Dvg= +github.com/crossplane/crossplane-runtime/v2 v2.0.0 h1:PK2pTKfshdDZ5IfoiMRiCi0PBnIjqbS0KGXEJgRdrb4= +github.com/crossplane/crossplane-runtime/v2 v2.0.0/go.mod h1:pkd5UzmE8esaZAApevMutR832GjJ1Qgc5Ngr78ByxrI= github.com/crossplane/crossplane-tools v0.0.0-20240522174801-1ad3d4c87f21 h1:8wb7/zCbVPkeX68WbVESWJmSWQE5SZKzz0g9X4FlXRw= github.com/crossplane/crossplane-tools v0.0.0-20240522174801-1ad3d4c87f21/go.mod h1:cN0Y7PFGQMM8mcagXVCbeQoKtipmFWQTPZYyziCPBUI= github.com/dave/jennifer v1.7.0 h1:uRbSBH9UTS64yXbh4FrMHfgfY762RD+C7bUPKODpSJE= diff --git a/hack/helpers/apis/GROUP_LOWER/APIVERSION/KIND_LOWER_types.go.tmpl b/hack/helpers/apis/GROUP_LOWER/APIVERSION/KIND_LOWER_types.go.tmpl index b1fe54d..358cf07 100644 --- a/hack/helpers/apis/GROUP_LOWER/APIVERSION/KIND_LOWER_types.go.tmpl +++ b/hack/helpers/apis/GROUP_LOWER/APIVERSION/KIND_LOWER_types.go.tmpl @@ -22,7 +22,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" ) // {{ .Env.KIND }}Parameters are the configurable fields of a {{ .Env.KIND }}. diff --git a/hack/helpers/controller/KIND_LOWER/KIND_LOWER.go.tmpl b/hack/helpers/controller/KIND_LOWER/KIND_LOWER.go.tmpl index e3758a4..cb33dc2 100644 --- a/hack/helpers/controller/KIND_LOWER/KIND_LOWER.go.tmpl +++ b/hack/helpers/controller/KIND_LOWER/KIND_LOWER.go.tmpl @@ -25,12 +25,12 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/crossplane/crossplane-runtime/pkg/connection" - "github.com/crossplane/crossplane-runtime/pkg/controller" - "github.com/crossplane/crossplane-runtime/pkg/event" - "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/connection" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/event" + "github.com/crossplane/crossplane-runtime/v2/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" "github.com/crossplane-contrib/provider-{{ .Env.PROVIDER | strings.ToLower }}/apis/{{ .Env.GROUP | strings.ToLower }}/{{ .Env.APIVERSION | strings.ToLower }}" apisv1alpha1 "github.com/crossplane-contrib/provider-{{ .Env.PROVIDER | strings.ToLower }}/apis/v1alpha1" diff --git a/hack/helpers/controller/KIND_LOWER/KIND_LOWER_test.go.tmpl b/hack/helpers/controller/KIND_LOWER/KIND_LOWER_test.go.tmpl index 7eaf81a..ac52bff 100644 --- a/hack/helpers/controller/KIND_LOWER/KIND_LOWER_test.go.tmpl +++ b/hack/helpers/controller/KIND_LOWER/KIND_LOWER_test.go.tmpl @@ -22,9 +22,9 @@ import ( "github.com/google/go-cmp/cmp" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" ) // Unlike many Kubernetes projects Crossplane does not use third party testing diff --git a/internal/clients/http/client.go b/internal/clients/http/client.go index de1a244..f58eb9b 100644 --- a/internal/clients/http/client.go +++ b/internal/clients/http/client.go @@ -10,7 +10,7 @@ import ( "net/http" "time" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" ) const ( diff --git a/internal/controller/config/config.go b/internal/controller/config/config.go index 38ac4da..bf2c067 100644 --- a/internal/controller/config/config.go +++ b/internal/controller/config/config.go @@ -19,11 +19,11 @@ package config import ( "time" - "github.com/crossplane/crossplane-runtime/pkg/controller" - "github.com/crossplane/crossplane-runtime/pkg/event" - "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/providerconfig" - "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/event" + "github.com/crossplane/crossplane-runtime/v2/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/providerconfig" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" ctrl "sigs.k8s.io/controller-runtime" "github.com/crossplane-contrib/provider-http/apis/v1alpha1" @@ -36,6 +36,7 @@ func Setup(mgr ctrl.Manager, o controller.Options, timeout time.Duration) error of := resource.ProviderConfigKinds{ Config: v1alpha1.ProviderConfigGroupVersionKind, + Usage: v1alpha1.ProviderConfigUsageGroupVersionKind, UsageList: v1alpha1.ProviderConfigUsageListGroupVersionKind, } diff --git a/internal/controller/disposablerequest/disposablerequest.go b/internal/controller/disposablerequest/disposablerequest.go index d6da60d..dae4dac 100644 --- a/internal/controller/disposablerequest/disposablerequest.go +++ b/internal/controller/disposablerequest/disposablerequest.go @@ -24,19 +24,19 @@ import ( datapatcher "github.com/crossplane-contrib/provider-http/internal/data-patcher" "github.com/crossplane-contrib/provider-http/internal/jq" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" "github.com/pkg/errors" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" json_util "github.com/crossplane-contrib/provider-http/internal/json" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - "github.com/crossplane/crossplane-runtime/pkg/controller" - "github.com/crossplane/crossplane-runtime/pkg/event" - "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/event" + "github.com/crossplane/crossplane-runtime/v2/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" "github.com/crossplane-contrib/provider-http/apis/disposablerequest/v1alpha2" apisv1alpha1 "github.com/crossplane-contrib/provider-http/apis/v1alpha1" @@ -67,22 +67,19 @@ const ( // Setup adds a controller that reconciles DisposableRequest managed resources. func Setup(mgr ctrl.Manager, o controller.Options, timeout time.Duration) error { name := managed.ControllerName(v1alpha2.DisposableRequestGroupKind) - cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} r := managed.NewReconciler(mgr, resource.ManagedKind(v1alpha2.DisposableRequestGroupVersionKind), managed.WithExternalConnecter(&connector{ logger: o.Logger, kube: mgr.GetClient(), - usage: resource.NewProviderConfigUsageTracker(mgr.GetClient(), &apisv1alpha1.ProviderConfigUsage{}), newHttpClientFn: httpClient.NewClient, }), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithPollInterval(o.PollInterval), WithCustomPollIntervalHook(), managed.WithTimeout(timeout), - managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithConnectionPublishers(cps...)) + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name)))) return ctrl.NewControllerManagedBy(mgr). Named(name). @@ -95,7 +92,6 @@ func Setup(mgr ctrl.Manager, o controller.Options, timeout time.Duration) error type connector struct { logger logging.Logger kube client.Client - usage resource.Tracker newHttpClientFn func(log logging.Logger, timeout time.Duration, creds string) (httpClient.Client, error) } @@ -108,10 +104,6 @@ func (c *connector) Connect(ctx context.Context, mg resource.Managed) (managed.E l := c.logger.WithValues("disposableRequest", cr.Name) - if err := c.usage.Track(ctx, mg); err != nil { - return nil, errors.Wrap(err, errTrackPCUsage) - } - pc := &apisv1alpha1.ProviderConfig{} n := types.NamespacedName{Name: cr.GetProviderConfigReference().Name} if err := c.kube.Get(ctx, n, pc); err != nil { diff --git a/internal/controller/disposablerequest/disposablerequest_test.go b/internal/controller/disposablerequest/disposablerequest_test.go index efd4431..6856ca4 100644 --- a/internal/controller/disposablerequest/disposablerequest_test.go +++ b/internal/controller/disposablerequest/disposablerequest_test.go @@ -25,15 +25,15 @@ import ( "github.com/crossplane-contrib/provider-http/apis/disposablerequest/v1alpha2" httpClient "github.com/crossplane-contrib/provider-http/internal/clients/http" "github.com/crossplane-contrib/provider-http/internal/utils" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" "github.com/google/go-cmp/cmp" "github.com/pkg/errors" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/resource" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" ) // Unlike many Kubernetes projects Crossplane does not use third party testing diff --git a/internal/controller/http.go b/internal/controller/http.go index 19cf6da..2bdd220 100644 --- a/internal/controller/http.go +++ b/internal/controller/http.go @@ -19,7 +19,7 @@ package controller import ( "time" - "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" ctrl "sigs.k8s.io/controller-runtime" "github.com/crossplane-contrib/provider-http/internal/controller/config" diff --git a/internal/controller/request/observe/is_deleted_check.go b/internal/controller/request/observe/is_deleted_check.go index b273573..826b07b 100644 --- a/internal/controller/request/observe/is_deleted_check.go +++ b/internal/controller/request/observe/is_deleted_check.go @@ -6,7 +6,7 @@ import ( "github.com/crossplane-contrib/provider-http/apis/request/v1alpha2" httpClient "github.com/crossplane-contrib/provider-http/internal/clients/http" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" "github.com/pkg/errors" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/internal/controller/request/observe/is_deleted_check_test.go b/internal/controller/request/observe/is_deleted_check_test.go index dd860c2..d85d65e 100644 --- a/internal/controller/request/observe/is_deleted_check_test.go +++ b/internal/controller/request/observe/is_deleted_check_test.go @@ -7,8 +7,8 @@ import ( "github.com/crossplane-contrib/provider-http/apis/request/v1alpha2" httpClient "github.com/crossplane-contrib/provider-http/internal/clients/http" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" "github.com/pkg/errors" ) diff --git a/internal/controller/request/observe/is_synced_check.go b/internal/controller/request/observe/is_synced_check.go index cedce1a..82ad797 100644 --- a/internal/controller/request/observe/is_synced_check.go +++ b/internal/controller/request/observe/is_synced_check.go @@ -13,7 +13,7 @@ import ( datapatcher "github.com/crossplane-contrib/provider-http/internal/data-patcher" "github.com/crossplane-contrib/provider-http/internal/json" "github.com/crossplane-contrib/provider-http/internal/utils" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" "github.com/pkg/errors" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/internal/controller/request/observe/is_synced_check_test.go b/internal/controller/request/observe/is_synced_check_test.go index 4571e15..62c4ff2 100644 --- a/internal/controller/request/observe/is_synced_check_test.go +++ b/internal/controller/request/observe/is_synced_check_test.go @@ -6,8 +6,8 @@ import ( "github.com/crossplane-contrib/provider-http/apis/request/v1alpha2" httpClient "github.com/crossplane-contrib/provider-http/internal/clients/http" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" "github.com/pkg/errors" ) diff --git a/internal/controller/request/observe/jq_check.go b/internal/controller/request/observe/jq_check.go index 44faa23..881e9bf 100644 --- a/internal/controller/request/observe/jq_check.go +++ b/internal/controller/request/observe/jq_check.go @@ -11,7 +11,7 @@ import ( datapatcher "github.com/crossplane-contrib/provider-http/internal/data-patcher" "github.com/crossplane-contrib/provider-http/internal/jq" "github.com/crossplane-contrib/provider-http/internal/utils" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/internal/controller/request/observe/jq_check_test.go b/internal/controller/request/observe/jq_check_test.go index e98a4e3..8a25c59 100644 --- a/internal/controller/request/observe/jq_check_test.go +++ b/internal/controller/request/observe/jq_check_test.go @@ -6,8 +6,8 @@ import ( "github.com/crossplane-contrib/provider-http/apis/request/v1alpha2" httpClient "github.com/crossplane-contrib/provider-http/internal/clients/http" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" ) diff --git a/internal/controller/request/observe_test.go b/internal/controller/request/observe_test.go index df2d7c6..a251571 100644 --- a/internal/controller/request/observe_test.go +++ b/internal/controller/request/observe_test.go @@ -10,8 +10,8 @@ import ( "github.com/crossplane-contrib/provider-http/internal/controller/request/observe" "github.com/crossplane-contrib/provider-http/internal/controller/request/requestgen" "github.com/crossplane-contrib/provider-http/internal/controller/request/requestmapping" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" "github.com/pkg/errors" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/internal/controller/request/request.go b/internal/controller/request/request.go index 481863c..1ca794b 100644 --- a/internal/controller/request/request.go +++ b/internal/controller/request/request.go @@ -20,18 +20,18 @@ import ( "context" "time" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" "github.com/pkg/errors" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - "github.com/crossplane/crossplane-runtime/pkg/controller" - "github.com/crossplane/crossplane-runtime/pkg/event" - "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/event" + "github.com/crossplane/crossplane-runtime/v2/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" "github.com/crossplane-contrib/provider-http/apis/request/v1alpha2" apisv1alpha1 "github.com/crossplane-contrib/provider-http/apis/v1alpha1" @@ -61,21 +61,18 @@ const ( // Setup adds a controller that reconciles Request managed resources. func Setup(mgr ctrl.Manager, o controller.Options, timeout time.Duration) error { name := managed.ControllerName(v1alpha2.RequestGroupKind) - cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} r := managed.NewReconciler(mgr, resource.ManagedKind(v1alpha2.RequestGroupVersionKind), managed.WithExternalConnecter(&connector{ logger: o.Logger, kube: mgr.GetClient(), - usage: resource.NewProviderConfigUsageTracker(mgr.GetClient(), &apisv1alpha1.ProviderConfigUsage{}), newHttpClientFn: httpClient.NewClient, }), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithPollInterval(o.PollInterval), managed.WithTimeout(timeout), - managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithConnectionPublishers(cps...)) + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name)))) return ctrl.NewControllerManagedBy(mgr). Named(name). @@ -90,7 +87,6 @@ func Setup(mgr ctrl.Manager, o controller.Options, timeout time.Duration) error type connector struct { logger logging.Logger kube client.Client - usage resource.Tracker newHttpClientFn func(log logging.Logger, timeout time.Duration, creds string) (httpClient.Client, error) } @@ -103,10 +99,6 @@ func (c *connector) Connect(ctx context.Context, mg resource.Managed) (managed.E l := c.logger.WithValues("request", cr.Name) - if err := c.usage.Track(ctx, mg); err != nil { - return nil, errors.Wrap(err, errTrackPCUsage) - } - pc := &apisv1alpha1.ProviderConfig{} n := types.NamespacedName{Name: cr.GetProviderConfigReference().Name} if err := c.kube.Get(ctx, n, pc); err != nil { diff --git a/internal/controller/request/request_test.go b/internal/controller/request/request_test.go index 064a1d8..dbec6cb 100644 --- a/internal/controller/request/request_test.go +++ b/internal/controller/request/request_test.go @@ -9,10 +9,10 @@ import ( "github.com/crossplane-contrib/provider-http/apis/request/v1alpha2" httpClient "github.com/crossplane-contrib/provider-http/internal/clients/http" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/resource" - "github.com/crossplane/crossplane-runtime/pkg/test" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" "github.com/pkg/errors" ) diff --git a/internal/controller/request/requestgen/request_generator.go b/internal/controller/request/requestgen/request_generator.go index 3a0235d..b33999c 100644 --- a/internal/controller/request/requestgen/request_generator.go +++ b/internal/controller/request/requestgen/request_generator.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" "github.com/pkg/errors" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/internal/controller/request/requestgen/request_generator_test.go b/internal/controller/request/requestgen/request_generator_test.go index 72532bf..d4dea24 100644 --- a/internal/controller/request/requestgen/request_generator_test.go +++ b/internal/controller/request/requestgen/request_generator_test.go @@ -6,10 +6,10 @@ import ( "github.com/crossplane-contrib/provider-http/apis/request/v1alpha2" httpClient "github.com/crossplane-contrib/provider-http/internal/clients/http" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" ) diff --git a/internal/controller/request/requestmapping/mapping.go b/internal/controller/request/requestmapping/mapping.go index 5a4599f..06a823a 100644 --- a/internal/controller/request/requestmapping/mapping.go +++ b/internal/controller/request/requestmapping/mapping.go @@ -5,7 +5,7 @@ import ( "net/http" "github.com/crossplane-contrib/provider-http/apis/request/v1alpha2" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" "github.com/pkg/errors" ) diff --git a/internal/controller/request/requestmapping/mapping_test.go b/internal/controller/request/requestmapping/mapping_test.go index 4ff9a9c..b2033a4 100644 --- a/internal/controller/request/requestmapping/mapping_test.go +++ b/internal/controller/request/requestmapping/mapping_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/crossplane-contrib/provider-http/apis/request/v1alpha2" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" "github.com/pkg/errors" ) diff --git a/internal/controller/request/requestprocessing/request_processing_test.go b/internal/controller/request/requestprocessing/request_processing_test.go index 8d80c81..24fafb5 100644 --- a/internal/controller/request/requestprocessing/request_processing_test.go +++ b/internal/controller/request/requestprocessing/request_processing_test.go @@ -3,7 +3,7 @@ package requestprocessing import ( "testing" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" ) diff --git a/internal/controller/request/statushandler/status.go b/internal/controller/request/statushandler/status.go index 98e4aeb..569d628 100644 --- a/internal/controller/request/statushandler/status.go +++ b/internal/controller/request/statushandler/status.go @@ -11,7 +11,7 @@ import ( "github.com/crossplane-contrib/provider-http/internal/controller/request/requestgen" "github.com/crossplane-contrib/provider-http/internal/controller/request/responseconverter" "github.com/crossplane-contrib/provider-http/internal/utils" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" "github.com/pkg/errors" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/internal/controller/request/statushandler/status_test.go b/internal/controller/request/statushandler/status_test.go index 796f012..e0a5dc2 100644 --- a/internal/controller/request/statushandler/status_test.go +++ b/internal/controller/request/statushandler/status_test.go @@ -8,8 +8,8 @@ import ( "github.com/crossplane-contrib/provider-http/apis/request/v1alpha2" httpClient "github.com/crossplane-contrib/provider-http/internal/clients/http" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/internal/data-patcher/parser.go b/internal/data-patcher/parser.go index b8d63dc..79947e5 100644 --- a/internal/data-patcher/parser.go +++ b/internal/data-patcher/parser.go @@ -11,7 +11,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" kubehandler "github.com/crossplane-contrib/provider-http/internal/kube-handler" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" ) const ( diff --git a/internal/data-patcher/parser_test.go b/internal/data-patcher/parser_test.go index 14b120c..3405ba7 100644 --- a/internal/data-patcher/parser_test.go +++ b/internal/data-patcher/parser_test.go @@ -5,8 +5,8 @@ import ( "errors" "testing" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/internal/data-patcher/patch.go b/internal/data-patcher/patch.go index 2041cb0..b055759 100644 --- a/internal/data-patcher/patch.go +++ b/internal/data-patcher/patch.go @@ -8,7 +8,7 @@ import ( "github.com/crossplane-contrib/provider-http/apis/request/v1alpha2" httpClient "github.com/crossplane-contrib/provider-http/internal/clients/http" kubehandler "github.com/crossplane-contrib/provider-http/internal/kube-handler" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" "github.com/pkg/errors" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/internal/data-patcher/patch_test.go b/internal/data-patcher/patch_test.go index 113c55f..48f8f0d 100644 --- a/internal/data-patcher/patch_test.go +++ b/internal/data-patcher/patch_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" diff --git a/internal/data-patcher/secret_patcher.go b/internal/data-patcher/secret_patcher.go index a748604..c12707c 100644 --- a/internal/data-patcher/secret_patcher.go +++ b/internal/data-patcher/secret_patcher.go @@ -12,7 +12,7 @@ import ( "github.com/crossplane-contrib/provider-http/internal/jq" json_util "github.com/crossplane-contrib/provider-http/internal/json" kubehandler "github.com/crossplane-contrib/provider-http/internal/kube-handler" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/internal/data-patcher/secret_patcher_test.go b/internal/data-patcher/secret_patcher_test.go index f99b3f5..8a02e8f 100644 --- a/internal/data-patcher/secret_patcher_test.go +++ b/internal/data-patcher/secret_patcher_test.go @@ -6,7 +6,7 @@ import ( "github.com/crossplane-contrib/provider-http/apis/common" httpClient "github.com/crossplane-contrib/provider-http/internal/clients/http" json_util "github.com/crossplane-contrib/provider-http/internal/json" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" "github.com/google/go-cmp/cmp" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/internal/jq/parser_test.go b/internal/jq/parser_test.go index 427079e..1c31e3a 100644 --- a/internal/jq/parser_test.go +++ b/internal/jq/parser_test.go @@ -3,7 +3,7 @@ package jq import ( "testing" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" ) diff --git a/internal/kube-handler/client_test.go b/internal/kube-handler/client_test.go index 8a8b31f..a3ffc84 100644 --- a/internal/kube-handler/client_test.go +++ b/internal/kube-handler/client_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" errorspkg "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" diff --git a/internal/utils/set_status_test.go b/internal/utils/set_status_test.go index e94c247..ea172f4 100644 --- a/internal/utils/set_status_test.go +++ b/internal/utils/set_status_test.go @@ -9,7 +9,7 @@ import ( httpClient "github.com/crossplane-contrib/provider-http/internal/clients/http" "github.com/pkg/errors" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" ) diff --git a/internal/utils/validate_test.go b/internal/utils/validate_test.go index e8831a4..444043c 100644 --- a/internal/utils/validate_test.go +++ b/internal/utils/validate_test.go @@ -4,7 +4,7 @@ import ( "net/http" "testing" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" "github.com/pkg/errors" ) diff --git a/package/crds/http.crossplane.io_disposablerequests.yaml b/package/crds/http.crossplane.io_disposablerequests.yaml index 4a607bb..a04f107 100644 --- a/package/crds/http.crossplane.io_disposablerequests.yaml +++ b/package/crds/http.crossplane.io_disposablerequests.yaml @@ -185,93 +185,12 @@ spec: required: - name type: object - publishConnectionDetailsTo: - description: |- - PublishConnectionDetailsTo specifies the connection secret config which - contains a name, metadata and a reference to secret store config to - which any connection details for this managed resource should be written. - Connection details frequently include the endpoint, username, - and password required to connect to the managed resource. - properties: - configRef: - default: - name: default - description: |- - SecretStoreConfigRef specifies which secret store config should be used - for this ConnectionSecret. - properties: - name: - description: Name of the referenced object. - type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - metadata: - description: Metadata is the metadata for connection secret. - properties: - annotations: - additionalProperties: - type: string - description: |- - Annotations are the annotations to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.annotations". - - It is up to Secret Store implementation for others store types. - type: object - labels: - additionalProperties: - type: string - description: |- - Labels are the labels/tags to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.labels". - - It is up to Secret Store implementation for others store types. - type: object - type: - description: |- - Type is the SecretType for the connection secret. - - Only valid for Kubernetes Secret Stores. - type: string - type: object - name: - description: Name is the name of the connection secret. - type: string - required: - - name - type: object writeConnectionSecretToRef: description: |- WriteConnectionSecretToReference specifies the namespace and name of a Secret to which any connection details for this managed resource should be written. Connection details frequently include the endpoint, username, and password required to connect to the managed resource. - This field is planned to be replaced in a future release in favor of - PublishConnectionDetailsTo. Currently, both could be set independently - and connection details would be published to both without affecting - each other. properties: name: description: Name of the secret. @@ -658,93 +577,12 @@ spec: required: - name type: object - publishConnectionDetailsTo: - description: |- - PublishConnectionDetailsTo specifies the connection secret config which - contains a name, metadata and a reference to secret store config to - which any connection details for this managed resource should be written. - Connection details frequently include the endpoint, username, - and password required to connect to the managed resource. - properties: - configRef: - default: - name: default - description: |- - SecretStoreConfigRef specifies which secret store config should be used - for this ConnectionSecret. - properties: - name: - description: Name of the referenced object. - type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - metadata: - description: Metadata is the metadata for connection secret. - properties: - annotations: - additionalProperties: - type: string - description: |- - Annotations are the annotations to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.annotations". - - It is up to Secret Store implementation for others store types. - type: object - labels: - additionalProperties: - type: string - description: |- - Labels are the labels/tags to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.labels". - - It is up to Secret Store implementation for others store types. - type: object - type: - description: |- - Type is the SecretType for the connection secret. - - Only valid for Kubernetes Secret Stores. - type: string - type: object - name: - description: Name is the name of the connection secret. - type: string - required: - - name - type: object writeConnectionSecretToRef: description: |- WriteConnectionSecretToReference specifies the namespace and name of a Secret to which any connection details for this managed resource should be written. Connection details frequently include the endpoint, username, and password required to connect to the managed resource. - This field is planned to be replaced in a future release in favor of - PublishConnectionDetailsTo. Currently, both could be set independently - and connection details would be published to both without affecting - each other. properties: name: description: Name of the secret. diff --git a/package/crds/http.crossplane.io_requests.yaml b/package/crds/http.crossplane.io_requests.yaml index e505727..c1f4ca6 100644 --- a/package/crds/http.crossplane.io_requests.yaml +++ b/package/crds/http.crossplane.io_requests.yaml @@ -187,93 +187,12 @@ spec: required: - name type: object - publishConnectionDetailsTo: - description: |- - PublishConnectionDetailsTo specifies the connection secret config which - contains a name, metadata and a reference to secret store config to - which any connection details for this managed resource should be written. - Connection details frequently include the endpoint, username, - and password required to connect to the managed resource. - properties: - configRef: - default: - name: default - description: |- - SecretStoreConfigRef specifies which secret store config should be used - for this ConnectionSecret. - properties: - name: - description: Name of the referenced object. - type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - metadata: - description: Metadata is the metadata for connection secret. - properties: - annotations: - additionalProperties: - type: string - description: |- - Annotations are the annotations to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.annotations". - - It is up to Secret Store implementation for others store types. - type: object - labels: - additionalProperties: - type: string - description: |- - Labels are the labels/tags to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.labels". - - It is up to Secret Store implementation for others store types. - type: object - type: - description: |- - Type is the SecretType for the connection secret. - - Only valid for Kubernetes Secret Stores. - type: string - type: object - name: - description: Name is the name of the connection secret. - type: string - required: - - name - type: object writeConnectionSecretToRef: description: |- WriteConnectionSecretToReference specifies the namespace and name of a Secret to which any connection details for this managed resource should be written. Connection details frequently include the endpoint, username, and password required to connect to the managed resource. - This field is planned to be replaced in a future release in favor of - PublishConnectionDetailsTo. Currently, both could be set independently - and connection details would be published to both without affecting - each other. properties: name: description: Name of the secret. @@ -733,93 +652,12 @@ spec: required: - name type: object - publishConnectionDetailsTo: - description: |- - PublishConnectionDetailsTo specifies the connection secret config which - contains a name, metadata and a reference to secret store config to - which any connection details for this managed resource should be written. - Connection details frequently include the endpoint, username, - and password required to connect to the managed resource. - properties: - configRef: - default: - name: default - description: |- - SecretStoreConfigRef specifies which secret store config should be used - for this ConnectionSecret. - properties: - name: - description: Name of the referenced object. - type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - metadata: - description: Metadata is the metadata for connection secret. - properties: - annotations: - additionalProperties: - type: string - description: |- - Annotations are the annotations to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.annotations". - - It is up to Secret Store implementation for others store types. - type: object - labels: - additionalProperties: - type: string - description: |- - Labels are the labels/tags to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.labels". - - It is up to Secret Store implementation for others store types. - type: object - type: - description: |- - Type is the SecretType for the connection secret. - - Only valid for Kubernetes Secret Stores. - type: string - type: object - name: - description: Name is the name of the connection secret. - type: string - required: - - name - type: object writeConnectionSecretToRef: description: |- WriteConnectionSecretToReference specifies the namespace and name of a Secret to which any connection details for this managed resource should be written. Connection details frequently include the endpoint, username, and password required to connect to the managed resource. - This field is planned to be replaced in a future release in favor of - PublishConnectionDetailsTo. Currently, both could be set independently - and connection details would be published to both without affecting - each other. properties: name: description: Name of the secret.