Skip to content

Commit

Permalink
change ApplicationProtocol CRD to cluster scope (#230)
Browse files Browse the repository at this point in the history
* change ApplicationProtocol CRD to cluster scope

Signed-off-by: Sad-polar-bear <[email protected]>

* fix script issue

Signed-off-by: Sad-polar-bear <[email protected]>

* fix e2e test

Signed-off-by: Sad-polar-bear <[email protected]>

* fix e2e test

Signed-off-by: Sad-polar-bear <[email protected]>

* fix e2e test

Signed-off-by: Sad-polar-bear <[email protected]>

* fix e2e test

Signed-off-by: Sad-polar-bear <[email protected]>
  • Loading branch information
Sad-polar-bear authored May 24, 2022
1 parent 0330c7c commit 0f15f0c
Show file tree
Hide file tree
Showing 25 changed files with 179 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-dubbo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-kafka-zookeeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
118 changes: 117 additions & 1 deletion .github/workflows/e2e-metaprotocol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/e2e-redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-thrift.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ <h2 id="MetaRouter">MetaRouter</h2>
<p>The destination service to which traffic is being sent.
<em>Note for Kubernetes users</em>: It must be a fully qualified domain name
(FQDN), (e.g. &ldquo;thrift-sample-server.meta-thrift.svc.cluster.local&rdquo; )
instead of a short name (e.g. &ldquo;thrift-sample-server&rdquo;).</p>
instead of a short name (e.g. &ldquo;thrift-sample-server&rdquo;).
<em>Note</em>: Only one host is supported now. If multiple hosts are specified,
Only the first one takes effect.</p>

</td>
<td>
Expand Down Expand Up @@ -132,7 +134,7 @@ <h2 id="MetaRouter">MetaRouter</h2>
by default.</p>

<p>The value &ldquo;.&rdquo; is reserved and defines an export to the same namespace that
the virtual service is declared in. Similarly the value &ldquo;*&rdquo; is reserved and
the MetaRouter is declared in. Similarly the value &ldquo;*&rdquo; is reserved and
defines an export to all namespaces.</p>

</td>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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
// -->
Expand Down
10 changes: 9 additions & 1 deletion api/metaprotocol/v1alpha1/metaprotocol_metarouter.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions api/metaprotocol/v1alpha1/metaprotocol_metarouter_json.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client-go/pkg/apis/metaprotocol/v1alpha1/types.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crd/kubernetes/customresourcedefinitions.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ spec:
listKind: ApplicationProtocolList
plural: applicationprotocols
singular: applicationprotocol
scope: Namespaced
scope: Cluster
versions:
- name: v1alpha1
schema:
Expand Down
6 changes: 6 additions & 0 deletions demo/install-aeraki.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion demo/install-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion demo/metaprotocol-brpc/brpc-protocol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion demo/metaprotocol-qza/qza-protocol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion demo/metaprotocol-trpc/trpc-protocol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion demo/metaprotocol-videopacket/videopacket-protocol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions k8s/aeraki.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion k8s/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ spec:
listKind: ApplicationProtocolList
plural: applicationprotocols
singular: applicationprotocol
scope: Namespaced
scope: Cluster
versions:
- name: v1alpha1
schema:
Expand Down
2 changes: 0 additions & 2 deletions manifests/charts/aeraki/templates/applicationprotocol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Loading

0 comments on commit 0f15f0c

Please sign in to comment.