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

Use default Mysql port if not specified in the connection secret #76

Open
sendmars opened this issue Mar 22, 2022 · 0 comments · May be fixed by #80
Open

Use default Mysql port if not specified in the connection secret #76

sendmars opened this issue Mar 22, 2022 · 0 comments · May be fixed by #80
Labels
enhancement New feature or request

Comments

@sendmars
Copy link

What problem are you facing?

If a secret containing connection parameters for Mysql server doesn't contain port, the connection will timeout when attempting to use the provider, e.g. when creating a user:

CannotObserveExternalResource  user/test-user  cannot select user: dial tcp 10.x.x.x:0: i/o timeout

The problem is that provider-aws doesn't write port data for DB cluster (maybe for others as well). While it makes sense to address this in provider-aws, I also believe it makes sense to set a default port in provider-sql, as user's intention would likely be to connect over 3306 (instead of 0).

Example secret created by provider-aws:

apiVersion: v1
data:
  endpoint: [...]
  password: [...]
  username: [...]
kind: Secret
metadata:
  creationTimestamp: "2022-03-22T11:28:56Z"
  name: test-db-connection
  namespace: default
  ownerReferences:
  - apiVersion: rds.aws.crossplane.io/v1alpha1
    controller: true
    kind: DBCluster
    name: cluster-kw87c
    uid: [...]
  resourceVersion: [...]
  uid: [...]
type: connection.crossplane.io/v1alpha1

How could Crossplane help solve your problem?

Assume that the absence of port in the connection secret means that the connection attempt should happen over the default port.

I'd be happy to submit a PR if this proposal makes sense. As far as I can tell the required change is in pkg/clients/mysql/mysql.go, where we could put a default port constant, and use it if the port is an empty string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In progress
Development

Successfully merging a pull request may close this issue.

1 participant