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

Check Name Availability/Validation for SQL Resources #245

Merged
merged 17 commits into from
Oct 2, 2019
Merged

Check Name Availability/Validation for SQL Resources #245

merged 17 commits into from
Oct 2, 2019

Conversation

melonrush13
Copy link
Contributor

@melonrush13 melonrush13 commented Sep 27, 2019

PR Fixes
Addresses issue #214

PR Adds the following:

  • CheckNameAvailability function to the SqlClient GoSDK
  • ToAvailabilityResponse function which converts response messages from CheckNameAvailability
  • Event Recorder which records the error of the server name
  • Stops Requeue of the reconcile loop once sqlserver message is servername is invalid

Running the test:

  • Run the operator using make run
  • Create a sqlserver with the name sqlserver1.2 in the file: config/samples/azure_v1_sqlserver.yaml
  • In another terminal window, run kubectl create -f config/samples/azure_v1_sqlserver.yaml file

Should get an error in the first terminal for:
DEBUG controller-runtime.manager.events Warning {"object": {"kind":"SqlServer","namespace":"default","name":"sqlserver1.2","uid":"9311940d-e168-11e9-b1dc-5a2bc381628e","apiVersion":"azure.microsoft.com/v1","resourceVersion":"160697"}, "reason": "Failed", "message": "Servername is invalid"} 2019-09-27T14:51:35.917-0600 INFO controllers.SqlServer Specified server name contains unsupported characters or is too long. Server name must be no longer than 63 characters long, contain only lower-case characters or digits, cannot contain '.' or '_' characters and can't start or end with '-' character. {"sqlserver": "default/sqlserver1.2"} 2019-09-27T14:51:35.917-0600 INFO controllers.SqlServer Servername is invalid {"sqlserver": "default/sqlserver1.2"} 2019-09-27T14:51:35.917-0600 ERROR controller-runtime.controller Reconciler error {"controller": "sqlserver", "request": "default/sqlserver1.2", "error": "Servername invalid sqlserver1.2"}

  • Run a kubectl describe sqlserver sqlserver1.2, should get:
Events:
  Type     Reason  Age                 From                  Message
  ----     ------  ----                ----                  -------
  Warning  Failed  20m (x21 over 75m)  SqlServer-controller  Servername is invalid

Controller successfully errors out, and
If applicable:

  • this PR contains documentation
  • this PR contains tests

@melonrush13
Copy link
Contributor Author

Fixed those three @frodopwns ! Thanks for that. Lemme know if there is anything else you think could be better/needs fixing.

Copy link
Contributor

@jananivMS jananivMS left a comment

Choose a reason for hiding this comment

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

LGTM except for the minor comment

controllers/sqlserver_controller.go Outdated Show resolved Hide resolved
@melonrush13 melonrush13 merged commit becb841 into Azure:azure-sql Oct 2, 2019
Porges pushed a commit that referenced this pull request May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants