Skip to content

Commit

Permalink
Merge pull request #209 from networkservicemesh/update/networkservice…
Browse files Browse the repository at this point in the history
…mesh/integration-k8s-kind

Update from update/networkservicemesh/integration-k8s-kind
  • Loading branch information
edwarnicke authored May 4, 2023
2 parents c1d408c + d98019c commit acf25b6
Show file tree
Hide file tree
Showing 11 changed files with 100 additions and 203 deletions.
16 changes: 0 additions & 16 deletions .cloudtest.yaml

This file was deleted.

119 changes: 84 additions & 35 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
28 changes: 0 additions & 28 deletions aks/azure.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions aws/aws.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions cluster-config.yaml

This file was deleted.

3 changes: 1 addition & 2 deletions entry_point_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2021 Doc.ai and/or its affiliates.
//
// Copyright (c) 2022 Cisco and/or its affiliates.
// Copyright (c) 2022-2023 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -25,7 +25,6 @@ import (

"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp" // This is required for GKE authentication

"github.com/networkservicemesh/integration-tests/suites/multicluster"
)
Expand Down
26 changes: 0 additions & 26 deletions gke/gke.yaml

This file was deleted.

5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ module github.com/networkservicemesh/integration-interdomain-k8s
go 1.18

require (
github.com/networkservicemesh/integration-tests v0.0.0-20221219214735-370246c106f2
github.com/networkservicemesh/integration-tests v0.0.0-20230503164829-413ea99b39a9
github.com/stretchr/testify v1.7.0
k8s.io/client-go v0.20.5
)

require (
cloud.google.com/go v0.54.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v0.2.0 // indirect
github.com/gogo/protobuf v1.3.1 // indirect
Expand Down Expand Up @@ -39,6 +37,7 @@ require (
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
k8s.io/api v0.20.5 // indirect
k8s.io/apimachinery v0.20.5 // indirect
k8s.io/client-go v0.20.5 // indirect
k8s.io/klog/v2 v2.4.0 // indirect
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.0.2 // indirect
Expand Down
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
cloud.google.com/go v0.54.0 h1:3ithwDMr7/3vpAMXiH+ZQnYbuIsh+OPhUPMFC9enmn0=
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
Expand Down Expand Up @@ -159,8 +158,8 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8m
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/networkservicemesh/gotestmd v0.0.0-20220628095933-eabbdc09e0dc h1:1L/OisEFsOyhwaqeJpYmM1nlJ2dBusUMiszPDBlUip0=
github.com/networkservicemesh/gotestmd v0.0.0-20220628095933-eabbdc09e0dc/go.mod h1:8EWnekTRNX+NxBdTFE24WqUoM7SgJHbiafDBrIIdOmQ=
github.com/networkservicemesh/integration-tests v0.0.0-20221219214735-370246c106f2 h1:mUTx26/F/2z4+9I1UPCh4OgeoUnTWnC6TKNeglhz6T0=
github.com/networkservicemesh/integration-tests v0.0.0-20221219214735-370246c106f2/go.mod h1:qkqJgckg5vY5STByxzKhzhDB+TKCAU0qasuwfJ0cG+s=
github.com/networkservicemesh/integration-tests v0.0.0-20230503164829-413ea99b39a9 h1:qHPXAA1N2VWRpzq2WnBRQq3YIlf4mSpj7f58ieRxpik=
github.com/networkservicemesh/integration-tests v0.0.0-20230503164829-413ea99b39a9/go.mod h1:qkqJgckg5vY5STByxzKhzhDB+TKCAU0qasuwfJ0cG+s=
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
Expand Down
45 changes: 0 additions & 45 deletions packet/packet.yaml

This file was deleted.

24 changes: 11 additions & 13 deletions scripts/gke/gke-start.sh
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

0 comments on commit acf25b6

Please sign in to comment.