Skip to content

Commit bf82213

Browse files
Merge pull request #344 from TommyLike/feature/release_ci
Support release volcano in Travis
2 parents 560a537 + aa792fc commit bf82213

7 files changed

Lines changed: 298 additions & 2 deletions

File tree

.travis.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,27 @@ jobs:
3737
- make e2e-test-kind
3838
after_failure:
3939
# Echo logs and upload
40-
- test -f helm-tiller.log && "******<<helm tiller service logs>>******" && cat helm-tiller.log
40+
- test -f helm-tiller.log && "echo ******<<helm tiller service logs>>******" && cat helm-tiller.log
4141
- test -f volcano-admission.log && echo "******<<admission logs>>******" && cat volcano-admission.log
4242
- test -f volcano-controller.log && echo "******<<controller logs>>******" && cat volcano-controller.log
4343
- test -f volcano-scheduler.log && echo "******<<scheduler logs>>******" && cat volcano-scheduler.log
44+
- stage: Publish release
45+
before_deploy:
46+
- export TRAVIS_TAG=$(git describe --tags)
47+
script:
48+
- echo "publish release to github & dockerhub"
49+
deploy:
50+
- provider: script
51+
script: make TAG=${TRAVIS_TAG} RELEASE_VER=${TRAVIS_TAG} release
52+
on:
53+
tags: true
54+
- provider: releases
55+
api_key: $GITHUB_TOKEN
56+
file_glob: true
57+
file: _output/release/volcano-${TRAVIS_TAG}-${OSTYPE}.tar.gz
58+
skip_cleanup: true
59+
on:
60+
tags: true
4461
notifications:
4562
webhooks: https://www.travisbuddy.com/
4663
on_success: never

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
BIN_DIR=_output/bin
2+
RELEASE_DIR=_output/release
23
REL_OSARCH=linux/amd64
34
REPO_PATH=volcano.sh/volcano
45
IMAGE_PREFIX=volcanosh/vc
@@ -17,6 +18,7 @@ all: vc-scheduler vc-controllers vc-admission vcctl
1718

1819
init:
1920
mkdir -p ${BIN_DIR}
21+
mkdir -p ${RELEASE_DIR}
2022

2123
vc-scheduler: init
2224
go build -ldflags ${LD_FLAGS} -o=${BIN_DIR}/vc-scheduler ./cmd/scheduler
@@ -30,7 +32,7 @@ vc-admission: init
3032
vcctl: init
3133
go build -ldflags ${LD_FLAGS} -o=${BIN_DIR}/vcctl ./cmd/cli
3234

33-
image_bins:
35+
image_bins: init
3436
go get github.com/mitchellh/gox
3537
CGO_ENABLED=0 gox -osarch=${REL_OSARCH} -ldflags ${LD_FLAGS} -output ${BIN_DIR}/${REL_OSARCH}/vcctl ./cmd/cli
3638
for name in controllers scheduler admission; do\
@@ -56,6 +58,13 @@ unit-test:
5658
e2e-test-kind:
5759
./hack/run-e2e-kind.sh
5860

61+
generate-yaml: init
62+
./hack/generate-yaml.sh
63+
64+
65+
release: images generate-yaml
66+
./hack/publish.sh
67+
5968
clean:
6069
rm -rf _output/
6170
rm -f *.log

hack/generate-yaml.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/bash
2+
3+
# Copyright 2019 The Volcano Authors.
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
VK_ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/..
22+
export HELM_BIN_DIR=${VK_ROOT}/${BIN_DIR}
23+
export RELEASE_FOLDER=${VK_ROOT}/${RELEASE_DIR}
24+
25+
export HELM_VER=${HELM_VER:-v2.13.0}
26+
export VOLCANO_IMAGE_TAG=${TAG:-"latest"}
27+
export YAML_FILENAME=volcano-${VOLCANO_IMAGE_TAG}.yaml
28+
29+
LOCAL_OS=${OSTYPE}
30+
case $LOCAL_OS in
31+
"linux"*)
32+
LOCAL_OS='linux'
33+
;;
34+
"darwin"*)
35+
LOCAL_OS='darwin'
36+
;;
37+
*)
38+
echo "This system's OS ${LOCAL_OS} isn't recognized/supported"
39+
exit 1
40+
;;
41+
esac
42+
43+
# Step1. install helm binary
44+
if [[ ! -f "${HELM_BIN_DIR}/version.helm.${HELM_VER}" ]] ; then
45+
TD=$(mktemp -d)
46+
cd "${TD}" && \
47+
curl -Lo "${TD}/helm.tgz" "https://storage.googleapis.com/kubernetes-helm/helm-${HELM_VER}-${LOCAL_OS}-amd64.tar.gz" && \
48+
tar xfz helm.tgz && \
49+
mv ${LOCAL_OS}-amd64/helm "${HELM_BIN_DIR}/helm-${HELM_VER}" && \
50+
cp "${HELM_BIN_DIR}/helm-${HELM_VER}" "${HELM_BIN_DIR}/helm" && \
51+
chmod +x ${HELM_BIN_DIR}/helm
52+
rm -rf "${TD}" && \
53+
touch "${HELM_BIN_DIR}/version.helm.${HELM_VER}"
54+
fi
55+
56+
# Step2. generate yaml in folder
57+
if [[ ! -d ${RELEASE_FOLDER} ]];then
58+
mkdir ${RELEASE_FOLDER}
59+
fi
60+
61+
DEPLOYMENT_FILE=${RELEASE_FOLDER}/${YAML_FILENAME}
62+
echo "Generating volcano yaml file into ${DEPLOYMENT_FILE}}"
63+
64+
if [[ -f ${DEPLOYMENT_FILE} ]];then
65+
rm ${DEPLOYMENT_FILE}
66+
fi
67+
cat ${VK_ROOT}/installer/namespace.yaml > ${DEPLOYMENT_FILE}
68+
${HELM_BIN_DIR}/helm template ${VK_ROOT}/installer/helm/chart/volcano --namespace volcano-system \
69+
--name volcano --set basic.image_tag_version=${VOLCANO_IMAGE_TAG} \
70+
--set basic.scheduler_config_file=kube-batch-ci.conf \
71+
-x templates/admission.yaml \
72+
-x templates/batch_v1alpha1_job.yaml \
73+
-x templates/bus_v1alpha1_command.yaml \
74+
-x templates/controllers.yaml \
75+
-x templates/scheduler.yaml \
76+
-x templates/scheduling_v1alpha1_podgroup.yaml \
77+
-x templates/scheduling_v1alpha1_queue.yaml \
78+
-x templates/scheduling_v1alpha2_podgroup.yaml \
79+
-x templates/scheduling_v1alpha2_queue.yaml \
80+
--notes >> ${DEPLOYMENT_FILE}

hack/publish.sh

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/bin/bash
2+
3+
# Copyright 2019 The Volcano Authors.
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
22+
23+
# The process of preparing volcano release.
24+
# 1. cp binaries into release folder
25+
# 2. cp README document into release folder
26+
# 3. cp default queue into release folder
27+
# 4. cp helm charts template into release folder and update default image tag
28+
# 5. cp license file into release folder
29+
# 6. upload docker images to volcano.sh
30+
# 7. generate zip file
31+
32+
VK_ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/..
33+
BINARY_FOLDER=${VK_ROOT}/${BIN_DIR}/${REL_OSARCH}
34+
RELEASE_FOLDER=${VK_ROOT}/${RELEASE_DIR}
35+
RELEASE_BINARY=${RELEASE_FOLDER}/bin
36+
QUEUE_FILE=${VK_ROOT}/installer/helm/chart/volcano/templates/default-queue.yaml
37+
README_FILE=${VK_ROOT}/installer/README.md
38+
HELM_FOLDER=${VK_ROOT}/installer/helm
39+
VOLCANO_IMAGE_TAG=${TAG:-"latest"}
40+
DOCKER_PASSWORD=${DOCKER_PASSWORD:-""}
41+
DOCKER_USERNAME=${DOCKER_USERNAME:-""}
42+
LICENSE_FILE=${VK_ROOT}/LICENSE
43+
44+
if [[ ! -d ${RELEASE_BINARY} ]];then
45+
mkdir ${RELEASE_BINARY}
46+
fi
47+
48+
cp -r ${BINARY_FOLDER} ${RELEASE_BINARY}
49+
50+
cp ${README_FILE} ${RELEASE_FOLDER}
51+
52+
cp ${QUEUE_FILE} ${RELEASE_FOLDER}
53+
54+
cp -r ${HELM_FOLDER} ${RELEASE_FOLDER}
55+
56+
if [[ -f ${LICENSE_FILE} ]];then
57+
cp ${LICENSE_FILE} ${RELEASE_FOLDER}
58+
fi
59+
60+
# overwrite the tag name into values yaml
61+
sed -i "s/latest/${VOLCANO_IMAGE_TAG}/g" ${RELEASE_FOLDER}/helm/chart/volcano/values.yaml
62+
63+
if [[ "${DOCKER_USERNAME}xxx" == "xxx" ]];then
64+
if [[ "${DOCKER_PASSWORD}xxx" == "xxx" ]];then
65+
echo "docker username or password not found, quit uploading images"
66+
exit 0
67+
fi
68+
fi
69+
70+
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
71+
echo "pushing ${IMAGE_PREFIX}-controllers:${VOLCANO_IMAGE_TAG}"
72+
docker push ${IMAGE_PREFIX}-controllers:${VOLCANO_IMAGE_TAG}
73+
docker push ${IMAGE_PREFIX}-scheduler:${VOLCANO_IMAGE_TAG}
74+
docker push ${IMAGE_PREFIX}-admission:${VOLCANO_IMAGE_TAG}
75+
76+
echo "Generate release tar files"
77+
cd ${RELEASE_FOLDER}/
78+
tar -zcvf volcano-${VOLCANO_IMAGE_TAG}-${OSTYPE}.tar.gz *

