radius-project / radius

Radius is a cloud-native, portable application platform that makes app development easier for teams building cloud-native apps.
https://radapp.io
Apache License 2.0
1.49k stars 96 forks source link

Traffic Splitting #6360

Open jkotalik opened 2 years ago

jkotalik commented 2 years ago

Overview

Traffic splitting is the ability to distribute traffic across two or more versions of an application. For example, I have container v1 and container v2 running inside of my application, and I want to evenly distribute traffic between the two containers.

Traffic splitting enables many interesting scenarios that will be required as Radius matures:

And can lead to eventual patterns for:

Current State

Currently today, if I have two containers that I want to equally split traffic to, whether the route be internal or external, there is no way to do that.

resource containerv1 'Applications.Core/Container@v1' = {
  name: 'containerv1'
  properties: {
    container: {
      image: 'myimage:v1'
      ports: {
        web: {
          containerPort: 80
          provides: sharedroute.id
        }
      }
    }
  }
}

resource containerv2 'Applications.Core/Container@v1' = {
  name: 'containerv2'
  properties: {
    container: {
      image: 'myimage:v2'
      ports: {
        web: {
          containerPort: 80
          provides: sharedroute.id
        }
      }
    }
  }
}

resource sharedroute 'Applications.Core/HttpRoute@v1' = {
  name: 'route'
}

In this example, I stated that the sharedroute is provided by both containerv1 and v2, I want traffic to be split between them in some manner. By default, this should split traffic with some default routing rule.

Work items

Infrastructure changes

For enabling traffic splitting, we should look into using Open Service Mesh (OSM). Open Service Mesh is a service mesh that is built on Envoy. It natively has the ability to support traffic splitting: https://release-v1-0.docs.openservicemesh.io/docs/guides/traffic_management/traffic_split/. OSM has the ability to do many other app model changes

Doc on the design of traffic splitting in OSM: https://github.com/servicemeshinterface/smi-spec/blob/v0.6.0/apis/traffic-split/v1alpha2/traffic-split.md

App model

See https://github.com/project-radius/app-model/issues/16 for the app model design.

For some of this app model work, we may need to support both the old way of doing type generation as well as the new for bicep types as the appcore RP isn't quite up and running yet.

Control plane changes

We will then need to make the changes necessary to generate the right CRDs s.t. OSM can use them.

Documentation and Samples

AB#6870

emily-potyraj commented 2 years ago

@ruokun-niu and @jkotalik, we're shipping this feature with v0.13, right? shall we move it out of the v0.12 iteration?