Traffic Management Config

Declare AWS Lambda aliases. Declare Istio or Linkerd traffic management for all or specific Kubernetes targets. Configure Istio settings such as virtual service and destination rule. Configure Linkerd settings like root service, canary service, active service, and traffic split.

Traffic management section

trafficManagement.

AWS Lambda

You declare your AWS Lambda alias per target in this section. CD-as-a-Service uses aliases when routing traffic from the previous version to the latest version of your function.

trafficManagement:
  - targets: ["<target-name>"]
    alias:
      - functionName:  <function-name>
        aliasName: <function-alias>
  • targets: the list of targets using this alias
  • functionName: This is the same value as artifacts.functionName and providerOptions.lambda.name. See Artifacts and Provider Options (AWS Lambda) for details on those sections.
  • aliasName: The alias name, such as “live-version”. Your function’s alias must already exist in the AWS Lambda console.

This example declares a traffic split canary strategy. You must declare your function’s alias for each deployment target that uses the traffic split strategy.

targets:
  prod-us-east-1:
    account: armory-docs-dev
    region: us-east-1
    deployAsIamRole: "arn:aws:iam::111111111111:role/ArmoryRole"
    strategy: trafficSplit
  prod-us-east-2:
    account: armory-docs-dev
    region: us-east-2
    deployAsIamRole: "arn:aws:iam::111111111111:role/ArmoryRole"
    strategy: trafficSplit
strategies:
  trafficSplit:
    canary:
      steps:
        - setWeight:
            weight: 25
        - pause:
            untilApproved: true
        - setWeight:
            weight: 100
artifacts:
  - functionName: just-sweet-potatoes-us-east-1
    path: s3://armory-demo-east-1/just-sweet-potatoes.zip
    type: zipFile
  - functionName: just-sweet-potatoes-us-east-2
    path: s3://armory-demo-east-2/just-sweet-potatoes.zip
    type: zipFile
providerOptions:
  lambda:
    - name: just-sweet-potatoes-us-east-1
      target: prod-us-east-1
      runAsIamRole: "arn:aws:iam::111111111111:role/LambdaExecutionRole"
      handler: index.handler
      runtime: nodejs18.x
    - name: just-sweet-potatoes-us-east-2
      target: prod-us-east-2
      runAsIamRole: "arn:aws:iam::111111111111:role/LambdaExecutionRole"
      handler: index.handler
      runtime: nodejs18.x
trafficManagement:
  - targets: ['prod-us-east-1']
    alias:
      - functionName: just-sweet-potatoes-us-east-1
        aliasName: live-version
  - targets: ['prod-us-east-2']
    alias:
      - functionName: just-sweet-potatoes-us-east-2
        aliasName: live-version

Kubernetes

You configure your service mesh per target in this section.

SMI targets

trafficManagement.targets.smi

trafficManagement:
  - targets: ["<target>"]
    smi:
      - rootServiceName: "<rootServiceName>"
        canaryServiceName: "<rootServiceName>-canary"
        trafficSplitName: "<rootServiceName>"
    kubernetes:
      - activeService: "<activeServiceName>"
        previewService: "<previewServiceName>"
  • targets: Comma-delimited list of deployment targets; if omitted, CD-as-a-Service applies the traffic management configuration to all targets.

  • smi.rootServiceName: (Required if configuring an smi block) the name of a Kubernetes Service. Its service selector should target a Kubernetes Deployment resource in your deployment’s manifests. The SMI TrafficSplit spec defines a root service as the fully qualified domain name (FQDN) used by clients to communicate with your application. The Service should exist at the time of deployment.

  • smi.canaryServiceName: (Optional)(Canary) the name of a Kubernetes Service. Its service selector should target a Kubernetes Deployment resource in your deployment’s manifests.

    • If you provide a canaryServiceName, CD-as-a-Service assumes the Service already exists and uses it for deployment.
    • If you don’t provide a canaryServiceName, CD-as-a-Service creates a Service object and gives it the name of the root service with “-canary” appended to it. For example, if your root service is “myRootService”, then the canary service name would be “myRootService-canary”.
  • smi.trafficSplitName: (Optional) CD-as-a-Service uses the provided name when creating an SMI TrafficSplit.

  • kubernetes.activeService: (Required if configuring a kubernetes block)(Blue/Green) the name of a Kubernetes Service. Its service selector should target a Kubernetes Deployment resource in your deployment’s manifests. The Service should exist at the time of deployment.

  • kubernetes.previewService: (Optional)(Blue/Green) the name of a Kubernetes Service. Its service selector should target a Kubernetes Deployment resource in your deployment’s manifests. The Service should exist at the time of deployment.

Istio targets

trafficManagment.targets.istio

See Configure Traffic Management With Istio for a detailed example.

trafficManagement:
  - targets: ["<target-name>"]
    istio:
    - virtualService:
        name: <VirtualService-metadata-name>
        httpRouteName: <VirtualService-http-route-name>
      destinationRule:
        name: <DestinationRule-metadata-name>               
        activeSubsetName: <VirtualService-http-route-destination-subset-name>
        canarySubsetName: <canary-subset-name>     
  • targets: (Optional) comma-delimited list of deployment targets; if omitted, CD-as-a-Service applies the traffic management configuration to all targets.

  • istio.virtualService: (Required)

    • istio.virtualService.name: The name of your VirtualService
    • istio.virtualService.httpRouteName: The name of the HTTPRoute defined in your VirtualService. This field is optional if you define only one HTTPRoute.
  • istio.destinationRule: Optional if you only define only one DestinationRule.

    • istio.destinationRule.name: The name of your DestinationRule
    • istio.destinationRule.activeSubsetName: The name of the subset configured in your VirtualService HTTPRoute destination. This subset is running the current version of your app. activeSubsetName is optional if you define only one active subset.
    • istio.destinationRule.canarySubsetName: (Optional) The name of the canary subset defined in your DestinationRule.

Kubernetes targets

trafficManagement.targets.kubernetes

trafficManagement:
  - targets: ["<target1>", "<target2>"]
    kubernetes:
      - activeService: "<activeServiceName>"
        previewService: "<previewServiceName>"
  • targets: Comma-delimited list of deployment targets.

  • kubernetes.activeService: (Required if configuring a kubernetes block)(Blue/Green) the name of a Kubernetes Service. Its service selector should target a Kubernetes Deployment resource in your deployment’s manifests. The Service should exist at the time of deployment.

  • kubernetes.previewService: (Optional)(Blue/Green) the name of a Kubernetes Service. Its service selector should target a Kubernetes Deployment resource in your deployment’s manifests. The Service should exist at the time of deployment.


Last modified November 27, 2023: (803ecce)