installer/README.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
## Volcano
2+
3+
Volcano is a batch system built on Kubernetes. It provides a suite of mechanisms currently missing from
4+
Kubernetes that are commonly required by many classes of batch & elastic workload including:
5+
6+
1. machine learning/deep learning,
7+
2. bioinformatics/genomics, and
8+
3. other "big data" applications.
9+
10+
## Prerequisites
11+
12+
- Kubernetes 1.12+ with CRD support
13+
14+
## Installing volcano via yaml file
15+
16+
All-in-one yaml has been generated for quick deployment. Try command:
17+
```$xslt
18+
kubectl apply -f volcano-v0.0.x.yaml
19+
```
20+
Check the status in namespace `volcano-system`
21+
```$xslt
22+
$kubectl get all -n volcano-system
23+
NAME READY STATUS RESTARTS AGE
24+
pod/volcano-admission-56f5465597-2pbfx 1/1 Running 0 36s
25+
pod/volcano-admission-init-pjgf2 0/1 Completed 0 36s
26+
pod/volcano-controllers-687948d9c8-zdtvw 1/1 Running 0 36s
27+
pod/volcano-scheduler-94998fc64-86hzn 1/1 Running 0 36s
28+
29+
30+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
31+
service/volcano-admission-service ClusterIP 10.103.235.185 <none> 443/TCP 36s
32+
33+
34+
NAME READY UP-TO-DATE AVAILABLE AGE
35+
deployment.apps/volcano-admission 1/1 1 1 36s
36+
deployment.apps/volcano-controllers 1/1 1 1 36s
37+
deployment.apps/volcano-scheduler 1/1 1 1 36s
38+
39+
NAME DESIRED CURRENT READY AGE
40+
replicaset.apps/volcano-admission-56f5465597 1 1 1 36s
41+
replicaset.apps/volcano-controllers-687948d9c8 1 1 1 36s
42+
replicaset.apps/volcano-scheduler-94998fc64 1 1 1 36s
43+
```
44+
Volcano scheduler utilize `queues.scheduling.incubator.k8s.io` to share resource, therefore default queue is required before usage.
45+
```$xslt
46+
kubectl apply -f default-queue.yaml
47+
```
48+
49+
## Installing volcano via helm charts
50+
51+
To install the volcano with chart:
52+
53+
```bash
54+
helm install helm/chart/volcano --namespace <namespace> --name <specified-name>
55+
56+
e.g :
57+
helm install helm/chart/volcano --namespace volcano-trial --name volcano-trial
58+
```
59+
60+
This command deploys volcano in kubernetes cluster with default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.
61+
62+
63+
## Uninstalling the Chart
64+
65+
```bash
66+
$ helm delete volcano-release --purge
67+
```
68+
69+
## Configuration
70+
71+
The following are the list configurable parameters of Volcano Chart and their default values.
72+
73+
| Parameter|Description|Default Value|
74+
|----------------|-----------------|----------------------|
75+
|`basic.image_tag_version`| Docker image version Tag | `latest`|
76+
|`basic.controller_image_name`|Controller Docker Image Name|`volcanosh/vc-controllers`|
77+
|`basic.scheduler_image_name`|Scheduler Docker Image Name|`volcanosh/vc-scheduler`|
78+
|`basic.admission_image_name`|Admission Controller Image Name|`volcanosh/vc-admission`|
79+
|`basic.admission_secret_name`|Volcano Admission Secret Name|`volcano-admission-secret`|
80+
|`basic.scheduler_config_file`|Configuration File name for Scheduler|`kube-batch.conf`|
81+
|`basic.image_pull_secret`|Image Pull Secret|`""`|
82+
|`basic.image_pull_policy`|Image Pull Policy|`IfNotPresent`|
83+
|`basic.admission_app_name`|Admission Controller App Name|`volcano-admission`|
84+
|`basic.controller_app_name`|Controller App Name|`volcano-controller`|
85+
|`basic.scheduler_app_name`|Scheduler App Name|`volcano-scheduler`|
86+
87+
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
88+
89+
```bash
90+
$ helm install --name volcano-release --set basic.image_pull_policy=Always volcano/volcano
91+
```
92+
93+
The above command set image pull policy to `Always`, so docker image will be pulled each time.
94+
95+
96+
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
97+
98+
```bash
99+
$ helm install --name volcano-release -f values.yaml volcano/volcano
100+
```
101+
102+
> **Tip**: You can use the default [values.yaml](chart/volcano/values.yaml)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Thank you for installing {{ .Chart.Name }}.
2+
3+
Your release is named {{ .Release.Name }}.
4+
5+
For more information on volcano, visit:
6+
https://volcano.sh/

installer/namespace.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: volcano-system

0 commit comments

Comments
 (0)