Azure / Azure/Azure-Spring-Apps
Autoscale settings are lost with new Production deployment
- Dominant language
- No language data
- Stars
- 9
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
I've been having issues with custom autoscaling configuration. When creating the autoscaling configuration it sets the targetResourceUri to the current Production **deployment** of the application. When a new deployment for the application is created and set to the Production deployment, the autoscaling configuration is lost. I have example files of the JSON from the configuration attached. The file named instashare-web-autoascale-deployv1-bydeployment.json.txt is the autoscale configuration that was configured and saved for deployment 'deploy-v1'. File named instashare-web-autoascale-deployv2.json.txt is the JSON after 'deploy-v2' was created and set to Production. Notice that all original configuration was lost.
It seems like autoscaling should have a targetResourceUri of the Spring App and not a specific deployment because we're going to continually be creating new deployments and we shouldn't have to keep re-creating autoscaling configuration each time we create a new deployment.
I used terraform resource azurerm_monitor_autoscale_setting to test out setting the targetResourceUri to a Spring App resource (not a specific deployment) and applying that terraform change resulted in an error:
│ Error: creating Monitor Autoscale Setting: (Name "instashare-web-autoscale" / Resource Group "rg-lzcorpspring-prod-cus-01"): insights.AutoscaleSettingsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="ResourceNotSupported" Message="The target resource id '/subscriptions/9aa02046-18ee-4de0-bd58-3c9586f39df2/resourceGroups/rg-lzcorpspring-prod-cus-01/providers/Microsoft.AppPlatform/spring/spring-lzcorpspring-prod-cus-01/apps/instashare-web' is not supported."
I've attached the full terraform apply output with errors in the file terraform-spring-app-autoscale-fail.txt
It also seems like the Metric Source should be the **Spring App** resource and not the current Production deployment resource at that point of time. And the Dimension should just include the Instance value. The deployment should just be the current **running** Production deployment resource at runtime. When configuring autoscaling, I changed the Metric Source to the overall Spring Apps Service and then picked the app and all deployment values as one configuration approach - see file instashare-web-autoascale-deployv1-byapp.json.txt. But I wasn't sure if that approach would actually pickup the Staging deployment metrics if it was actually running? The other configuration approach was to pick the app and a specific deployment (see file instashare-web-autoascale-deployv1-bydeployment.json.txt) but that doesn't seem correct because, per the point of this Issue, that would seem to break when the next production deployment is created.
**To Reproduce**
Steps to reproduce the behavior:
1. Create a production deployment of a Spring App
2. Create custom autoscale configuration for that deployment
3. Create a new production deployment of the same Spring App
4. Notice that the custom autoscale configuration is not gone for the Spring App in the Portal and it is set to Manual scale
**Expected behavior**
The autoscaling config should remain on each new deployment of the application
**Can we contact you for additional details?** Y/N
Y
[instashare-web-autoascale-deployv1-bydeployment.json.txt](https://github.com/Azure/Azure-Spring-Apps/files/11737850/instashare-web-autoascale-deployv1-bydeployment.json.txt)
[instashare-web-autoascale-deployv2.json.txt](https://github.com/Azure/Azure-Spring-Apps/files/11737852/instashare-web-autoascale-deployv2.json.txt)
[instashare-web-autoascale-deployv1-byapp.json.txt](https://github.com/Azure/Azure-Spring-Apps/files/11737857/instashare-web-autoascale-deployv1-byapp.json.txt)
[terraform-spring-app-autoscale-fail.txt](https://github.com/Azure/Azure-Spring-Apps/files/11737898/terraform-spring-app-autoscale-fail.txt)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.