Conversation
Signed-off-by: Domagoj Marsic <domagoj.marsic@sendoso.com>
If a secret doesn't contain port, the provider won't be able to connect as it will use an empty string, which then turns to 0. An attempt to connect times out since this is not a valid port. This is the case with connection secrets created by provider-aws, for example for DBCluster. We should assume that the absence of the port key/value means that connection should happen over the default port, 3306 for MySQL servers. Signed-off-by: Domagoj Marsic <domagoj.marsic@sendoso.com>
Duologic
left a comment
There was a problem hiding this comment.
This could work as a stop-gap but has a very limited usecase.
I've touched a similar problem where I wanted to set the endpoint to local pod (cloudsql-proxy on GCP), I managed to workaround it by passing in the endpoint/port through a label on a Composition.
However it can be a bit more generic, perhaps we can extend the ProviderConfigs with overrides for host/port? This can be fairly generic for all 3 database types. WDYT?
I think that extending the |
|
I'd be up for merging this if someone can rebase. |
|
@sendmars please rebase. |
|
@sendmars could you rebase this PR? Thanks! Otherwise I'll close it to clean up the PR backlog, but anyone interrested could recreate a similar PR. It would be nice to ensure all supported databases behave the same way, at least if that makes sense for all. |
Description of your changes
When connection secret doesn't contain
port, this change assumes default port for MySQL, 3306.This is needed because provider-aws doesn't write port (by default) to the connection secret for Aurora DB cluster. Provider-sql shouldn't accept the empty string as it is an invalid value for port, and assume that a missing value should default to the standard port.
Fixes #76
I have:
make reviewable testto ensure this PR is ready for review.How has this code been tested
[Testing incomplete]
I ran
make runlocally, which caused a local reconciler to run in parallel with the one in the kubernetes cluster.When describing the
user.mysqlon the kubernetes cluster, I see (messages only, for readability):The change sets the port correctly. The connection to db_host:3306 is open, so I would expect that the user is created. The problem seem not to be related to my change, but I would need some assistance in figuring this out. The debug output contains (newlines added manually):
I checked that the port 3306 is part of
c.dbinObserve. I suspect that the issue with connection comes from the interaction of the two reconcilers.