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

Misleading errors when using CompositeConnectionDetails #40

Open
jtucci opened this issue Dec 1, 2023 · 1 comment
Open

Misleading errors when using CompositeConnectionDetails #40

jtucci opened this issue Dec 1, 2023 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@jtucci
Copy link
Contributor

jtucci commented Dec 1, 2023

What happened?

I defined the following CompositeConnectionDetails resource

apiVersion: meta.gotemplating.fn.crossplane.io/v1alpha1
kind: CompositeConnectionDetails
{{ if eq $.observed.resources nil }}
data: {}
{{ else }}
data:
  {{ $redisCacheMR := get .observed.resources "redis-cache" | default dict }}
  {{ $connectionString := dig "connectionDetails" "attribute.primary_connection_string" "" $redisCacheMR }}
  {{ $host := dig "status" "atProvider" "hostname" " " $redisCacheMR }}
  connection_string: {{ $connectionString }}
  host: {{ $host | b64enc }}
{{ end }}

When all the MR's successfully reached a ready state, the claim would fail with the following error.

cannot propagate connection details from composite: cannot establish
control of existing connection secret

This error was resolved by adding quotes to the host host parameter.

...
  host: {{ $host | quote | b64enc }}
 ...

This error was extremely misleading and I'm assuming thats because there's no error handling in the portion of this function which sets connection details. I'm unsure if its feasible but It might be useful to make this a little more robust by automatically quoting / encode values which aren't already in the correct format or outputting an error message.

How can we reproduce it?

set

What environment did it happen in?

Function version: v0.3.0
crossplane: v1.14.2
k8s: 1.26.9

@jtucci jtucci added the bug Something isn't working label Dec 1, 2023
@jbw976 jbw976 added the good first issue Good for newcomers label Apr 26, 2024
@phclark
Copy link

phclark commented Jun 3, 2024

I feel like, since the only Resource associated with CompositeConnectionDetails is the Composition itself, that errors generating the connection details should cause a Composition to not go into the Synced status, and the error message should populate the Synced condition message. Thoughts on this approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants