-
Notifications
You must be signed in to change notification settings - Fork 977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add one click install script #345
Merged
volcano-sh-bot
merged 6 commits into
volcano-sh:master
from
hzxuzhonghu:one-click-install
Jul 19, 2019
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6ef91c9
Add one click install script
hzxuzhonghu 5075d63
create default queue in scheduler
hzxuzhonghu a2fce8e
refactor install script
hzxuzhonghu 69ea9e0
clean code
hzxuzhonghu 727280c
update
hzxuzhonghu 1d26a0c
add one click install in docs
hzxuzhonghu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2019 The Volcano 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. | ||
|
||
# spin up cluster with kind command | ||
function kind-up-cluster { | ||
check-kind | ||
echo "Running kind: [kind create cluster ${CLUSTER_CONTEXT} ${KIND_OPT}]" | ||
kind create cluster ${CLUSTER_CONTEXT} ${KIND_OPT} | ||
|
||
echo "Loading docker images into kind cluster" | ||
kind load docker-image ${IMAGE_PREFIX}-controllers:${TAG} ${CLUSTER_CONTEXT} | ||
kind load docker-image ${IMAGE_PREFIX}-scheduler:${TAG} ${CLUSTER_CONTEXT} | ||
kind load docker-image ${IMAGE_PREFIX}-admission:${TAG} ${CLUSTER_CONTEXT} | ||
} | ||
|
||
|
||
# check if kubectl installed | ||
function check-prerequisites { | ||
echo "checking prerequisites" | ||
which kubectl >/dev/null 2>&1 | ||
if [[ $? -ne 0 ]]; then | ||
echo "kubectl not installed, exiting." | ||
exit 1 | ||
else | ||
echo -n "found kubectl, " && kubectl version --short --client | ||
fi | ||
} | ||
|
||
# check if kind installed | ||
function check-kind { | ||
echo "checking kind" | ||
which kind >/dev/null 2>&1 | ||
if [[ $? -ne 0 ]]; then | ||
echo "installing kind ." | ||
GO111MODULE="on" go get sigs.k8s.io/kind@v0.4.0 | ||
else | ||
echo -n "found kind, version: " && kind version | ||
fi | ||
} | ||
|
||
# install helm if not installed | ||
function install-helm { | ||
echo "checking helm" | ||
which helm >/dev/null 2>&1 | ||
if [[ $? -ne 0 ]]; then | ||
echo "Install helm via script" | ||
HELM_TEMP_DIR=`mktemp -d` | ||
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get > ${HELM_TEMP_DIR}/get_helm.sh | ||
#TODO: There are some issue with helm's latest version, remove '--version' when it get fixed. | ||
chmod 700 ${HELM_TEMP_DIR}/get_helm.sh && ${HELM_TEMP_DIR}/get_helm.sh --version v2.13.0 | ||
else | ||
echo -n "found helm, version: " && helm version | ||
fi | ||
} |
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 |
---|---|---|
@@ -0,0 +1,102 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2019 The Volcano 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. | ||
|
||
VK_ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.. | ||
CLUSTER_NAME=${CLUSTER_NAME:-volcano} | ||
CLUSTER_CONTEXT="--name ${CLUSTER_NAME}" | ||
KIND_OPT=${KIND_OPT:-} | ||
INSTALL_MODE=${INSTALL_MODE:-"kind"} | ||
IMAGE_PREFIX=volcanosh/vc | ||
TAG=${TAG:-`git rev-parse --verify HEAD`} | ||
RELEASE_DIR=_output/release | ||
RELEASE_FOLDER=${VK_ROOT}/${RELEASE_DIR} | ||
YAML_FILENAME=volcano-${TAG}.yaml | ||
|
||
|
||
# prepare deploy yaml and docker images | ||
function prepare { | ||
echo "Preparing..." | ||
install-helm | ||
echo "Generating valcano deploy yaml" | ||
make generate-yaml | ||
|
||
echo "Building docker images" | ||
make images | ||
} | ||
|
||
|
||
function install-volcano { | ||
# TODO: add a graceful way waiting for all crd ready | ||
kubectl apply -f ${RELEASE_FOLDER}/${YAML_FILENAME} | ||
} | ||
|
||
function uninstall-volcano { | ||
kubectl delete -f ${VK_ROOT}/installer/helm/chart/volcano/templates/default-queue.yaml | ||
kubectl delete -f ${RELEASE_FOLDER}/${YAML_FILENAME} | ||
} | ||
|
||
# clean up | ||
function cleanup { | ||
uninstall-volcano | ||
|
||
if [ "${INSTALL_MODE}" == "kind" ]; then | ||
echo "Running kind: [kind delete cluster ${CLUSTER_CONTEXT}]" | ||
kind delete cluster ${CLUSTER_CONTEXT} | ||
fi | ||
} | ||
|
||
echo $* | grep -E -q "\-\-help|\-h" | ||
if [[ $? -eq 0 ]]; then | ||
echo "Customize the kind-cluster name: | ||
|
||
export CLUSTER_NAME=<custom cluster name> # default: volcano | ||
|
||
Customize kind options other than --name: | ||
|
||
export KIND_OPT=<kind options> | ||
|
||
Using existing kubernetes cluster rather than starting a kind custer: | ||
|
||
export INSTALL_MODE=existing | ||
|
||
Cleanup all installation: | ||
|
||
./hack/local-up-volcano.sh -q | ||
" | ||
exit 0 | ||
fi | ||
|
||
|
||
echo $* | grep -E -q "\-\-quit|\-q" | ||
if [[ $? -eq 0 ]]; then | ||
cleanup | ||
exit 0 | ||
fi | ||
|
||
source "${VK_ROOT}/hack/lib/install.sh" | ||
|
||
check-prerequisites | ||
|
||
prepare | ||
|
||
if [ "${INSTALL_MODE}" == "kind" ]; then | ||
kind-up-cluster | ||
export KUBECONFIG="$(kind get kubeconfig-path ${CLUSTER_CONTEXT})" | ||
fi | ||
|
||
install-volcano | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,9 @@ import ( | |
|
||
"github.com/golang/glog" | ||
|
||
v1 "k8s.io/api/core/v1" | ||
"k8s.io/api/core/v1" | ||
"k8s.io/api/scheduling/v1beta1" | ||
apierrors "k8s.io/apimachinery/pkg/api/errors" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
utilruntime "k8s.io/apimachinery/pkg/util/runtime" | ||
|
@@ -45,6 +46,7 @@ import ( | |
|
||
"volcano.sh/volcano/cmd/scheduler/app/options" | ||
"volcano.sh/volcano/pkg/apis/scheduling/v1alpha1" | ||
"volcano.sh/volcano/pkg/apis/scheduling/v1alpha2" | ||
kbver "volcano.sh/volcano/pkg/client/clientset/versioned" | ||
"volcano.sh/volcano/pkg/client/clientset/versioned/scheme" | ||
kbschema "volcano.sh/volcano/pkg/client/clientset/versioned/scheme" | ||
|
@@ -258,6 +260,19 @@ func newSchedulerCache(config *rest.Config, schedulerName string, defaultQueue s | |
panic(fmt.Sprintf("failed init eventClient, with err: %v", err)) | ||
} | ||
|
||
// create default queue | ||
defaultQue := v1alpha2.Queue{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: defaultQueue, | ||
}, | ||
Spec: v1alpha2.QueueSpec{ | ||
Weight: 1, | ||
}, | ||
} | ||
if _, err := kbClient.SchedulingV1alpha2().Queues().Create(&defaultQue); err != nil && !apierrors.IsAlreadyExists(err) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if I have a existing default-queue from the previous version of volcano? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does not matter |
||
panic(fmt.Sprintf("failed init default queue, with err: %v", err)) | ||
} | ||
|
||
sc := &SchedulerCache{ | ||
Jobs: make(map[kbapi.JobID]*kbapi.JobInfo), | ||
Nodes: make(map[string]*kbapi.NodeInfo), | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the clusters other than kind cluster, how can user deploy the images into the cluster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question: we can not know their registry. If they use one node development env, the image is on the host. But if it is a multi-node cluster, we can not do that for users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to mention this in the document or just support kind cluster, since for the other cases, they can deploy volcano via the installation guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SG