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: Creating a SQL server with an invalid name should error out #214

Closed
jananivMS opened this issue Sep 11, 2019 · 2 comments
Closed

Bug: Creating a SQL server with an invalid name should error out #214

jananivMS opened this issue Sep 11, 2019 · 2 comments
Assignees
Labels
bug 🪲 Something isn't working

Comments

@jananivMS
Copy link
Contributor

jananivMS commented Sep 11, 2019

Describe the bug
Currently when you use the invalid name sqlserver1.2 for the sqlserver, the reconcile loop keeps requeuing and trying again. We should check for the validity of the name before calling create. Ideally all SDK helpers should expose the "Validatename" function that the SDK provides

To Reproduce
Steps to reproduce the behavior:

  1. make run
  2. Use name "sqlserver1.2" in the sqlserver yaml
  3. kubectl apply

Expected behavior
Controller should error out and not create the kube instance

@jananivMS jananivMS added bug 🪲 Something isn't working azure-sql labels Sep 11, 2019
@melonrush13 melonrush13 self-assigned this Sep 12, 2019
@frodopwns
Copy link
Contributor

I'd suggest not trying to code so much server specific logic into the operator. Let's call the api and if it rejects the request due to names that are invalid, take the message and save it in the sqlserver entity status.

We need to catch this error:

2019-09-12T22:49:13.203Z	ERROR	controller-runtime.controller	Reconciler error	{"controller": "sqlserver", "request": "default/sqlserver1.2", "error": "error reconciling sql server in azure: sql.ServersClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code=\"InvalidServerName\" Message=\"Server name 'sqlserver1.2' cannot be empty or null. It can only be made up of lowercase letters 'a'-'z', the numbers 0-9 and the hyphen. The hyphen may not lead or trail in the name.\""}

@jananivMS
Copy link
Contributor Author

jananivMS commented Sep 13, 2019 via email

@melonrush13 melonrush13 added the S label Sep 23, 2019
@jananivMS jananivMS added M and removed S labels Oct 7, 2019
Porges pushed a commit that referenced this issue May 11, 2021
- It is built during CI now (and by make all for local testing).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants