Add "regionRef" to Endpoint resource - #873
Conversation
$ go run ./cmd/scaffold-controller -interactive=false \
-kind=Region \
-gophercloud-client=NewIdentityV3 \
-gophercloud-module=github.com/gophercloud/gophercloud/v2/openstack/identity/v3/regions \
-gophercloud-type=Region \
-openstack-json-object=region
On-behalf-of: SAP nils.gondermann@sap.com
Register with the resource generator On-behalf-of: SAP nils.gondermann@sap.com
Add the OpenStack client to scope On-behalf-of: SAP nils.gondermann@sap.com
Register the controller On-behalf-of: SAP nils.gondermann@sap.com
On-behalf-of: SAP nils.gondermann@sap.com
On-behalf-of: SAP nils.gondermann@sap.com
On-behalf-of: SAP nils.gondermann@sap.com
On-behalf-of: SAP nils.gondermann@sap.com
Generate the OLM bundle On-behalf-of: SAP nils.gondermann@sap.com
On-behalf-of: SAP nils.gondermann@sap.com
On-behalf-of: SAP nils.gondermann@sap.com
b4e0b2c to
019343e
Compare
| # We expect the deletion to hang due to the finalizer, so use --wait=false | ||
| - command: kubectl delete service.openstack.k-orc.cloud endpoint-dependency --wait=false | ||
| namespaced: true | ||
| - command: kubectl delete region.openstack.k-orc.cloud endpoint-dependency --wait=false |
There was a problem hiding this comment.
The tests fail with:
case.go:335: failed to get referenced resource 'kuttl-sensible-bat-h57l/endpoint-dependency': regions.openstack.k-orc.cloud "endpoint-dependency" not found
I'm not exactly sure why... Because it was apparently created successfully in the previous step.
There was a problem hiding this comment.
From what I can see, the region is being created and indeed being deleted, not hanging waiting for a finalizer. I think this is a consequence of using FetchDependency which doesn't add the finalizer to the resource unlike the GetDependency. Suggested that.
| @@ -38,3 +38,18 @@ spec: | |||
| serviceRef: endpoint-dependency | |||
| interface: internal | |||
| url: http://example.com | |||
There was a problem hiding this comment.
You should ideally also add a resolved regionRef to the other endpoints.
Then you would need 2 regions: endpoint-dependency that we create in step0 that is the resolved dependency and endpoint-dependency-pending that we create in step1 that is the one we'll be waiting on (similar to what we do for Service).
| if osResource.Region != "" { | ||
| resourceStatus.WithRegion(osResource.Region) | ||
| } | ||
|
|
There was a problem hiding this comment.
FWIW, the Keystone catalog API deprecated the region parameter as of v3.2, and now the API returns the region ID (and also the region field).
It would be good to have the most supported field here in the future. This involves a change on Gophercloud to support this field. Filed gophercloud/gophercloud#3943
| return nil, false | ||
| } | ||
|
|
||
| region, _ := dependency.FetchDependency[*orcv1alpha1.Region]( |
There was a problem hiding this comment.
Change to regionDependency.GetDependency so we add the finalizer to the resource in case of adoption.
| # We expect the deletion to hang due to the finalizer, so use --wait=false | ||
| - command: kubectl delete service.openstack.k-orc.cloud endpoint-dependency --wait=false | ||
| namespaced: true | ||
| - command: kubectl delete region.openstack.k-orc.cloud endpoint-dependency --wait=false |
There was a problem hiding this comment.
From what I can see, the region is being created and indeed being deleted, not hanging waiting for a finalizer. I think this is a consequence of using FetchDependency which doesn't add the finalizer to the resource unlike the GetDependency. Suggested that.
This uses the Region resource implemented in #862 and therefore uses that branch as a base. We would obviously need to merge #862 first.
Other than that I consider this change good to go.