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

Bug: Found an issue with Azure SQL Server where it doesnt recognize existing SQL servers #782

Closed
wants to merge 15 commits into from
Closed

Conversation

WilliamMortlMicrosoft
Copy link
Contributor

@WilliamMortlMicrosoft WilliamMortlMicrosoft commented Mar 17, 2020

closes #783

The Azure SQL Server operator should detect if a SQL server exists in the selected resource group and then complete reconciliation. The code was blocking that functionality. This bug fix addresses that issue.

To test:

  1. create new SQL servers from scratch (that works with out issue)
  2. create a SQL server in the portal and then configure your YAML to point to that SQL server - it should reconcile almost immediately

giphy

@WilliamMortlMicrosoft WilliamMortlMicrosoft added bug 🪲 Something isn't working azure-sql high-priority Issues we intend to prioritize (security, outage, blocking bug) labels Mar 17, 2020
@WilliamMortlMicrosoft WilliamMortlMicrosoft self-assigned this Mar 17, 2020
@@ -106,22 +106,21 @@ func (s *AzureSqlServerManager) Ensure(ctx context.Context, obj runtime.Object,
instance.Status.SpecHash = hash
}

if instance.Status.Provisioning {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line was blocking the reconciler from "attaching" to existing SQL Servers - that was the desired functionality at one time, is it not anymore @jananivMS ?

Copy link
Contributor

@jananivMS jananivMS Mar 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frodopwns fixed this as part of his PR here - #741 and I tested this. This scenario worked fine, so wondering what was the scenario that you saw the failure in, @WilliamMortlMicrosoft ? Status.Message would tell you if this reconcile doesnt happen. One of the cases where this happens is if the SQL server is present but the secret is not present in kube/keyvault. This is because we dont know the admin creds of an existing server and for it to work correctly we need to have the person externally creating the SQL server to also populate the secret.

@jananivMS jananivMS requested review from frodopwns and removed request for jskulavik and jananivMS March 17, 2020 22:44
@frodopwns
Copy link
Contributor

The scenario #2 only works if you create a secret with the username and password for the sql server you created manually.

Also, when you say "update your yaml" are you talking about patching the first sql server you created or changing the yaml and then deploying a new server?

@WilliamMortlMicrosoft
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@WilliamMortlMicrosoft
Copy link
Contributor Author

The scenario #2 only works if you create a secret with the username and password for the sql server you created manually.

Also, when you say "update your yaml" are you talking about patching the first sql server you created or changing the yaml and then deploying a new server?

What SQL server wasn't doing is recognizing that server existed... This used to be an important criteria... happy to pull the PR @frodopwns if you think it isnt needed

@frodopwns
Copy link
Contributor

@WilliamMortlMicrosoft reviewer should just verify they can repro

@jananivMS
Copy link
Contributor

@WilliamMortlMicrosoft is this on master? I can give this a try as I did the testing for the different scenarios in Erin’s PR and see if it reproduces and then work with you on if we need this PR.

@frodopwns
Copy link
Contributor

@WilliamMortlMicrosoft Is this basically what you were seeing?

2020-03-18T11:51:20.516-0600	DEBUG	controller-runtime.controller	Successfully Reconciled	{"controller": "azuresqlserver", "request": "default/sqlserver-reprobugziller"}
2020-03-18T11:51:20.516-0600	INFO	controllers.AzureSqlServer	reconciling object	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": "default/sqlserver-reprobugziller"}
2020-03-18T11:51:24.279-0600	INFO	controllers.AzureSqlServer	reconciling object not finished	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": "default/sqlserver-reprobugziller"}
2020-03-18T11:51:24.279-0600	INFO	controllers.AzureSqlServer	exiting reconciliation	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": ""}
2020-03-18T11:51:24.279-0600	INFO	controllers.AzureSqlServer	reconciling object	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": "default/sqlserver-reprobugziller"}
2020-03-18T11:51:26.647-0600	INFO	controllers.AzureSqlServer	reconciling object not finished	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": "default/sqlserver-reprobugziller"}
2020-03-18T11:51:26.647-0600	INFO	controllers.AzureSqlServer	exiting reconciliation	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": ""}
2020-03-18T11:51:44.280-0600	INFO	controllers.AzureSqlServer	reconciling object	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": "default/sqlserver-reprobugziller"}
2020-03-18T11:51:46.699-0600	INFO	controllers.AzureSqlServer	reconciling object not finished	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": "default/sqlserver-reprobugziller"}
2020-03-18T11:51:46.699-0600	INFO	controllers.AzureSqlServer	exiting reconciliation	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": ""}
status:
  message: "SQL server already exists and the credentials could not be found. \n\t\t\t\tIf
    using kube secrets a secret should exist at 'default/sqlserver-reprobugziller'
    for keyvault it should be 'default-sqlserver-reprobugziller'"

@WilliamMortlMicrosoft
Copy link
Contributor Author

@WilliamMortlMicrosoft Is this basically what you were seeing?

2020-03-18T11:51:20.516-0600	DEBUG	controller-runtime.controller	Successfully Reconciled	{"controller": "azuresqlserver", "request": "default/sqlserver-reprobugziller"}
2020-03-18T11:51:20.516-0600	INFO	controllers.AzureSqlServer	reconciling object	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": "default/sqlserver-reprobugziller"}
2020-03-18T11:51:24.279-0600	INFO	controllers.AzureSqlServer	reconciling object not finished	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": "default/sqlserver-reprobugziller"}
2020-03-18T11:51:24.279-0600	INFO	controllers.AzureSqlServer	exiting reconciliation	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": ""}
2020-03-18T11:51:24.279-0600	INFO	controllers.AzureSqlServer	reconciling object	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": "default/sqlserver-reprobugziller"}
2020-03-18T11:51:26.647-0600	INFO	controllers.AzureSqlServer	reconciling object not finished	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": "default/sqlserver-reprobugziller"}
2020-03-18T11:51:26.647-0600	INFO	controllers.AzureSqlServer	exiting reconciliation	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": ""}
2020-03-18T11:51:44.280-0600	INFO	controllers.AzureSqlServer	reconciling object	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": "default/sqlserver-reprobugziller"}
2020-03-18T11:51:46.699-0600	INFO	controllers.AzureSqlServer	reconciling object not finished	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": "default/sqlserver-reprobugziller"}
2020-03-18T11:51:46.699-0600	INFO	controllers.AzureSqlServer	exiting reconciliation	{"Info Type": "status", "Component": "AzureSqlServer", "Instance": ""}
status:
  message: "SQL server already exists and the credentials could not be found. \n\t\t\t\tIf
    using kube secrets a secret should exist at 'default/sqlserver-reprobugziller'
    for keyvault it should be 'default-sqlserver-reprobugziller'"

yes

@WilliamMortlMicrosoft
Copy link
Contributor Author

@jananivMS said working as expected - so closing the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working high-priority Issues we intend to prioritize (security, outage, blocking bug)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: SQL Server reconciler doesnt properly recognize existing SQL Servers
3 participants