From 87c714b628ef3a4e8e29b6093231e1b0285747ea Mon Sep 17 00:00:00 2001 From: JenTing Hsiao Date: Fri, 4 Dec 2020 15:44:36 +0800 Subject: [PATCH] Add Github action CI integration test (#2) Signed-off-by: JenTing Hsiao --- .github/workflows/ci.yml | 49 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..18fcb1a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: CI + +on: + pull_request: + push: + branches: + - main + +jobs: + integration-test: + runs-on: ubuntu-latest + steps: + - name: Set up Go ^1.15 + uses: actions/setup-go@v2 + with: + go-version: ^1.15 + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Set up KIND cluster + uses: engineerd/setup-kind@v0.5.0 + + - name: Install kustomize + run: | + curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash + sudo mv kustomize /usr/local/bin/kustomize + + - name: Install + run: | + git clone -b v0.4.1 https://github.com/kubernetes-sigs/metrics-server.git + mkdir -p metrics-server/manifests/secure-metrics-server + cp secure-metrics-server.sh metrics-server/manifests/secure-metrics-server + cd metrics-server/manifests/secure-metrics-server + NODE_NAME=`kind get nodes` + CONTAINER_ID=`docker ps --filter "name=$NODE_NAME" -q` + docker cp $CONTAINER_ID:/etc/kubernetes/pki/ca.crt kubernetes-ca.crt + ./secure-metrics-server.sh + cd ../ + kustomize build secure-metrics-server | kubectl apply -f - + kubectl wait --for=condition=available deploy/metrics-server -n kube-system + + - name: Test + run: | + kubectl wait --for=condition=available apiservice/v1beta1.metrics.k8s.io + kubectl get --raw /apis/metrics.k8s.io/v1beta1/nodes + kubectl get --raw /apis/metrics.k8s.io/v1beta1/pods + kubectl top nodes + kubectl top pods -n kube-system