Azure / service-fabric-mesh-preview

Service Fabric Mesh is the Service Fabric's serverless offering to enable developers to deploy containerized applications without managing infrastructure. Service Fabric Mesh , aka project “SeaBreeze” is currently available in private preview. This repository will be used for tracking bugs/feature requests as GitHub issues and for maintaining the latest documentation.
MIT License
82 stars 13 forks source link

Deployment failed because of ARM parameters #223

Closed tomkerkhove closed 5 years ago

tomkerkhove commented 6 years ago

I'm currenly using an ARM template which has a parameter for the application name. Unfortunately this is causing the deployment to fail:

CLI Version

0.8.0rc2

Command

This is the command that was being used:

az mesh deployment create --resource-group containo-apps --template-uri https://containo.blob.core.windows.net/mesh-deployment/issues/223/service-fabric-mesh-orders-declaration.json --parameters Application.me=Containo.Orders

Error

Deployment failed [parameters('Application.Name')] could not be reached. To recieve additional information run the following to get the status of the application deployment. az mesh app show --resource-group containo-apps --name [parameters('Application.Name')] The resource operation completed with terminal provisioning state 'Failed'. 'details' Traceback (most recent call last): File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 197, in invoke cmd_result = self.invocation.execute(args) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 337, in execute six.reraise(sys.exc_info()) File "/opt/az/lib/python3.6/site-packages/six.py", line 693, in reraise raise value File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 311, in execute result = cmd(params) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 170, in call return super(AzCliCommand, self).call(args, *kwargs) File "/opt/az/lib/python3.6/site-packages/knack/commands.py", line 109, in call return self.handler(args, kwargs) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/init.py", line 421, in default_command_handler result = op(command_args) File "/home/tom/.azure/cliextensions/mesh/azext_mesh/custom.py", line 361, in deploy_arm_template deployment_name, parameters, mode, no_wait=no_wait) File "/home/tom/.azure/cliextensions/mesh/azext_mesh/custom.py", line 348, in _deploy_arm_template_core if error_message['error']['details']: KeyError: 'details'

ARM Template

