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: Handle InvalidApiVersionParameter on Empty ResourceGroup / Gracefully handle 400 errs #1106

Closed
melonrush13 opened this issue May 27, 2020 · 2 comments · Fixed by #1174
Closed
Assignees
Labels
bug 🪲 Something isn't working

Comments

@melonrush13
Copy link
Contributor

melonrush13 commented May 27, 2020

We should remove 'omitempty' from the types files for Resourcegroup from AzureSqlServer types. file and also other types if the issue exists. This will ensure that we catch the error if resourcegroup is not specified which causes this issue.

Describe the bug

The following error occurs for creating a V1Alpha1 azuresqlserver with an empty resource group or invalid named resourcegroup.

"Error": "sql.ServersClient#Get: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code=\"InvalidApiVersionParameter\" Message=\"The api-version '2015-05-01-preview' is invalid. The supported versions are '2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'.\"", "Instance": "default/sqlserver-sample-777"}

To Reproduce
Steps to reproduce the behavior:
k create -f config/samples/azure_v1alpha1_azuresqlserver.yaml
My Resource Group Name: resourcegroup-azure-operators-mel

Expected behavior
Gracefully handle 400 errors (similarly to how Redis Cache handles future errs)

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

@melonrush13 melonrush13 added bug 🪲 Something isn't working azure-sql high-priority Issues we intend to prioritize (security, outage, blocking bug) and removed high-priority Issues we intend to prioritize (security, outage, blocking bug) labels May 27, 2020
@melonrush13 melonrush13 changed the title Bug: Fix AzureSqlServer Azure Autorest error InvalidApiVersionParameter Bug: Handle InvalidApiVersionParameter on Empty ResourceGroup / Gracefullt handle 400 errs May 27, 2020
@melonrush13 melonrush13 changed the title Bug: Handle InvalidApiVersionParameter on Empty ResourceGroup / Gracefullt handle 400 errs Bug: Handle InvalidApiVersionParameter on Empty ResourceGroup / Gracefully handle 400 errs May 27, 2020
@jananivMS
Copy link
Contributor

We should remove 'omitempty' from the types files for Resourcegroup from AzureSqlServer types. file and also other types if the issue exists. This will ensure that we catch the error if resourcegroup is not specified which causes this issue.

@matthchr matthchr self-assigned this Jun 22, 2020
matthchr added a commit to matthchr/azure-service-operator that referenced this issue Jun 23, 2020
@matthchr
Copy link
Member

@melonrush13 were you testing this in kind, or in an AKS cluster with webhooks enabled?

This error definitely happens when resourceGroup is empty, but that's not actually possible based on the CRD (it's required for both v1alpha1 and v1beta). It's possible to get an resourceGroup string if you create a v1alpha1 resource with webhooks disabled though (because conversion from v1alpha1 -> v1beta1 wasn't run).

I've filed an issue for the Go SDK folks since the SDK is supposed to do this check, but in the meantime I've updated the controller to check this manually and give a better error in #1232132

matthchr added a commit to matthchr/azure-service-operator that referenced this issue Jun 23, 2020
matthchr added a commit to matthchr/azure-service-operator that referenced this issue Jun 26, 2020
matthchr added a commit that referenced this issue Jun 26, 2020
* Improve error when SQL server doesn't have RG specified

  - This fixes #1106.

* Update all occurances of Resourcegroup to have validation

  - They should be required, min length 1, and matching the specified
    Regex.

* Fix some tests

* PR feedback
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

Successfully merging a pull request may close this issue.

3 participants