provider-sql icon indicating copy to clipboard operation
provider-sql copied to clipboard

Error 9002 during connection to MySQL hosted in Azure

Open ppmkmd opened this issue 1 year ago • 0 comments

What happened?

When we attempt to create a new user in the database it seems that provider-sql can not log in to the database itself. Here is debug logs:

2022-08-25T14:04:08.317Z DEBUG provider-sql Reconciling {"controller": "managed/user.mysql.sql.crossplane.io", "request": "/exampleuser"} 2022-08-25T14:04:08.409Z DEBUG provider-sql Cannot observe external resource {"controller": "managed/user.mysql.sql.crossplane.io", "request": "/exampleuser", "uid": "68243871-fa7e-49f0-bad4-21c184077cf7", "version": "562498608", "external-name": "exampleuser", "error": "cannot select user: Error 9002: The server name you tried cannot be found: crossplane. Please check the Username and retry connection. The Username should be in username@hostname format.\u0000", "errorVerbose": "Error 9002: The server name you tried cannot be found: crossplane. Please check the Username and retry connection. The Username should be in username@hostname format.\u0000\ncannot select user\ngithub.com/crossplane-contrib/provider-sql/pkg/controller/mysql/user.(*external).Observe\n\t/home/runner/work/provider-sql/provider-sql/pkg/controller/mysql/user/reconciler.go:216\ngithub.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/github.com/crossplane/[email protected]/pkg/reconciler/managed/reconciler.go:577\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:293\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:248\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1.1\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:211\nk8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext.func1\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:185\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:155\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:156\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:133\nk8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:185\nk8s.io/apimachinery/pkg/util/wait.UntilWithContext\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:99\nruntime.goexit\n\t/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/asm_amd64.s:1581"} 2022-08-25T14:04:08.410Z DEBUG controller-runtime.manager.events Warning {"object": {"kind":"User","name":"exampleuser","uid":"68243871-fa7e-49f0-bad4-21c184077cf7","apiVersion":"mysql.sql.crossplane.io/v1alpha1","resourceVersion":"562498608"}, "reason": "CannotObserveExternalResource", "message": "cannot select user: Error 9002: The server name you tried cannot be found: crossplane. Please check the Username and retry connection. The Username should be in username@hostname format.\u0000"} 2022-08-25T14:04:08.425Z DEBUG provider-sql Reconciling {"controller": "managed/user.mysql.sql.crossplane.io", "request": "/exampleuser"} 2022-08-25T14:04:08.476Z DEBUG provider-sql Cannot observe external resource {"controller": "managed/user.mysql.sql.crossplane.io", "request": "/exampleuser", "uid": "68243871-fa7e-49f0-bad4-21c184077cf7", "version": "564502226", "external-name": "exampleuser", "error": "cannot select user: Error 9002: The server name you tried cannot be found: crossplane. Please check the Username and retry connection. The Username should be in username@hostname format.\u0000", "errorVerbose": "Error 9002: The server name you tried cannot be found: crossplane. Please check the Username and retry connection. The Username should be in username@hostname format.\u0000\ncannot select user\ngithub.com/crossplane-contrib/provider-sql/pkg/controller/mysql/user.(*external).Observe\n\t/home/runner/work/provider-sql/provider-sql/pkg/controller/mysql/user/reconciler.go:216\ngithub.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/github.com/crossplane/[email protected]/pkg/reconciler/managed/reconciler.go:577\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:293\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:248\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1.1\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:211\nk8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext.func1\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:185\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:155\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:156\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:133\nk8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:185\nk8s.io/apimachinery/pkg/util/wait.UntilWithContext\n\t/home/runner/work/provider-sql/provider-sql/.work/pkg/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:99\nruntime.goexit\n\t/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/asm_amd64.s:1581"} 2022-08-25T14:04:08.476Z DEBUG controller-runtime.manager.events Warning {"object": {"kind":"User","name":"exampleuser","uid":"68243871-fa7e-49f0-bad4-21c184077cf7","apiVersion":"mysql.sql.crossplane.io/v1alpha1","resourceVersion":"564502226"}, "reason": "CannotObserveExternalResource", "message": "cannot select user: Error 9002: The server name you tried cannot be found: crossplane. Please check the Username and retry connection. The Username should be in username@hostname format.\u0000"}

How can we reproduce it?

You can reproduce it by trying to create a new user using a user with the pattern - username@hostname kubectl command to create secret we use:

create secret generic crossplane-db-auth-secret\
    --from-literal=username=crossplane@xyz \
    --from-literal=password={{ crossplane_mysql_password }} \
    --from-literal=endpoint=xyz.mysql.database.azure.com \
    --from-literal=port=3306

What environment did it happen in?

Crossplane version: 1.9.0 Provider package: crossplane/provider-sql:v0.5.0 Azure Database for MySQL single server version: 5.7 AKS version: 1.22.6

ppmkmd avatar Aug 25 '22 14:08 ppmkmd