{
    "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "Application.Name": {
            "type": "string",
            "defaultValue": "Containo.Orders",
            "metadata": {
                "description": "Name of the Service Fabric Application"
            }
        },
        "Application.Description": {
            "type": "string",
            "defaultValue": "Application that is used to create orders",
            "metadata": {
                "description": "Description of the Service Fabric Application"
            }
        },
        "Application.Environment": {
            "type": "string",
            "defaultValue": "Development",
            "metadata": {
                "description": "Environment in which the application is running"
            }
        },
        "Application.Network.Name": {
            "type": "string",
            "defaultValue": "Containo.Network.Public",
            "metadata": {
                "description": "Name of network to use in which your Service Fabric Application will be"
            }
        },
        "Application.Queues.Name": {
            "type": "string",
            "defaultValue": "orders-service-fabric-mesh",
            "metadata": {
                "description": "Name of network the queue that will be used for creating orders"
            }
        },
        "ServiceBus.ConnectionString": {
            "type": "securestring",
            "metadata": {
                "description": "Connection string to the Service Bus Namespace"
            }
        },
        "TableStorage.ConnectionString": {
            "type": "securestring",
            "metadata": {
                "description": "Connection string to Azure Storage"
            }
        },
        "Redis.ConnectionString": {
            "type": "securestring",
            "metadata": {
                "description": "Connection string to a Redis Cluster"
            }
        },
        "Region": {
            "type": "string",
            "defaultValue": "eastus",
            "metadata": {
                "description": "Region in which the resources will be deployed"
            }
        }
    },
    "resources": [
        {
            "apiVersion": "2018-07-01-preview",
            "name": "[parameters('Application.Network.Name')]",
            "type": "Microsoft.ServiceFabricMesh/networks",
            "location": "[parameters('Region')]",
            "dependsOn": [],
            "properties": {
                "description": "Public network for Containo",
                "addressPrefix": "10.0.0.4/22",
                "ingressConfig": {
                    "qosLevel": "bronze",
                    "layer4": [
                        {
                            "publicPort": "1337",
                            "applicationName": "[parameters('Application.Name')]",
                            "serviceName": "Containo.Orders.API",
                            "endpointName": "HTTP-Public-APIs-Orders"
                        }
                    ]
                }
            }
        },
        {
            "apiVersion": "2018-07-01-preview",
            "name": "[parameters('Application.Name')]",
            "type": "Microsoft.ServiceFabricMesh/applications",
            "location": "[parameters('Region')]",
            "properties": {
                "description": "[parameters('Application.Description')]",
                "services": [
                    {
                        "name": "Containo.Orders.API",
                        "properties": {
                            "description": "Containo Orders API",
                            "osType": "linux",
                            "codePackages": [
                                {
                                    "name": "Containo.Orders.API",
                                    "image": "tomkerkhove/containo.services.orders.api:0.1.0.19",
                                    "endpoints": [
                                        {
                                            "name": "HTTP-Public-APIs-Orders",
                                            "port": 80
                                        }
                                    ],
                                    "environmentVariables": [
                                        {
                                            "name": "ASPNETCORE_ENVIRONMENT",
                                            "value": "[parameters('Application.Environment')]"
                                        },
                                        {
                                            "name": "ASPNETCORE_URLS",
                                            "value": "http://+:80"
                                        },
                                        {
                                            "name": "Orders_Queue_Name",
                                            "value": "[parameters('Application.Queues.Name')]"
                                        },
                                        {
                                            "name": "ServiceBus_ConnectionString",
                                            "value": "[parameters('ServiceBus.ConnectionString')]"
                                        },
                                        {
                                            "name": "TableStorage_ConnectionString",
                                            "value": "[parameters('TableStorage.ConnectionString')]"
                                        },
                                        {
                                            "name": "Redis_ConnectionString",
                                            "value": "[parameters('Redis.ConnectionString')]"
                                        },
                                        {
                                            "name": "Services_Validation_Url",
                                            "value": "http://localhost:81"
                                        }
                                    ],
                                    "resources": {
                                        "requests": {
                                            "cpu": 1,
                                            "memoryInGB": 1
                                        }
                                    }
                                },
                                {
                                    "name": "Containo.Orders.Validator",
                                    "image": "tomkerkhove/containo.services.orders.validator:0.1.0.19",
                                    "endpoints": [],
                                    "environmentVariables": [
                                        {
                                            "name": "ASPNETCORE_ENVIRONMENT",
                                            "value": "[parameters('Application.Environment')]"
                                        },
                                        {
                                            "name": "ASPNETCORE_URLS",
                                            "value": "http://+:81"
                                        }
                                    ],
                                    "resources": {
                                        "requests": {
                                            "cpu": 1,
                                            "memoryInGB": 1
                                        }
                                    }
                                }
                            ],
                            "replicaCount": 1,
                            "networkRefs": [
                                {
                                    "name": "[resourceId('Microsoft.ServiceFabricMesh/networks', parameters('Application.Network.Name'))]"
                                }
                            ]
                        }
                    },
                    {
                        "name": "Containo.Orders.QueueProcessor",
                        "properties": {
                            "description": "Queue processor that will handle the order messages",
                            "osType": "linux",
                            "codePackages": [
                                {
                                    "name": "Containo.Orders.QueueProcessor",
                                    "image": "tomkerkhove/containo.services.orders.queueprocessor:0.1.0.19",
                                    "endpoints": [],
                                    "environmentVariables": [
                                        {
                                            "name": "ASPNETCORE_ENVIRONMENT",
                                            "value": "[parameters('Application.Environment')]"
                                        },
                                        {
                                            "name": "Orders_Queue_Name",
                                            "value": "[parameters('Application.Queues.Name')]"
                                        },
                                        {
                                            "name": "ServiceBus_ConnectionString",
                                            "value": "[parameters('ServiceBus.ConnectionString')]"
                                        },
                                        {
                                            "name": "TableStorage_ConnectionString",
                                            "value": "[parameters('TableStorage.ConnectionString')]"
                                        }
                                    ],
                                    "resources": {
                                        "requests": {
                                            "cpu": 1,
                                            "memoryInGB": 1
                                        }
                                    }
                                }
                            ],
                            "replicaCount": 1,
                            "networkRefs": [
                                {}
                            ]
                        }
                    }
                ]
            }
        }
    ]
}
SamirFarhat commented 6 years ago

Don't you think because you have a "dot" on your parameter name. Have you tried AppName instead

tomkerkhove commented 6 years ago

This is supported in ARM so this should work with Mesh as well

mattrowmsft commented 6 years ago

I think this is CLI bug and should work if you use the generic ARM deployment commands.

vipul-modi commented 6 years ago

Specify the parameters using the following syntax. Please reopen the issue, if this does not work.

--parameters "{\"location\": {\"value\": \"eastus\"}}"
tomkerkhove commented 6 years ago

The parameter in the ARM template has a default value so it should not be passed and just take that one, please feel free to re-open as I think this is a CLI bug

mattrowmsft commented 6 years ago

@VipulM-MSFT I think you commented/closed on wrong issue. I think this is related to the parsing that is happening of the app to provide better status details after deployment completes.

jeffj6123 commented 6 years ago

@mattrowmsft Yeah, there does appear to be an issue with the way the CLI attempted to parse the error message but would not be the cause of the deployment failure. Given it still goes through ARM, you should be able to see the reason for the deployment failure using the "az group deployment show" cmd. The CLI issue here occurs after the deployment itself has already failed.

tomkerkhove commented 5 years ago

This is no longer the case as far as I know.