-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from ferryproxy/test/cloud
Optimizing the handshake and test cloud
- Loading branch information
Showing
85 changed files
with
2,235 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: Test Cloud | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-ferrctl: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.18 | ||
|
||
- run: | | ||
go build -o ferryctl ./cmd/ferryctl | ||
- name: Upload ferryctl | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ferryctl | ||
path: ferryctl | ||
|
||
test-cloud: | ||
continue-on-error: true | ||
strategy: | ||
matrix: | ||
cloud: | ||
- aliyun | ||
- aws | ||
- azure | ||
- gcp | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build-ferrctl | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Download for ferryctl | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: ferryctl | ||
|
||
- name: Set up ferryctl | ||
run: | | ||
cp ferryctl /usr/local/bin/ferryctl && chmod +x /usr/local/bin/ferryctl | ||
- name: Set up eksctl | ||
if: matrix.cloud == 'aws' | ||
run: | | ||
wget -O eksctl.tar.gc "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_linux_amd64.tar.gz" | ||
tar -xzf eksctl.tar.gz -C /tmp/ && mv /tmp/eksctl /usr/local/bin/ && chmod +x /usr/local/bin/eksctl | ||
- name: Set up gcloud | ||
if: matrix.cloud == 'gcp' | ||
uses: google-github-actions/setup-gcloud@v0 | ||
with: | ||
install_components: 'gke-gcloud-auth-plugin' | ||
|
||
- name: Login ${{ matrix.cloud }} | ||
run: | | ||
./test/cloud/${{ matrix.cloud }}/login.sh | ||
./test/cloud/${{ matrix.cloud }}/list.sh | ||
env: | ||
ALIYUN_ACCESS_KEY_ID: ${{ secrets.ALIYUN_ACCESS_KEY_ID }} | ||
ALIYUN_ACCESS_KEY_SECRET: ${{ secrets.ALIYUN_ACCESS_KEY_SECRET }} | ||
ALIYUN_REGION_ID: ${{ secrets.ALIYUN_REGION_ID }} | ||
ALIYUN_ZONE_ID: ${{ secrets.ALIYUN_ZONE_ID }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_ACCESS_KEY_SECRET: ${{ secrets.AWS_ACCESS_KEY_SECRET }} | ||
AWS_REGION_ID: ${{ secrets.AWS_REGION_ID }} | ||
AWS_ZONE_ID: ${{ secrets.AWS_ZONE_ID }} | ||
AZURE_APP_ID: ${{ secrets.AZURE_APP_ID }} | ||
AZURE_PASSWORD: ${{ secrets.AZURE_PASSWORD }} | ||
AZURE_TENANT: ${{ secrets.AZURE_TENANT }} | ||
AZURE_REGION_ID: ${{ secrets.AZURE_REGION_ID }} | ||
AZURE_ZONE_ID: ${{ secrets.AZURE_ZONE_ID }} | ||
GCP_CRED_DATA: ${{ secrets.GCP_CRED_DATA }} | ||
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} | ||
GCP_REGION_ID: ${{ secrets.GCP_REGION_ID }} | ||
GCP_ZONE_ID: ${{ secrets.GCP_ZONE_ID }} | ||
- name: Start cluster | ||
run: | | ||
./test/hack/start-environment.sh cloud-${{ matrix.cloud }} | ||
- name: Test control-plane and cluster-${{ matrix.cloud }} | ||
run: ./test/test/test-in-both-easy.sh | ||
env: | ||
ROUTE_NAME: ferry-test | ||
CONTROL_PLANE: control-plane | ||
CLUSTER_1: cluster-${{ matrix.cloud }} | ||
CLUSTER_2: control-plane | ||
TARGET_1: web-${{ matrix.cloud }} | ||
TARGET_2: web-0 | ||
|
||
- name: Clean cluster | ||
run: | | ||
./test/hack/clean-environment.sh cloud-${{ matrix.cloud }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,6 @@ testbin/* | |
|
||
|
||
# Customs | ||
!/test/bin | ||
vendor | ||
kubeconfigs | ||
test/kubeconfigs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Cloud | ||
|
||
The following are the Kubernetes services for various public cloud platforms | ||
that Ferry has tested and validated. If there are multiple Kubernetes services | ||
on the same platform, we prefer to choose the one that does not require a management server. | ||
|
||
- Aliyun (Alibaba Cloud) | ||
[ ] ACK (Managed Kubernetes Cluster Service) | ||
[x] ASK (Serverless Kubernetes Cluster Service) | ||
- AWS (Amazon Web Services) | ||
[x] EKS (Elastic Kubernetes Engine) | ||
- GCP (Google Cloud Platform) | ||
[ ] GKE Standard (Google Kubernetes Engine Standard) | ||
[x] GKE Autopilot (Google Kubernetes Engine Autopilot) | ||
- Azure (Microsoft Azure) | ||
[x] AKS (Azure Kubernets Service) | ||
|
||
The following scripts are included in each platform's directory | ||
- login.sh `[This requires special handling, as each platform has a different login method]` | ||
- create.sh `<cluster-name>` | ||
- get_kubeconfig.sh` <cluster-name>` | ||
- list.sh | ||
- delete.sh `<cluster-name>` | ||
|
||
## Login | ||
|
||
### Aliyun | ||
ALIYUN_ACCESS_KEY_ID= | ||
ALIYUN_ACCESS_KEY_SECRET= | ||
ALIYUN_REGION_ID= | ||
ALIYUN_ZONE_ID= | ||
|
||
### AWS | ||
AWS_ACCESS_KEY_ID= | ||
AWS_ACCESS_KEY_SECRET= | ||
AWS_REGION_ID= | ||
|
||
### GCP | ||
GCP_PROJECT_ID= | ||
GCP_CRED_DATA= | ||
GCP_REGION_ID= | ||
|
||
### Azure | ||
AZURE_APP_ID= | ||
AZURE_PASSWORD= | ||
AZURE_TENANT= | ||
AZURE_REGION_ID= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Aliyun | ||
|
||
## Login | ||
|
||
https://www.alibabacloud.com/help/en/alibaba-cloud-cli/latest/overview#section-vfn-jja-bsk | ||
|
||
## Regions | ||
|
||
https://www.alibabacloud.com/help/en/elastic-container-instance/latest/regions-and-zones | ||
|
||
## aliyun tool | ||
|
||
Used to create and manage Kubernetes clusters. | ||
|
||
https://www.alibabacloud.com/help/en/resource-orchestration-service/latest/install-alibaba-cloud-cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2022 FerryProxy 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. | ||
|
||
CURRENT_DIR="$(dirname "${BASH_SOURCE[0]}")" | ||
|
||
CLUSTER_NAME=$1 | ||
|
||
REGION_ID=$2 | ||
|
||
ZONE_ID=$3 | ||
|
||
if [ "${REGION_ID}" == "" ] && [ "${ALIYUN_REGION_ID}" != "" ]; then | ||
REGION_ID="${ALIYUN_REGION_ID}" | ||
fi | ||
|
||
if [ "${REGION_ID}" == "" ]; then | ||
REGION_ID="cn-hongkong" | ||
fi | ||
|
||
if [ "${ZONE_ID}" == "" ] && [ "${ALIYUN_ZONE_ID}" != "" ]; then | ||
ZONE_ID="${ALIYUN_ZONE_ID}" | ||
fi | ||
|
||
if [ "${ZONE_ID}" == "" ]; then | ||
ZONE_ID="${REGION_ID}-b" | ||
fi | ||
|
||
if [ "${CLUSTER_NAME}" == "" ] || [ "${REGION_ID}" == "" ]; then | ||
echo "Usage: ${0} <cluster-name> <region-id>" | ||
exit 1 | ||
fi | ||
|
||
body=$( | ||
cat <<EOF | ||
{ | ||
"cluster_type": "ManagedKubernetes", | ||
"name": "${CLUSTER_NAME}", | ||
"kubernetes_version": "1.22.10-aliyun.1", | ||
"region_id": "${REGION_ID}", | ||
"endpoint_public_access": true, | ||
"service_discovery_types": [ | ||
"CoreDNS" | ||
], | ||
"tags": [], | ||
"deletion_protection": false, | ||
"service_cidr": "172.21.0.0/20", | ||
"timezone": "UTC", | ||
"addons": [], | ||
"profile": "Serverless", | ||
"snat_entry": true, | ||
"zoneid": "${ZONE_ID}", | ||
"cluster_spec": "ack.pro.small", | ||
"load_balancer_spec": "slb.s1.small" | ||
} | ||
EOF | ||
) | ||
|
||
aliyun cs CreateCluster \ | ||
--header "Content-Type=application/json" \ | ||
--body "${body}" | ||
|
||
while true; do | ||
state=$(aliyun cs DescribeClusters --name "${CLUSTER_NAME}" | | ||
jq -r '.[0].state') | ||
if [ "${state}" == "running" ]; then | ||
break | ||
fi | ||
echo "$(date) Waiting for cluster to be running... (state: ${state})" | ||
sleep 10 | ||
done | ||
|
||
echo "$(date) Cluster ${CLUSTER_NAME} is running!" |
Oops, something went wrong.