diff --git a/.github/workflows/e2e-dubbo.yaml b/.github/workflows/e2e-dubbo.yaml index a0618799a..c46fdde87 100644 --- a/.github/workflows/e2e-dubbo.yaml +++ b/.github/workflows/e2e-dubbo.yaml @@ -7,7 +7,7 @@ env: ISTIO_VERSION: 1.12.7 SCRIPTS_DIR: test/e2e/scripts COMMON_DIR: test/e2e/common - + AERAKI_IMG_PULL_POLICY: Never jobs: TestSidecarOutboundConfig: runs-on: ubuntu-latest diff --git a/.github/workflows/e2e-kafka-zookeeper.yaml b/.github/workflows/e2e-kafka-zookeeper.yaml index 0cb142003..995e6d4d6 100644 --- a/.github/workflows/e2e-kafka-zookeeper.yaml +++ b/.github/workflows/e2e-kafka-zookeeper.yaml @@ -7,7 +7,7 @@ env: ISTIO_VERSION: 1.12.7 SCRIPTS_DIR: test/e2e/scripts COMMON_DIR: test/e2e/common - + AERAKI_IMG_PULL_POLICY: Never jobs: test: runs-on: ubuntu-latest diff --git a/.github/workflows/e2e-metaprotocol.yaml b/.github/workflows/e2e-metaprotocol.yaml index 52f8e76f0..64c6f9106 100644 --- a/.github/workflows/e2e-metaprotocol.yaml +++ b/.github/workflows/e2e-metaprotocol.yaml @@ -7,8 +7,66 @@ env: ISTIO_VERSION: 1.12.7 SCRIPTS_DIR: test/e2e/scripts COMMON_DIR: test/e2e/common - + AERAKI_IMG_PULL_POLICY: Never jobs: + TestSidecarInboundConfig: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: true + name: TestSidecarInboundConfig + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Install dependencies + run: | + go version + go get golang.org/x/tools/cmd/goimports + - name: build docker + run: make docker-build-e2e + - name: Prepare envrionment + run: bash ${SCRIPTS_DIR}/pre.sh + - name: Install Minikube + run: bash ${SCRIPTS_DIR}/minikube.sh start + - name: Install Istio + run: bash ${SCRIPTS_DIR}/istio.sh -y -f ${COMMON_DIR}/istio-config.yaml + - name: Install aeraki + run: bash ${SCRIPTS_DIR}/aeraki.sh + - name: test + run: go test -v github.com/aeraki-mesh/aeraki/test/e2e/metaprotocol/ -run TestSidecarInboundConfig + TestSidecarOutboundConfig: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: true + name: TestSidecarOutboundConfig + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Install dependencies + run: | + go version + go get golang.org/x/tools/cmd/goimports + - name: build docker + run: make docker-build-e2e + - name: Prepare envrionment + run: bash ${SCRIPTS_DIR}/pre.sh + - name: Install Minikube + run: bash ${SCRIPTS_DIR}/minikube.sh start + - name: Install Istio + run: bash ${SCRIPTS_DIR}/istio.sh -y -f ${COMMON_DIR}/istio-config.yaml + - name: Install aeraki + run: bash ${SCRIPTS_DIR}/aeraki.sh + - name: test + run: go test -v github.com/aeraki-mesh/aeraki/test/e2e/metaprotocol/ -run TestSidecarOutboundConfig TestVersionRouting: runs-on: ubuntu-latest timeout-minutes: 60 @@ -38,3 +96,61 @@ jobs: run: bash ${SCRIPTS_DIR}/aeraki.sh - name: test run: go test -v github.com/aeraki-mesh/aeraki/test/e2e/metaprotocol/ -run TestVersionRouting + TestAttributeRouting: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: true + name: TestAttributeRouting + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Install dependencies + run: | + go version + go get golang.org/x/tools/cmd/goimports + - name: build docker + run: make docker-build-e2e + - name: Prepare envrionment + run: bash ${SCRIPTS_DIR}/pre.sh + - name: Install Minikube + run: bash ${SCRIPTS_DIR}/minikube.sh start + - name: Install Istio + run: bash ${SCRIPTS_DIR}/istio.sh -y -f ${COMMON_DIR}/istio-config.yaml + - name: Install aeraki + run: bash ${SCRIPTS_DIR}/aeraki.sh + - name: test + run: go test -v github.com/aeraki-mesh/aeraki/test/e2e/metaprotocol/ -run TestAttributeRouting + TestPercentageRouting: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: true + name: TestPercentageRouting + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Install dependencies + run: | + go version + go get golang.org/x/tools/cmd/goimports + - name: build docker + run: make docker-build-e2e + - name: Prepare envrionment + run: bash ${SCRIPTS_DIR}/pre.sh + - name: Install Minikube + run: bash ${SCRIPTS_DIR}/minikube.sh start + - name: Install Istio + run: bash ${SCRIPTS_DIR}/istio.sh -y -f ${COMMON_DIR}/istio-config.yaml + - name: Install aeraki + run: bash ${SCRIPTS_DIR}/aeraki.sh + - name: test + run: go test -v github.com/aeraki-mesh/aeraki/test/e2e/metaprotocol/ -run TestPercentageRouting diff --git a/.github/workflows/e2e-redis.yaml b/.github/workflows/e2e-redis.yaml index dbfe4ed04..f2f1202d4 100644 --- a/.github/workflows/e2e-redis.yaml +++ b/.github/workflows/e2e-redis.yaml @@ -7,7 +7,7 @@ env: ISTIO_VERSION: 1.12.7 SCRIPTS_DIR: test/e2e/scripts COMMON_DIR: test/e2e/common - + AERAKI_IMG_PULL_POLICY: Never jobs: test: runs-on: ubuntu-latest diff --git a/.github/workflows/e2e-thrift.yaml b/.github/workflows/e2e-thrift.yaml index f4dbbc73f..34fc25e02 100644 --- a/.github/workflows/e2e-thrift.yaml +++ b/.github/workflows/e2e-thrift.yaml @@ -7,7 +7,7 @@ env: ISTIO_VERSION: 1.12.7 SCRIPTS_DIR: test/e2e/scripts COMMON_DIR: test/e2e/common - + AERAKI_IMG_PULL_POLICY: Never jobs: test: runs-on: ubuntu-latest diff --git a/api/metaprotocol/v1alpha1/metaprotocol.aeraki.io.v1alpha1.pb.html b/api/metaprotocol/v1alpha1/metaprotocol.aeraki.io.v1alpha1.pb.html index 3059758bb..6b44487e2 100644 --- a/api/metaprotocol/v1alpha1/metaprotocol.aeraki.io.v1alpha1.pb.html +++ b/api/metaprotocol/v1alpha1/metaprotocol.aeraki.io.v1alpha1.pb.html @@ -76,7 +76,9 @@

