Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResourceRecordSet Observe() fails when using dynamic endpoint configuration #1408

Closed
bobh66 opened this issue Aug 5, 2022 · 0 comments · Fixed by #1411
Closed

ResourceRecordSet Observe() fails when using dynamic endpoint configuration #1408

bobh66 opened this issue Aug 5, 2022 · 0 comments · Fixed by #1411
Labels
bug Something isn't working

Comments

@bobh66
Copy link
Contributor

bobh66 commented Aug 5, 2022

What happened?

The Observe function for ResourceRecordSets (or any Route53 resource) fails when the ProviderConfig is using dynamic endpoint configuration:

1.6596247083644836e+09  DEBUG   provider-aws    Cannot observe external resource        {
"controller": "managed/resourcerecordset.route53.aws.crossplane.io", 
"request": "/jowtest-26wj2-zlt8h", 
"uid": "5875de14-0b0c-4c21-a0b6-f3cda5cec400", 
"version": "728082259", 
"external-name": "jowtest-26wj2-zlt8h", 
"error": "failed to list the ResourceRecordSet resource: operation error Route 53: ListResourceRecordSets, failed to parse endpoint URL: parse \"https://route 53.us-east-1.amazonaws.com\": invalid character \" \" in host name",
"errorVerbose": "operation error Route 53: ListResourceRecordSets, failed to parse endpoint URL: parse \"https://route 53.us-east-1.amazonaws.com\": invalid character \" \" in host name
failed to list the ResourceRecordSet resource
github.com/crossplane-contrib/provider-aws/pkg/clients.Wrap
    /home/runner/work/provider-aws/provider-aws/pkg/clients/aws.go:1261
github.com/crossplane-contrib/provider-aws/pkg/controller/route53/resourcerecordset.(*external).Observe
    /home/runner/work/provider-aws/provider-aws/pkg/controller/route53/resourcerecordset/controller.go:107
github.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile
    /home/runner/work/provider-aws/provider-aws/vendor/github.com/crossplane/crossplane-runtime/pkg/reconciler/managed/reconciler.go:767
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile
    /home/runner/work/provider-aws/provider-aws/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:114
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
    /home/runner/work/provider-aws/provider-aws/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:311
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
    /home/runner/work/provider-aws/provider-aws/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:266
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
    /home/runner/work/provider-aws/provider-aws/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:227
runtime.goexit
    /opt/hostedtoolcache/go/1.17.11/x64/src/runtime/asm_amd64.s:1581"}

How can we reproduce it?

Use the following ProviderConfig:

---
apiVersion: aws.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
 name: default
spec:
 credentials:
   source: InjectedIdentity
 endpoint:
   signingRegion: us-east-1
   url:
     dynamic:
       host: amazonaws.com
       protocol: https
     type: Dynamic

and deploy a ResourceRecordSet resource. When provider-aws tries to Observe the resource, the above error is caused because the Service ID for Route53 in the AWS SDK contains a space:

https://github.com/aws/aws-sdk-go-v2/blob/main/service/route53/api_client.go#L26

and the AWS client code is using the service as a part of the URL:

https://github.com/crossplane-contrib/provider-aws/blob/master/pkg/clients/aws.go#L195

Also Route53 is a "global" service like IAM so the region is not part of the URL and it needs to be handled the same way as IAM is handled today:

https://github.com/crossplane-contrib/provider-aws/blob/master/pkg/clients/aws.go#L193

I will push a PR.

What environment did it happen in?

Crossplane version: 1.9.0
AWS Provider 0.29.0

@bobh66 bobh66 added the bug Something isn't working label Aug 5, 2022
bobh66 added a commit to bobh66/provider-aws that referenced this issue Aug 5, 2022
haarchri added a commit that referenced this issue Aug 8, 2022
Handle Route 53 service discovery - Fixes #1408
AlessandroBenoni pushed a commit to AlessandroBenoni/provider-aws that referenced this issue Aug 17, 2022
Signed-off-by: Bob Haddleton <[email protected]>
Signed-off-by: Alessandro Benoni <[email protected]>
emelieakerstrom-sb1 pushed a commit to sparebank1utvikling/provider-aws that referenced this issue Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant