Why isn't it possible to change placement constraints in an upgrade?

后端 未结 2 788
误落风尘
误落风尘 2021-01-13 02:15

I have a stateless ASP.NET Core (RC1) service running in my Azure Service Fabric cluster. It has the following manifest:



        
相关标签:
2条回答
  • 2021-01-13 02:36

    So the issue here is actually with the DefaultService part of the ApplicationManifest. When services are created as part of the DefaultService, there are things you can't change about it afterwards. You might be able to change it through the ServiceFabric explorer, but I'm not sure.

    One recommendation would be to keep the DefaultServices empty in the ApplicationManifest, and instead create your services manually. With manual I mean either through powershell, code or the ServiceFabric Explorer. That gives you more flexibility about changing parts of the service afterwards. When it's done that way, you I know you have the possibility to change things like placement constraints after the service is running.

    To create Services with PowerShell you can use the New-ServiceFabricService command. To create it from code, you can use FabricClient to do it. A sample of that can be found here: Azure Service Fabric Multi-Tenancy

    0 讨论(0)
  • 2021-01-13 02:49

    There's actually a fairly easy way to do this without having to write a bunch of code to manually define the application on the fabric cluster.

    While you can declare the placement constraints in the service manifest, you can also declare them in the application manifest. Anything declared in the application manifest will override what's in the service manifest. And with the setting in the application manifest, you can then use parameters to alter the values based on the parameter file you want to a specific deployment.

    I've just written up a blog post that discusses this approach in greater detail. I hope you find it useful. :)

    0 讨论(0)
提交回复
热议问题