MetaRouter

The destination service to which traffic is being sent. Note for Kubernetes users: It must be a fully qualified domain name (FQDN), (e.g. “thrift-sample-server.meta-thrift.svc.cluster.local” ) -instead of a short name (e.g. “thrift-sample-server”).

+instead of a short name (e.g. “thrift-sample-server”). +Note: Only one host is supported now. If multiple hosts are specified, +Only the first one takes effect.

@@ -132,7 +134,7 @@

MetaRouter

by default.

The value “.” is reserved and defines an export to the same namespace that -the virtual service is declared in. Similarly the value “*” is reserved and +the MetaRouter is declared in. Similarly the value “*” is reserved and defines an export to all namespaces.

diff --git a/api/metaprotocol/v1alpha1/metaprotocol_application_protocol.pb.go b/api/metaprotocol/v1alpha1/metaprotocol_application_protocol.pb.go index 4e6351c6f..ea3a080bc 100644 --- a/api/metaprotocol/v1alpha1/metaprotocol_application_protocol.pb.go +++ b/api/metaprotocol/v1alpha1/metaprotocol_application_protocol.pb.go @@ -48,7 +48,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // +cue-gen:ApplicationProtocol:annotations:helm.sh/resource-policy=keep // +cue-gen:ApplicationProtocol:labels:app=aeraki,chart=aeraki,heritage=Tiller,release=aeraki // +cue-gen:ApplicationProtocol:subresource:status -// +cue-gen:ApplicationProtocol:scope:Namespaced +// +cue-gen:ApplicationProtocol:scope:Cluster // +cue-gen:ApplicationProtocol:resource:categories=aeraki-io,metaprotocol-aeraki-io // +cue-gen:ApplicationProtocol:preserveUnknownFields:false // --> diff --git a/api/metaprotocol/v1alpha1/metaprotocol_application_protocol.proto b/api/metaprotocol/v1alpha1/metaprotocol_application_protocol.proto index 155386788..146cd8a46 100644 --- a/api/metaprotocol/v1alpha1/metaprotocol_application_protocol.proto +++ b/api/metaprotocol/v1alpha1/metaprotocol_application_protocol.proto @@ -44,7 +44,7 @@ option go_package = "github.com/aeraki-mesh/aeraki/api/metaprotocol/v1alpha1"; // +cue-gen:ApplicationProtocol:annotations:helm.sh/resource-policy=keep // +cue-gen:ApplicationProtocol:labels:app=aeraki,chart=aeraki,heritage=Tiller,release=aeraki // +cue-gen:ApplicationProtocol:subresource:status -// +cue-gen:ApplicationProtocol:scope:Namespaced +// +cue-gen:ApplicationProtocol:scope:Cluster // +cue-gen:ApplicationProtocol:resource:categories=aeraki-io,metaprotocol-aeraki-io // +cue-gen:ApplicationProtocol:preserveUnknownFields:false // --> diff --git a/api/metaprotocol/v1alpha1/metaprotocol_metarouter.pb.go b/api/metaprotocol/v1alpha1/metaprotocol_metarouter.pb.go index 55efb9452..3efc936cb 100644 --- a/api/metaprotocol/v1alpha1/metaprotocol_metarouter.pb.go +++ b/api/metaprotocol/v1alpha1/metaprotocol_metarouter.pb.go @@ -6,6 +6,12 @@ // $description: MetaRouter defines route policies for MetaProtocol proxy. // // MetaRouter defines route policies for MetaProtocol proxy. +// *Note*: Only one MetaRouter should be defined for a MetaProtocol service. +// If more than one MetaRouters are found for a service, Aeraki will choose +// a random one to apply to that service. +// +// *Note *: MetaRouter is a mesh-scoped resource, so no matter which namespace +// the MetaRouter is in, it will take effect on the services specified in the hosts. // // ```yaml // apiVersion: metaprotocol.aeraki.io/v1alpha1 @@ -100,6 +106,8 @@ type MetaRouter struct { // *Note for Kubernetes users*: It must be a fully qualified domain name // (FQDN), (e.g. "thrift-sample-server.meta-thrift.svc.cluster.local" ) // instead of a short name (e.g. "thrift-sample-server"). + // *Note*: Only one host is supported now. If multiple hosts are specified, + // Only the first one takes effect. Hosts []string `protobuf:"bytes,1,rep,name=hosts,proto3" json:"hosts,omitempty"` // An ordered list of route rules for MetaProtocol traffic. The route rules // will be applied to service ports named "tcp-metaprotocol-${applicationProtocol}-*", @@ -119,7 +127,7 @@ type MetaRouter struct { // by default. // // The value "." is reserved and defines an export to the same namespace that - // the virtual service is declared in. Similarly the value "*" is reserved and + // the MetaRouter is declared in. Similarly the value "*" is reserved and // defines an export to all namespaces. ExportTo []string `protobuf:"bytes,20,rep,name=export_to,json=exportTo,proto3" json:"export_to,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` diff --git a/api/metaprotocol/v1alpha1/metaprotocol_metarouter_deepcopy.gen.go b/api/metaprotocol/v1alpha1/metaprotocol_metarouter_deepcopy.gen.go index d15746c52..b32c4ffe2 100644 --- a/api/metaprotocol/v1alpha1/metaprotocol_metarouter_deepcopy.gen.go +++ b/api/metaprotocol/v1alpha1/metaprotocol_metarouter_deepcopy.gen.go @@ -6,6 +6,12 @@ // $description: MetaRouter defines route policies for MetaProtocol proxy. // // MetaRouter defines route policies for MetaProtocol proxy. +// *Note*: Only one MetaRouter should be defined for a MetaProtocol service. +// If more than one MetaRouters are found for a service, Aeraki will choose +// a random one to apply to that service. +// +// *Note *: MetaRouter is a mesh-scoped resource, so no matter which namespace +// the MetaRouter is in, it will take effect on the services specified in the hosts. // // ```yaml // apiVersion: metaprotocol.aeraki.io/v1alpha1 diff --git a/api/metaprotocol/v1alpha1/metaprotocol_metarouter_json.gen.go b/api/metaprotocol/v1alpha1/metaprotocol_metarouter_json.gen.go index ea991cebc..2ee17f845 100644 --- a/api/metaprotocol/v1alpha1/metaprotocol_metarouter_json.gen.go +++ b/api/metaprotocol/v1alpha1/metaprotocol_metarouter_json.gen.go @@ -6,6 +6,12 @@ // $description: MetaRouter defines route policies for MetaProtocol proxy. // // MetaRouter defines route policies for MetaProtocol proxy. +// *Note*: Only one MetaRouter should be defined for a MetaProtocol service. +// If more than one MetaRouters are found for a service, Aeraki will choose +// a random one to apply to that service. +// +// *Note *: MetaRouter is a mesh-scoped resource, so no matter which namespace +// the MetaRouter is in, it will take effect on the services specified in the hosts. // // ```yaml // apiVersion: metaprotocol.aeraki.io/v1alpha1 diff --git a/client-go/pkg/apis/metaprotocol/v1alpha1/types.gen.go b/client-go/pkg/apis/metaprotocol/v1alpha1/types.gen.go index 2eb7ff42d..1377f64f3 100644 --- a/client-go/pkg/apis/metaprotocol/v1alpha1/types.gen.go +++ b/client-go/pkg/apis/metaprotocol/v1alpha1/types.gen.go @@ -36,7 +36,7 @@ import ( // +cue-gen:ApplicationProtocol:annotations:helm.sh/resource-policy=keep // +cue-gen:ApplicationProtocol:labels:app=aeraki,chart=aeraki,heritage=Tiller,release=aeraki // +cue-gen:ApplicationProtocol:subresource:status -// +cue-gen:ApplicationProtocol:scope:Namespaced +// +cue-gen:ApplicationProtocol:scope:Cluster // +cue-gen:ApplicationProtocol:resource:categories=aeraki-io,metaprotocol-aeraki-io // +cue-gen:ApplicationProtocol:preserveUnknownFields:false // --> diff --git a/crd/kubernetes/customresourcedefinitions.gen.yaml b/crd/kubernetes/customresourcedefinitions.gen.yaml index 986819164..f91225abc 100644 --- a/crd/kubernetes/customresourcedefinitions.gen.yaml +++ b/crd/kubernetes/customresourcedefinitions.gen.yaml @@ -144,7 +144,7 @@ spec: listKind: ApplicationProtocolList plural: applicationprotocols singular: applicationprotocol - scope: Namespaced + scope: Cluster versions: - name: v1alpha1 schema: diff --git a/demo/install-aeraki.sh b/demo/install-aeraki.sh index 47d4b22f3..d7b12f883 100755 --- a/demo/install-aeraki.sh +++ b/demo/install-aeraki.sh @@ -25,4 +25,10 @@ else export AERAKI_TAG=$AERAKI_TAG fi +if [ -z "$AERAKI_IMG_PULL_POLICY" ]; then + export $AERAKI_IMG_PULL_POLICY=Always +else + export AERAKI_IMG_PULL_POLICY=$AERAKI_IMG_PULL_POLICY +fi + bash ${SCRIPTS_DIR}/aeraki.sh $1 diff --git a/demo/install-demo.sh b/demo/install-demo.sh index c4f1f8b02..ef2b0ac2c 100755 --- a/demo/install-demo.sh +++ b/demo/install-demo.sh @@ -21,7 +21,7 @@ DEMO=$1 SCRIPTS_DIR=$BASEDIR/test/e2e/scripts COMMON_DIR=$BASEDIR/test/e2e/common export ISTIO_VERSION=1.12.7 -export AERAKI_TAG=latest +export AERAKI_TAG=1.1.0 bash ${SCRIPTS_DIR}/istio.sh -y -f ${COMMON_DIR}/istio-config.yaml bash ${SCRIPTS_DIR}/aeraki.sh diff --git a/demo/metaprotocol-brpc/brpc-protocol.yaml b/demo/metaprotocol-brpc/brpc-protocol.yaml index 8a5fe2e17..0e9a0dc2d 100644 --- a/demo/metaprotocol-brpc/brpc-protocol.yaml +++ b/demo/metaprotocol-brpc/brpc-protocol.yaml @@ -17,7 +17,6 @@ apiVersion: metaprotocol.aeraki.io/v1alpha1 kind: ApplicationProtocol metadata: name: brpc - namespace: istio-system spec: codec: aeraki.meta_protocol.codec.brpc protocol: brpc diff --git a/demo/metaprotocol-qza/qza-protocol.yaml b/demo/metaprotocol-qza/qza-protocol.yaml index 9dd5fd9fd..88c2b4516 100644 --- a/demo/metaprotocol-qza/qza-protocol.yaml +++ b/demo/metaprotocol-qza/qza-protocol.yaml @@ -17,7 +17,6 @@ apiVersion: metaprotocol.aeraki.io/v1alpha1 kind: ApplicationProtocol metadata: name: qza - namespace: istio-system spec: codec: aeraki.meta_protocol.codec.qza protocol: qza diff --git a/demo/metaprotocol-trpc/trpc-protocol.yaml b/demo/metaprotocol-trpc/trpc-protocol.yaml index 6db8d487f..3888d9d13 100644 --- a/demo/metaprotocol-trpc/trpc-protocol.yaml +++ b/demo/metaprotocol-trpc/trpc-protocol.yaml @@ -17,7 +17,6 @@ apiVersion: metaprotocol.aeraki.io/v1alpha1 kind: ApplicationProtocol metadata: name: trpc - namespace: istio-system spec: codec: aeraki.meta_protocol.codec.trpc protocol: trpc diff --git a/demo/metaprotocol-videopacket/videopacket-protocol.yaml b/demo/metaprotocol-videopacket/videopacket-protocol.yaml index 1c9e5c6ec..009c6db73 100644 --- a/demo/metaprotocol-videopacket/videopacket-protocol.yaml +++ b/demo/metaprotocol-videopacket/videopacket-protocol.yaml @@ -17,7 +17,6 @@ apiVersion: metaprotocol.aeraki.io/v1alpha1 kind: ApplicationProtocol metadata: name: videopacket - namespace: istio-system spec: codec: aeraki.meta_protocol.codec.videopacket protocol: videopacket diff --git a/k8s/aeraki.yaml b/k8s/aeraki.yaml index da103b9b4..108326916 100644 --- a/k8s/aeraki.yaml +++ b/k8s/aeraki.yaml @@ -36,6 +36,8 @@ spec: containers: - name: aeraki image: aeraki/aeraki:${AERAKI_TAG} + # imagePullPolicy should be set to Never so Minikube can use local image for e2e testing + imagePullPolicy: ${AERAKI_IMG_PULL_POLICY} env: - name: AERAKI_IS_MASTER value: "${AERAKI_IS_MASTER}" @@ -201,7 +203,6 @@ apiVersion: metaprotocol.aeraki.io/v1alpha1 kind: ApplicationProtocol metadata: name: dubbo - namespace: istio-system spec: protocol: dubbo codec: aeraki.meta_protocol.codec.dubbo @@ -210,7 +211,6 @@ apiVersion: metaprotocol.aeraki.io/v1alpha1 kind: ApplicationProtocol metadata: name: thrift - namespace: istio-system spec: protocol: thrift codec: aeraki.meta_protocol.codec.thrift diff --git a/k8s/crd.yaml b/k8s/crd.yaml index 986819164..f91225abc 100644 --- a/k8s/crd.yaml +++ b/k8s/crd.yaml @@ -144,7 +144,7 @@ spec: listKind: ApplicationProtocolList plural: applicationprotocols singular: applicationprotocol - scope: Namespaced + scope: Cluster versions: - name: v1alpha1 schema: diff --git a/manifests/charts/aeraki/templates/applicationprotocol.yaml b/manifests/charts/aeraki/templates/applicationprotocol.yaml index b9ec16b63..8a01d728f 100644 --- a/manifests/charts/aeraki/templates/applicationprotocol.yaml +++ b/manifests/charts/aeraki/templates/applicationprotocol.yaml @@ -17,7 +17,6 @@ apiVersion: metaprotocol.aeraki.io/v1alpha1 kind: ApplicationProtocol metadata: name: dubbo - namespace: istio-system spec: protocol: dubbo codec: aeraki.meta_protocol.codec.dubbo @@ -26,7 +25,6 @@ apiVersion: metaprotocol.aeraki.io/v1alpha1 kind: ApplicationProtocol metadata: name: thrift - namespace: istio-system spec: protocol: thrift codec: aeraki.meta_protocol.codec.thrift diff --git a/test/e2e/metaprotocol/metaprotocol_test.go b/test/e2e/metaprotocol/metaprotocol_test.go index 58fd7219a..8fa892987 100644 --- a/test/e2e/metaprotocol/metaprotocol_test.go +++ b/test/e2e/metaprotocol/metaprotocol_test.go @@ -21,7 +21,7 @@ import ( "time" "github.com/aeraki-mesh/aeraki/test/e2e/util" - "istio.io/pkg/log" + "istio.io/pkg/log" ) func TestMain(m *testing.M) { @@ -53,7 +53,7 @@ func TestSidecarOutboundConfig(t *testing.T) { consumerPod, _ := util.GetPodName("metaprotocol", "app=dubbo-sample-consumer", "") config, _ := util.PodExec("metaprotocol", consumerPod, "istio-proxy", "curl -s 127.0.0.1:15000/config_dump", false, "") config = strings.Join(strings.Fields(config), "") - want := "{\n\"name\":\"envoy.filters.network.meta_protocol_proxy\",\n\"typed_config\":{\n\"@type\":\"type.googleapis.com/udpa.type.v1.TypedStruct\",\n\"type_url\":\"type.googleapis.com/aeraki.meta_protocol_proxy.v1alpha.MetaProtocolProxy\",\n\"value\":{\n\"stat_prefix\":\"outbound|20880||org.apache.dubbo.samples.basic.api.demoservice\",\n\"application_protocol\":\"dubbo\",\n\"rds\":{\n\"config_source\":{\n\"api_config_source\":{\n\"api_type\":\"GRPC\",\n\"grpc_services\":[\n{\n\"envoy_grpc\":{\n\"cluster_name\":\"aeraki-xds\"\n}\n}\n],\n\"transport_api_version\":\"V3\"\n},\n\"resource_api_version\":\"V3\"\n},\n\"route_config_name\":\"org.apache.dubbo.samples.basic.api.demoservice_20880\"\n},\n\"codec\":{\n\"name\":\"aeraki.meta_protocol.codec.dubbo\"\n}\n}\n}" + want := "{\n\"name\":\"envoy.filters.network.meta_protocol_proxy\",\n\"typed_config\":{\n\"@type\":\"type.googleapis.com/udpa.type.v1.TypedStruct\",\n\"type_url\":\"type.googleapis.com/aeraki.meta_protocol_proxy.v1alpha.MetaProtocolProxy\",\n\"value\":{\n\"stat_prefix\":\"outbound|20880||org.apache.dubbo.samples.basic.api.demoservice\",\n\"application_protocol\":\"dubbo\",\n\"rds\":{\n\"config_source\":{\n\"api_config_source\":{\n\"api_type\":\"GRPC\",\n\"grpc_services\":[\n{\n\"envoy_grpc\":{\n\"cluster_name\":\"aeraki-xds\"\n}\n}\n],\n\"transport_api_version\":\"V3\"\n},\n\"resource_api_version\":\"V3\"\n},\n\"route_config_name\":\"org.apache.dubbo.samples.basic.api.demoservice_20880\"\n},\n\"codec\":{\n\"name\":\"aeraki.meta_protocol.codec.dubbo\"\n},\n\"meta_protocol_filters\":[\n{\n\"name\":\"aeraki.meta_protocol.filters.router\"\n}\n]\n}\n}\n}" want = strings.Join(strings.Fields(want), "") if !strings.Contains(config, want) { t.Errorf("cant't find metaprotocol proxy in the outbound listener of the envoy sidecar: conf \n %s, want \n %s", config, want) @@ -66,7 +66,7 @@ func TestSidecarInboundConfig(t *testing.T) { providerPod, _ := util.GetPodName("metaprotocol", "app=dubbo-sample-provider", "") config, _ := util.PodExec("metaprotocol", providerPod, "istio-proxy", "curl -s 127.0.0.1:15000/config_dump", false, "") config = strings.Join(strings.Fields(config), "") - want := "{\n\"name\":\"envoy.filters.network.meta_protocol_proxy\",\n\"typed_config\":{\n\"@type\":\"type.googleapis.com/udpa.type.v1.TypedStruct\",\n\"type_url\":\"type.googleapis.com/aeraki.meta_protocol_proxy.v1alpha.MetaProtocolProxy\",\n\"value\":{\n\"stat_prefix\":\"inbound|20880||\",\n\"application_protocol\":\"dubbo\",\n\"route_config\":{\n\"name\":\"inbound|20880||\",\n\"routes\":[\n{\n\"route\":{\n\"cluster\":\"inbound|20880||\"\n}\n}\n]\n},\n\"codec\":{\n\"name\":\"aeraki.meta_protocol.codec.dubbo\"\n}\n}\n}\n" + want := "{\n\"name\":\"envoy.filters.network.meta_protocol_proxy\",\n\"typed_config\":{\n\"@type\":\"type.googleapis.com/udpa.type.v1.TypedStruct\",\n\"type_url\":\"type.googleapis.com/aeraki.meta_protocol_proxy.v1alpha.MetaProtocolProxy\",\n\"value\":{\n\"stat_prefix\":\"inbound|20880||\",\n\"application_protocol\":\"dubbo\",\n\"route_config\":{\n\"name\":\"inbound|20880||\",\n\"routes\":[\n{\n\"route\":{\n\"cluster\":\"inbound|20880||\"\n}\n}\n]\n},\n\"codec\":{\n\"name\":\"aeraki.meta_protocol.codec.dubbo\"\n},\n\"meta_protocol_filters\":[\n{\n\"name\":\"aeraki.meta_protocol.filters.router\"\n}\n]\n}\n}\n}" want = strings.Join(strings.Fields(want), "") if !strings.Contains(config, want) { t.Errorf("cant't find metaprotocol proxy in the inbound listener of the envoy sidecar: conf \n %s, want \n %s", config, want) diff --git a/test/e2e/metaprotocol/testdata/metarouter-attribute-splitting.yaml b/test/e2e/metaprotocol/testdata/metarouter-traffic-splitting.yaml similarity index 100% rename from test/e2e/metaprotocol/testdata/metarouter-attribute-splitting.yaml rename to test/e2e/metaprotocol/testdata/metarouter-traffic-splitting.yaml diff --git a/test/e2e/scripts/aeraki.sh b/test/e2e/scripts/aeraki.sh index 3e49f8ee3..463355753 100644 --- a/test/e2e/scripts/aeraki.sh +++ b/test/e2e/scripts/aeraki.sh @@ -1,5 +1,19 @@ #!/bin/bash +# Copyright Aeraki Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -e BASEDIR=$(dirname "$0") @@ -46,6 +60,8 @@ envsubst < $BASEDIR/../../../k8s/aeraki.yaml > ~/.aeraki/aeraki.yaml if [ "$1" == "mode=tcm" ]; then kubectl apply -f $BASEDIR/../../../k8s/tcm-apiservice.yaml else + # ApplicationProtocol is changed from namespace scope to cluster scope + kubectl delete crd applicationprotocols.metaprotocol.aeraki.io || true kubectl apply -f $BASEDIR/../../../k8s/crd.yaml fi kubectl apply -f ~/.aeraki/aeraki.yaml -n ${AERAKI_NAMESPACE}