Azure service fabric 服务结构ServiceManifest参数化Traefik反向代理

Azure service fabric 服务结构ServiceManifest参数化Traefik反向代理,azure-service-fabric,traefik,Azure Service Fabric,Traefik,在我的ServiceManifest中,我有以下配置: <ServiceTypes> <!-- This is the name of your ServiceType. This name must match the string used in RegisterServiceType call in Program.cs. --> <StatelessServiceType ServiceTypeName="Web1Type

在我的ServiceManifest中,我有以下配置:

<ServiceTypes>
    <!-- This is the name of your ServiceType. 
         This name must match the string used in RegisterServiceType call in Program.cs. -->
    <StatelessServiceType ServiceTypeName="Web1Type">
      <Extensions>
        <Extension Name="Traefik">
          <Labels xmlns="http://schemas.microsoft.com/2015/03/fabact-no-schema">
            <Label Key="traefik.frontend.rule.hostname">Host: test.staal-it.nl#</Label>
            <Label Key="traefik.expose">true</Label>
            <Label Key="traefik.frontend.passHostHeader">true</Label>
          </Labels>
        </Extension>
      </Extensions>
    </StatelessServiceType>
  </ServiceTypes>

主持人:test.staal-it.nl#
真的
真的

我希望能够使用ApplicationParameters文件中的参数替换test.staal-it.nl,以便在将此应用程序部署到其他环境时进行更改。然而,据我所知,没有可用于扩展的覆盖xml元素。如何做到这一点。有关架构定义,请参见AFAIK,无法在扩展上使用替换值,它可能在将来的版本中

这些扩展是将Traefik与service fabric集成的一个变通方法

根据Traefik,您可以通过

这篇文章还对如何在SF上使用traefik做了一个很好的概述


您可以采取的另一种方法是使用traefik:如果您可以控制您的服务,您的服务启动程序可以调用traefik api并注册自身,然后您可以像使用普通设置一样将设置添加到服务配置中。

作为使用参数文件的变通方法,如果您使用VSTS这样的发布工具,您可以使用一个新的工具来替换不同环境中的东西。或者,在Linux上,您可以使用+环境变量之类的东西。

这就是我最后要做的。在VSTS中部署期间,使用标记器替换ServiceManifest中的主机名和ApplicationManifest中的ApplicationTypeName。虽然不理想,但它可以工作使用rest api是行不通的,因为我只能在完成滚动更新后调用它,这意味着在更新过程中我的暂存环境将侦听错误的主机名如果您喜欢设置方法,可以使用rest api在traefik上注册服务,我添加了额外的信息+链接