-
Notifications
You must be signed in to change notification settings - Fork 8
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 #209 from networkservicemesh/update/networkservice…
…mesh/integration-k8s-kind Update from update/networkservicemesh/integration-k8s-kind
- Loading branch information
Showing
11 changed files
with
100 additions
and
203 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -21,11 +21,15 @@ jobs: | |
checkgomod: | ||
uses: networkservicemesh/.github/.github/workflows/checkgomod.yaml@main | ||
|
||
cloudtest: | ||
interdomain: | ||
runs-on: ubuntu-latest | ||
env: | ||
KUBERNETES_VERSION: ${{ secrets.NSM_KUBERNETES_VERSION }} | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
- name: Checkout files | ||
uses: actions/checkout@v2 | ||
with: | ||
|
@@ -55,63 +59,108 @@ jobs: | |
echo GOPATH=$GITHUB_WORKSPACE >> $GITHUB_ENV | ||
echo GO111MODULE=on >> $GITHUB_ENV | ||
echo $GITHUB_WORKSPACE/bin >> $GITHUB_PATH | ||
- name: Get cloudtest | ||
run: go get github.com/networkservicemesh/cloudtest@master | ||
- name: Get kind | ||
run: go get sigs.k8s.io/[email protected] | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
with: | ||
path: ${{ github.workspace }}/src/github.com/${{ github.repository }} | ||
|
||
- name: Setup gke | ||
run: | | ||
scripts/gke/gke-start.sh | ||
env: | ||
GCLOUD_SERVICE_KEY: ${{ secrets.GCLOUD_SERVICE_KEY }} | ||
GCLOUD_PROJECT_ID: ${{ secrets.GOOGLE_PROJECT_ID }} | ||
GKE_PROJECT_ID: ${{ secrets.GOOGLE_PROJECT_ID }} | ||
GKE_CLUSTER_NAME: gke-${{ github.run_id }}-${{ github.run_number }} | ||
GKE_CLUSTER_ZONE: us-central1-a | ||
GKE_CLUSTER_TYPE: n1-standard-2 | ||
GKE_CLUSTER_NUM_NODES: 1 | ||
KUBECONFIG: /tmp/config1 | ||
USE_GKE_GCLOUD_AUTH_PLUGIN: true | ||
working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }} | ||
|
||
- name: Setup aws | ||
run: | | ||
scripts/aws/aws-start.sh | ||
env: | ||
KUBECONFIG: /tmp/config2 | ||
AWS_REGION: us-east-2 | ||
AWS_CLUSTER_NAME: aws-${{ github.run_id }}-${{ github.run_number }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }} | ||
|
||
- name: Setup aks | ||
run: | | ||
az login --service-principal --username ${AZURE_SERVICE_PRINCIPAL} --password ${AZURE_SERVICE_PRINCIPAL_SECRET} --tenant ${AZURE_TENANT} | ||
scripts/aks/aks-start.sh ${AZURE_RESOURCE_GROUP} ${AZURE_CLUSTER_NAME} ${AZURE_CREDENTIALS_PATH} ${KUBECONFIG} | ||
env: | ||
KUBECONFIG: /tmp/config3 | ||
AZURE_RESOURCE_GROUP: nsm-ci | ||
AZURE_CLUSTER_NAME: aks-${{ github.run_id }}-${{ github.run_number }} | ||
AZURE_SERVICE_PRINCIPAL: ${{ secrets.AZURE_SERVICE_PRINCIPAL }} | ||
AZURE_SERVICE_PRINCIPAL_SECRET: ${{ secrets.AZURE_SERVICE_PRINCIPAL_SECRET }} | ||
AZURE_TENANT: ${{ secrets.AZURE_TENANT }} | ||
working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }} | ||
|
||
- name: Run interdomain testing | ||
run: | | ||
cloudtest | ||
go test -count 1 -timeout 2h -race -v ./... | ||
env: | ||
KUBECONFIG1: /tmp/config1 | ||
KUBECONFIG2: /tmp/config2 | ||
KUBECONFIG3: /tmp/config3 | ||
AZURE_SERVICE_PRINCIPAL: ${{ secrets.AZURE_SERVICE_PRINCIPAL }} | ||
AZURE_SERVICE_PRINCIPAL_SECRET: ${{ secrets.AZURE_SERVICE_PRINCIPAL_SECRET }} | ||
AZURE_TENANT: ${{ secrets.AZURE_TENANT }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_REGION: "us-west-2" | ||
USE_GKE_GCLOUD_AUTH_PLUGIN: true | ||
PACKET_AUTH_TOKEN: ${{ secrets.PACKET_AUTH_TOKEN }} | ||
PACKET_PROJECT_ID: ${{ secrets.PACKET_PROJECT_ID }} | ||
KUBERNETES_VERSION: ${{ secrets.NSM_KUBERNETES_VERSION }} | ||
GCLOUD_SERVICE_KEY: ${{ secrets.GCLOUD_SERVICE_KEY }} | ||
GCLOUD_PROJECT_ID: ${{ secrets.GOOGLE_PROJECT_ID }} | ||
working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }} | ||
- name: Publish test report | ||
uses: mikepenz/[email protected] | ||
|
||
- name: Cleanup GKE | ||
if: ${{ always() }} | ||
with: | ||
report_paths: "**/cloud_test/results/junit.xml" | ||
suite_regex: "Test*" | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }} | ||
run: | | ||
gcloud container clusters delete "${GKE_CLUSTER_NAME}" --project="${GKE_PROJECT_ID}" --zone="${GKE_CLUSTER_ZONE}" -q | ||
env: | ||
GKE_PROJECT_ID: ${{ secrets.GOOGLE_PROJECT_ID }} | ||
GKE_CLUSTER_NAME: gke-${{ github.run_id }}-${{ github.run_number }} | ||
GKE_CLUSTER_ZONE: us-central1-a | ||
|
||
|
||
- name: Cleanup AWS | ||
if: ${{ always() }} | ||
working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }} | ||
run: | | ||
scripts/aws/aws-destroy.sh | ||
env: | ||
AWS_REGION: us-east-2 | ||
AWS_CLUSTER_NAME: aws-${{ github.run_id }}-${{ github.run_number }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
|
||
- name: Cleanup AKS | ||
if: ${{ always() }} | ||
working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }} | ||
run: | | ||
scripts/aks/aks-destroy.sh ${AZURE_RESOURCE_GROUP} ${AZURE_CLUSTER_NAME} | ||
env: | ||
AZURE_CLUSTER_NAME: aks-${{ github.run_id }}-${{ github.run_number }} | ||
AZURE_SERVICE_PRINCIPAL: ${{ secrets.AZURE_SERVICE_PRINCIPAL }} | ||
AZURE_SERVICE_PRINCIPAL_SECRET: ${{ secrets.AZURE_SERVICE_PRINCIPAL_SECRET }} | ||
AZURE_TENANT: ${{ secrets.AZURE_TENANT }} | ||
AZURE_RESOURCE_GROUP: nsm-ci | ||
|
||
- name: Upload logs | ||
uses: actions/upload-artifact@v2 | ||
if: ${{ always() }} | ||
with: | ||
name: logs-${{ github.run_number }} | ||
path: ${{ github.workspace }}/src/github.com/${{ github.repository }}/.tests/cloud_test/ | ||
|
||
packet-cleanup: | ||
name: packet cleanup | ||
runs-on: ubuntu-latest | ||
needs: | ||
- cloudtest | ||
if: ${{ always() }} | ||
steps: | ||
- name: Set up /bin permissions | ||
run: | | ||
sudo chmod -R 777 /bin | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.16 | ||
- name: Clean up packet | ||
run: | | ||
go get github.com/networkservicemesh/cloudtest/pkg/providers/packet/packet_cleanup@master | ||
packet_cleanup -k y -c y --cluster-prefix "interdomain" | ||
env: | ||
GO111MODULE: on | ||
GOBIN: /bin | ||
PACKET_AUTH_TOKEN: ${{ secrets.PACKET_AUTH_TOKEN }} | ||
PACKET_PROJECT_ID: ${{ secrets.PACKET_PROJECT_ID }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,15 +1,13 @@ | ||
#!/bin/bash | ||
|
||
if ! gcloud container clusters list --project="${GKE_PROJECT_ID}" | grep -q ^"${GKE_CLUSTER_NAME}"; then \ | ||
time gcloud container clusters create "${GKE_CLUSTER_NAME}" --project="${GKE_PROJECT_ID}" --machine-type="${GKE_CLUSTER_TYPE}" --num-nodes=1 --zone="${GKE_CLUSTER_ZONE}" -q; \ | ||
echo "Writing config to ${KUBECONFIG}"; \ | ||
gcloud container clusters get-credentials "${GKE_CLUSTER_NAME}" --project="${GKE_PROJECT_ID}" --zone="${GKE_CLUSTER_ZONE}" ; \ | ||
kubectl create clusterrolebinding cluster-admin-binding \ | ||
--clusterrole cluster-admin \ | ||
--user "$(gcloud config get-value account)"; \ | ||
git clone https://github.com/coredns/deployment.git; \ | ||
./deployment/kubernetes/deploy.sh | kubectl apply -f -; \ | ||
kubectl scale --replicas=0 deployment/kube-dns-autoscaler --namespace=kube-system; \ | ||
kubectl scale --replicas=0 deployment/kube-dns --namespace=kube-system; \ | ||
rm -rf deployment; \ | ||
fi | ||
gcloud components install gke-gcloud-auth-plugin | ||
gcloud components update | ||
time gcloud container clusters create "${GKE_CLUSTER_NAME}" --project="${GKE_PROJECT_ID}" --machine-type="${GKE_CLUSTER_TYPE}" --num-nodes=1 --zone="${GKE_CLUSTER_ZONE}" -q | ||
echo "Writing config to ${KUBECONFIG}" | ||
gcloud container clusters get-credentials "${GKE_CLUSTER_NAME}" --project="${GKE_PROJECT_ID}" --zone="${GKE_CLUSTER_ZONE}" | ||
kubectl create clusterrolebinding cluster-admin-binding --clusterrole cluster-admin --user "$(gcloud config get-value account)" | ||
git clone https://github.com/coredns/deployment.git | ||
./deployment/kubernetes/deploy.sh | kubectl apply -f - | ||
kubectl scale --replicas=0 deployment/kube-dns-autoscaler --namespace=kube-system | ||
kubectl scale --replicas=0 deployment/kube-dns --namespace=kube-system | ||
rm -rf deployment |