37
.github/workflows/e2e-test.yml
vendored
Normal file
37
.github/workflows/e2e-test.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: e2e
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# run e2e test every 4 hours
|
||||
- cron: 0 */4 * * *
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
build:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO111MODULE: on
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.13
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.13
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Downloading go dependencies
|
||||
run: go mod vendor
|
||||
|
||||
- name: Create kind cluster
|
||||
uses: helm/kind-action@v1.0.0-rc.1
|
||||
with:
|
||||
config: .github/workflows/kind/kind.yaml
|
||||
|
||||
- name: Deploy KubeSphere to Kind
|
||||
run: KIND_CLUSTER_NAME=chart-testing hack/deploy-kubesphere.sh
|
||||
|
||||
- name: Run e2e testing
|
||||
run: go test ./test/e2e
|
||||
11
.github/workflows/kind/kind.yaml
vendored
Normal file
11
.github/workflows/kind/kind.yaml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
kind: Cluster
|
||||
apiVersion: kind.x-k8s.io/v1alpha4
|
||||
nodes:
|
||||
- role: control-plane
|
||||
image: kindest/node:v1.19.7
|
||||
extraMounts:
|
||||
- hostPath: /etc/localtime
|
||||
containerPath: /etc/localtime
|
||||
extraPortMappings:
|
||||
- containerPort: 30881
|
||||
hostPort: 9090
|
||||
56
hack/deploy-kubesphere.sh
Executable file
56
hack/deploy-kubesphere.sh
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2020 The KubeSphere 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
function wait_for_installation_finish() {
|
||||
echo "waiting for ks-installer pod ready"
|
||||
kubectl -n kubesphere-system wait --timeout=180s --for=condition=Ready $(kubectl -n kubesphere-system get pod -l app=ks-install -oname)
|
||||
echo "waiting for KubeSphere ready"
|
||||
while IFS= read -r line; do
|
||||
if [[ $line =~ "Welcome to KubeSphere" ]]
|
||||
then
|
||||
break
|
||||
fi
|
||||
done < <(timeout 900 kubectl logs -n kubesphere-system deploy/ks-installer -f)
|
||||
}
|
||||
|
||||
# Use kubespheredev and latest tag as default image
|
||||
TAG="${TAG:-latest}"
|
||||
REPO="${REPO:-kubespheredev}"
|
||||
|
||||
# Use KIND_LOAD_IMAGE=y .hack/deploy-kubesphere.sh to load
|
||||
# the built docker image into kind before deploying.
|
||||
if [[ "${KIND_LOAD_IMAGE:-}" == "y" ]]; then
|
||||
kind load docker-image "$REPO/ks-apiserver:$TAG" --name="${KIND_CLUSTER_NAME:-kind}"
|
||||
kind load docker-image "$REPO/ks-controller-manager:$TAG" --name="${KIND_CLUSTER_NAME:-kind}"
|
||||
fi
|
||||
|
||||
# Download the latest ks-install to deploy KubeSphere
|
||||
wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 --tries 3 https://raw.githubusercontent.com/kubesphere/ks-installer/master/deploy/kubesphere-installer.yaml
|
||||
wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 --tries 3 https://raw.githubusercontent.com/kubesphere/ks-installer/master/deploy/cluster-configuration.yaml
|
||||
|
||||
#TODO: override ks-apiserver and ks-controller-manager images with specific tag
|
||||
|
||||
kubectl apply -f kubesphere-installer.yaml
|
||||
kubectl apply -f cluster-configuration.yaml
|
||||
|
||||
wait_for_installation_finish
|
||||
|
||||
# Expose KubeSphere API Server
|
||||
kubectl -n kubesphere-system patch svc ks-apiserver -p '{"spec":{"type":"NodePort","ports":[{"name":"ks-apiserver","port":80,"protocal":"TCP","targetPort":9090,"nodePort":30881}]}}'
|
||||
Reference in New Issue
Block a user