tests: Cleanup/Removed unnecessary whitespaces/new lines in scripts/docs
Signed-off-by: Alexander Trost <galexrt@googlemail.com>
This commit is contained in:
8 files changed
+250
-247
No files matched your search
+63
-67
@@ -1,11 +1,10 @@
|
||||
# Rook Test Framework
|
||||
|
||||
The Rook Test Framework is used to run end to end and integration tests on Rook. The framework depends on a running instance of kubernetes.
|
||||
The framework also provides scripts for starting kubernetes using kubeadm or minikube so users can
|
||||
quickly spin up a kubernetes cluster.The Test framework is designed to install Rook, run tests, and uninstall Rook.
|
||||
The Rook Test Framework is used to run end to end and integration tests on Rook. The framework depends on a running instance of Kubernetes.
|
||||
The framework also provides scripts for starting Kubernetes using `kubeadm` or `minikube` so users can
|
||||
quickly spin up a Kubernetes cluster.The Test framework is designed to install Rook, run tests, and uninstall Rook.
|
||||
|
||||
## Requirements
|
||||
|
||||
1. Docker version => 1.2 && < 17.0
|
||||
2. Ubuntu 16 (the framework has only been tested on this version)
|
||||
3. Kubernetes with kubectl configured
|
||||
@@ -16,9 +15,9 @@ quickly spin up a kubernetes cluster.The Test framework is designed to install R
|
||||
## Setup
|
||||
|
||||
### Install Kubernetes
|
||||
You can choose any kubernetes flavor of your choice. The test framework only depends on kubectl being configured.
|
||||
You can choose any Kubernetes flavor of your choice. The test framework only depends on kubectl being configured.
|
||||
The framework also provides scripts to install Kubernetes. There are two scripts to start the cluster:
|
||||
1. **Minikube** (recommended for MacOS): Run [minikube.sh](/tests/scripts/minikube.sh) to setup a single-node Minikube kubernetes.
|
||||
1. **Minikube** (recommended for MacOS): Run [minikube.sh](/tests/scripts/minikube.sh) to setup a single-node Minikube Kubernetes.
|
||||
1. Minikube v0.21.0 and higher is supported. Older minikube versions do not have cephfs or rbd tools installed.
|
||||
1. If using Kubernetes v1.7.3 or higher, then Minikube v0.22.2 or higher is required.
|
||||
1. **Kubeadm** (recommended for Ubuntu): run [kubeadm.sh](/tests/scripts/kubeadm.sh) to setup a single-node K8s cluster using kubeadm
|
||||
@@ -59,52 +58,52 @@ To use an alternate version, simply set this variable before running the relevan
|
||||
For example, if you wanted to use `v1.9.6`, you would run `export KUBE_VERSION=v1.9.6` first before running `up`.
|
||||
|
||||
### Install Helm
|
||||
Use [helm.sh](/tests/scripts/helm.sh) to install helm and set up rook charts defined under `_output/charts` (generated by build).
|
||||
- To install and set up Helm charts for rook run `tests/scripts/helm.sh up`
|
||||
- To clean up `tests/scripts/helm.sh clean`
|
||||
Use [helm.sh](/tests/scripts/helm.sh) to install helm and set up Rook charts defined under `_output/charts` (generated by build):
|
||||
- To install and set up Helm charts for Rook run `tests/scripts/helm.sh up`.
|
||||
- To clean up `tests/scripts/helm.sh clean`.
|
||||
|
||||
**Note:** *kubeadm.sh, minikube.sh and helm.sh scripts depend on some artifacts under _output dir generated during build time, these scripts
|
||||
should be run from project root. e.g., `tests/script/kubeadm.sh up`
|
||||
**Note:** `*kubeadm.sh`, `minikube.sh` and `helm.sh` scripts depend on some artifacts under the `_output/` directory generated during build time,
|
||||
these scripts should be run from project root. e.g., `tests/script/kubeadm.sh up`.
|
||||
|
||||
## Run Tests
|
||||
From the project root do the following:
|
||||
#### 1. Build rook:
|
||||
run `make build`
|
||||
#### 1. Build rook:
|
||||
Run `make build`
|
||||
|
||||
#### 2. Start kubernetes
|
||||
using one of the following:
|
||||
|
||||
- using Kubeadm
|
||||
```
|
||||
tests/scripts/kubeadm.sh up
|
||||
tests/scripts/helm.sh up
|
||||
```
|
||||
- using minikube
|
||||
```
|
||||
tests/scripts/minikube.sh up
|
||||
tests/scripts/minikube.sh helm
|
||||
tests/scripts/helm.sh up
|
||||
```
|
||||
#### 2. Start Kubernetes
|
||||
Using one of the following:
|
||||
|
||||
#### 3. Run integration tests:
|
||||
Integration tests can be run using tests binary `_output/tests/${platform}/integration` that is generated during build time
|
||||
eg ` ~/integration -test.v `
|
||||
|
||||
- Using Kubeadm
|
||||
```
|
||||
tests/scripts/kubeadm.sh up
|
||||
tests/scripts/helm.sh up
|
||||
```
|
||||
- Using minikube
|
||||
```
|
||||
tests/scripts/minikube.sh up
|
||||
tests/scripts/minikube.sh helm
|
||||
tests/scripts/helm.sh up
|
||||
```
|
||||
|
||||
#### 3. Run integration tests:
|
||||
Integration tests can be run using tests binary `_output/tests/${platform}/integration` that is generated during build time e.g.:
|
||||
```
|
||||
~/integration -test.v
|
||||
```
|
||||
|
||||
### Test parameters
|
||||
In addition to standard go tests parameters, the following custom parameters are available while running tests
|
||||
In addition to standard go tests parameters, the following custom parameters are available while running tests:
|
||||
|
||||
Parameter | Description | Possible values | Default
|
||||
--- |--- | --- | ---
|
||||
rook_platform| platform rook needs to be installed on | kubernetes | kubernetes
|
||||
k8s_version | version of Kubernetes to be installed | v1.7+ | v1.8.5
|
||||
rook_image | rook image name to be installed | valid image name | rook/ceph
|
||||
toolbox_image | toolbox image name to be installed | valid image name | rook/ceph-toolbox
|
||||
skip_install_rook | skips installing rook (if already installed) | true or false | false
|
||||
| Parameter | Description | Possible values | Default |
|
||||
| ----------------- | -------------------------------------------- | ---------------- | ----------------- |
|
||||
| rook_platform | platform Rook needs to be installed on | kubernetes | kubernetes |
|
||||
| k8s_version | version of Kubernetes to be installed | v1.7+ | v1.8.5 |
|
||||
| rook_image | Rook image name to be installed | valid image name | rook/ceph |
|
||||
| toolbox_image | toolbox image name to be installed | valid image name | rook/ceph-toolbox |
|
||||
| skip_install_rook | skips installing Rook (if already installed) | true or false | false |
|
||||
|
||||
### Running Tests with parameters.
|
||||
|
||||
#### To run all integration tests run
|
||||
#### To run all integration tests run
|
||||
```
|
||||
go test -v -timeout 1800s github.com/rook/rook/tests/integration
|
||||
```
|
||||
@@ -117,42 +116,39 @@ go test -v -timeout 1800s -run SmokeSuite github.com/rook/rook/tests/integration
|
||||
#### To run specific tests inside a suite:
|
||||
```
|
||||
go test -v -timeout 1800s -run SmokeSuite github.com/rook/rook/tests/integration -testify.m TestRookClusterInstallation_smokeTest
|
||||
|
||||
```
|
||||
|
||||
##### To run specific without installing rook
|
||||
```
|
||||
go test -v -timeout 1800s -run SmokeSuite github.com/rook/rook/tests/integration --skip_install_rook
|
||||
```
|
||||
If the `skip_install_rook` flag is set to true, then rook is not uninstalled either.
|
||||
If the `skip_install_rook` flag is set to true, then Rook is not uninstalled either.
|
||||
|
||||
#### Run Longhaul Tests
|
||||
[Longhaul](/tests/block/k8s/longhaul) tests are integration tests that run for extended period of time. A load profile can be configured
|
||||
using the following load test flags
|
||||
using the following load test flags
|
||||
|
||||
Parameter | Description | Possible values | Default
|
||||
--- |--- | --- | ---
|
||||
load_parallel_runs | performs concurrent operations | any number | 20
|
||||
load_volumes | number of volumes | >1 | 1
|
||||
load_time | number of seconds to run | >1 | 1800
|
||||
load_size | size of load profile (3M, 10M, or 50M per thread) | small, medium, or large | medium
|
||||
enable_chaos | kill random pods in rook cluster | true or false | false
|
||||
| Parameter | Description | Possible values | Default |
|
||||
| ------------------ | ------------------------------------------------- | ----------------------- | ------- |
|
||||
| load_parallel_runs | performs concurrent operations | any number | 20 |
|
||||
| load_volumes | number of volumes | >1 | 1 |
|
||||
| load_time | number of seconds to run | >1 | 1800 |
|
||||
| load_size | size of load profile (3M, 10M, or 50M per thread) | small, medium, or large | medium |
|
||||
| enable_chaos | kill random pods in Rook cluster | true or false | false |
|
||||
|
||||
e.g.
|
||||
```
|
||||
go test -run TestObjectLongHaul github.com/rook/rook/tests/longhaul --load_parallel_runs=20 --load_time 1800 --load_size small --load_volumes 3
|
||||
```
|
||||
The Longhaul test just like other test is going to install rook if it's not already installed, but it is not going to clean up test data or uninstall rook after the run.
|
||||
Longhaul test is designed to run multiple times on the same setup and installation of rook to tests its stability. Test Data and rook should be cleaned up manually after the test.
|
||||
|
||||
|
||||
You can measure memory, cpu, IOPS, throughput, and other settings on a cluster using Prometheus. The metrics collected during load test can be visualize using Grafana.
|
||||
Here a couple of helpful links to get prometheus and grafana started and collect metrics:
|
||||
[kube-prometheus](https://github.com/coreos/prometheus-operator/tree/master/contrib/kube-prometheus) and [cluster-deploy-script](https://github.com/coreos/prometheus-operator/blob/master/contrib/kube-prometheus/hack/cluster-monitoring/deploy)
|
||||
|
||||
e.g.
|
||||
```
|
||||
go test -run TestObjectLongHaul github.com/rook/rook/tests/longhaul --load_parallel_runs=20 --load_time 1800 --load_size small --load_volumes 3
|
||||
```
|
||||
The longhaul test just like other test is going to install Rook if it's not already installed, but it is not going to clean up test data or uninstall Rook after the run.
|
||||
Longhaul test is designed to run multiple times on the same setup and installation of Rook to tests its stability. Test data and Rook should be cleaned up manually after the test.
|
||||
|
||||
Prerequisites :
|
||||
|
||||
You can measure memory, CPU, IOPS, throughput, and other settings on a cluster using Prometheus. The metrics collected during load test can be visualize using Grafana.
|
||||
Here a couple of helpful links to get prometheus and grafana started and collect metrics:
|
||||
[kube-prometheus](https://github.com/coreos/prometheus-operator/tree/master/contrib/kube-prometheus) and [cluster-deploy-script](https://github.com/coreos/prometheus-operator/blob/master/contrib/kube-prometheus/hack/cluster-monitoring/deploy)
|
||||
|
||||
**Prerequisites**:
|
||||
* Go installed and GO_PATH set
|
||||
* Dep installed
|
||||
* when running tests locally, make sure `kubectl` is accessible globally as the test framework uses kubectl
|
||||
|
||||
* Dep installed
|
||||
* When running tests locally, make sure `kubectl` is accessible globally in your `PATH` as the test framework uses `kubectl`
|
||||
Executable → Regular
File mode changed.
+27
-22
@@ -3,11 +3,13 @@ scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
install() {
|
||||
#Download and unpack helm
|
||||
local dist=`uname -s`
|
||||
dist=`echo ${dist} | tr "[A-Z]" "[a-z]"`
|
||||
wget https://storage.googleapis.com/kubernetes-helm/helm-v2.6.0-${dist}-amd64.tar.gz
|
||||
tar -zxvf helm-v2.6.0-${dist}-amd64.tar.gz
|
||||
sudo mv ${dist}-amd64/helm /usr/local/bin/helm
|
||||
local dist
|
||||
dist="$(uname -s)"
|
||||
# shellcheck disable=SC2021
|
||||
dist=$(echo "${dist}" | tr "[A-Z]" "[a-z]")
|
||||
wget "https://storage.googleapis.com/kubernetes-helm/helm-v2.6.0-${dist}-amd64.tar.gz"
|
||||
tar -zxvf "helm-v2.6.0-${dist}-amd64.tar.gz"
|
||||
sudo mv "${dist}-amd64/helm" /usr/local/bin/helm
|
||||
|
||||
#Init helm
|
||||
helm init
|
||||
@@ -51,27 +53,30 @@ install() {
|
||||
|
||||
helm_reset() {
|
||||
helm reset
|
||||
local dist=`uname -s`
|
||||
dist=`echo ${dist} | tr "[A-Z]" "[a-z]"`
|
||||
local dist
|
||||
dist="$(uname -s)"
|
||||
# shellcheck disable=SC2021
|
||||
dist=$(echo "${dist}" | tr "[A-Z]" "[a-z]")
|
||||
sudo rm /usr/local/bin/helm
|
||||
rm -rf ${dist}-amd64/
|
||||
rm helm-v2.6.0-${dist}-amd64.tar.gz*
|
||||
ps -ef | grep helm | grep -v grep | awk '{print $2}'| xargs kill -9
|
||||
rm -rf "${dist}-amd64/"
|
||||
rm "helm-v2.6.0-${dist}-amd64.tar.gz"*
|
||||
pgrep helm | grep -v grep | awk '{print $2}'| xargs kill -9
|
||||
|
||||
}
|
||||
|
||||
|
||||
case "${1:-}" in
|
||||
up)
|
||||
install
|
||||
cat _output/version | xargs ${scriptdir}/makeTestImages.sh tag amd64 || true
|
||||
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
|
||||
;;
|
||||
clean)
|
||||
helm_reset
|
||||
;;
|
||||
*)
|
||||
echo "usage:" >&2
|
||||
echo " $0 up" >&2
|
||||
echo " $0 clean" >&2
|
||||
up)
|
||||
install
|
||||
# shellcheck disable=2002
|
||||
cat _output/version | xargs "${scriptdir}/makeTestImages.sh" tag amd64 || true
|
||||
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
|
||||
;;
|
||||
clean)
|
||||
helm_reset
|
||||
;;
|
||||
*)
|
||||
echo "usage:" >&2
|
||||
echo " $0 up" >&2
|
||||
echo " $0 clean" >&2
|
||||
esac
|
||||
@@ -46,35 +46,35 @@ export DIND_IMAGE="${DIND_IMAGE:-mirantis/kubeadm-dind-cluster:${KUBE_VERSION}}"
|
||||
export CNI_PLUGIN="${CNI_PLUGIN:-bridge}"
|
||||
|
||||
case "${1:-}" in
|
||||
up)
|
||||
${scriptdir}/dind-cluster.sh reup
|
||||
${scriptdir}/makeTestImages.sh save amd64 || true
|
||||
copy_image_to_cluster rook/rook:master
|
||||
copy_image_to_cluster rook/ceph-toolbox:master
|
||||
set +e
|
||||
copy_image_to_cluster ceph/base ceph/base:latest
|
||||
set -e
|
||||
copy_rbd
|
||||
;;
|
||||
down)
|
||||
${scriptdir}/dind-cluster.sh down
|
||||
;;
|
||||
clean)
|
||||
${scriptdir}/dind-cluster.sh clean
|
||||
;;
|
||||
update)
|
||||
copy_image_to_cluster rook/rook:master
|
||||
copy_image_to_cluster rook/ceph-toolbox:master
|
||||
;;
|
||||
wordpress)
|
||||
copy_image_to_cluster mysql:5.6
|
||||
copy_image_to_cluster wordpress:4.6.1-apache
|
||||
;;
|
||||
*)
|
||||
echo "usage:" >&2
|
||||
echo " $0 up" >&2
|
||||
echo " $0 down" >&2
|
||||
echo " $0 clean" >&2
|
||||
echo " $0 update" >&2
|
||||
echo " $0 wordpress" >&2
|
||||
up)
|
||||
${scriptdir}/dind-cluster.sh reup
|
||||
${scriptdir}/makeTestImages.sh save amd64 || true
|
||||
copy_image_to_cluster rook/rook:master
|
||||
copy_image_to_cluster rook/ceph-toolbox:master
|
||||
set +e
|
||||
copy_image_to_cluster ceph/base ceph/base:latest
|
||||
set -e
|
||||
copy_rbd
|
||||
;;
|
||||
down)
|
||||
${scriptdir}/dind-cluster.sh down
|
||||
;;
|
||||
clean)
|
||||
${scriptdir}/dind-cluster.sh clean
|
||||
;;
|
||||
update)
|
||||
copy_image_to_cluster rook/rook:master
|
||||
copy_image_to_cluster rook/ceph-toolbox:master
|
||||
;;
|
||||
wordpress)
|
||||
copy_image_to_cluster mysql:5.6
|
||||
copy_image_to_cluster wordpress:4.6.1-apache
|
||||
;;
|
||||
*)
|
||||
echo "usage:" >&2
|
||||
echo " $0 up" >&2
|
||||
echo " $0 down" >&2
|
||||
echo " $0 clean" >&2
|
||||
echo " $0 update" >&2
|
||||
echo " $0 wordpress" >&2
|
||||
esac
|
||||
@@ -9,7 +9,7 @@ KUBE_INSTALL_VERSION="${KUBE_VERSION/v/$null_str}"-00
|
||||
# Disabling swap when installing k8s 1.8.x via kubeadm
|
||||
sudo swapoff -a
|
||||
|
||||
# init flexvolume
|
||||
# init flexvolume
|
||||
if [[ $KUBE_VERSION == v1.7* ]] ;
|
||||
then
|
||||
sudo mkdir -p /usr/libexec/kubernetes/kubelet-plugins/volume/exec/rook.io~rook
|
||||
@@ -36,12 +36,12 @@ wait_for_dpkg_unlock() {
|
||||
retryInterval=10
|
||||
until [ ${retry} -ge ${maxRetries} ]
|
||||
do
|
||||
if [[ `sudo lsof /var/lib/dpkg/lock|wc -l` -le 0 ]]; then
|
||||
break
|
||||
fi
|
||||
((++retry))
|
||||
echo "."
|
||||
sleep ${retryInterval}
|
||||
if [[ `sudo lsof /var/lib/dpkg/lock|wc -l` -le 0 ]]; then
|
||||
break
|
||||
fi
|
||||
((++retry))
|
||||
echo "."
|
||||
sleep ${retryInterval}
|
||||
done
|
||||
|
||||
if [ ${retry} -ge ${maxRetries} ]; then
|
||||
@@ -68,9 +68,9 @@ wait_for_dpkg_unlock
|
||||
sleep 5
|
||||
wait_for_dpkg_unlock
|
||||
|
||||
sudo apt-get install -y kubelet=${KUBE_INSTALL_VERSION} && sudo apt-get install -y kubeadm=${KUBE_INSTALL_VERSION}
|
||||
sudo apt-get install -y kubelet="${KUBE_INSTALL_VERSION}" && sudo apt-get install -y kubeadm="${KUBE_INSTALL_VERSION}"
|
||||
|
||||
#get matching kubectl
|
||||
wget https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/linux/amd64/kubectl
|
||||
wget "https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/linux/amd64/kubectl"
|
||||
chmod +x kubectl
|
||||
sudo cp kubectl /usr/local/bin
|
||||
+43
-43
@@ -3,7 +3,7 @@
|
||||
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
tarname=image.tar
|
||||
tarfile=${WORK_DIR}/tests/${tarname}
|
||||
tarfile="${WORK_DIR}/tests/${tarname}"
|
||||
|
||||
export KUBE_VERSION=${KUBE_VERSION:-"v1.8.5"}
|
||||
|
||||
@@ -85,12 +85,12 @@ wait_for_ready(){
|
||||
export KUBECONFIG=$HOME/admin.conf
|
||||
|
||||
until [[ $count -eq $numberOfNode ]]; do
|
||||
echo "wait for K8s node $count to be Ready."
|
||||
echo "wait for K8s node $count to be Ready."
|
||||
INC=0
|
||||
while [[ $INC -lt 90 ]]; do
|
||||
kube_ready=$(kubectl get node -o jsonpath='{.items['$count'].status.conditions[?(@.reason == "KubeletReady")].status}')
|
||||
if [ "${kube_ready}" != "True" ]; then
|
||||
break
|
||||
break
|
||||
fi
|
||||
echo -n "."
|
||||
sleep 10
|
||||
@@ -124,51 +124,51 @@ kubeadm_reset() {
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
up)
|
||||
sudo sh -c "${scriptdir}/kubeadm-install.sh ${KUBE_VERSION}" root
|
||||
install_master
|
||||
${scriptdir}/makeTestImages.sh tag amd64 || true
|
||||
;;
|
||||
clean)
|
||||
kubeadm_reset
|
||||
;;
|
||||
install)
|
||||
if [ "$#" -lt 2 ]; then
|
||||
echo "invalid arguments for install"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
sudo sh -c "${scriptdir}/kubeadm-install.sh ${KUBE_VERSION}" root
|
||||
case "${2:-}" in
|
||||
master)
|
||||
install_master
|
||||
up)
|
||||
sudo sh -c "${scriptdir}/kubeadm-install.sh ${KUBE_VERSION}" root
|
||||
install_master
|
||||
${scriptdir}/makeTestImages.sh tag amd64 || true
|
||||
;;
|
||||
node)
|
||||
if [ "$#" -eq 5 ] || [ "$#" -eq 7 ]; then
|
||||
install_node $3 $4 $5 $6 $7
|
||||
else
|
||||
echo "invalid arguments for install node"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
clean)
|
||||
kubeadm_reset
|
||||
;;
|
||||
*)
|
||||
echo "invalid arguments for install" >&2
|
||||
install)
|
||||
if [ "$#" -lt 2 ]; then
|
||||
echo "invalid arguments for install"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
sudo sh -c "${scriptdir}/kubeadm-install.sh ${KUBE_VERSION}" root
|
||||
case "${2:-}" in
|
||||
master)
|
||||
install_master
|
||||
;;
|
||||
node)
|
||||
if [ "$#" -eq 5 ] || [ "$#" -eq 7 ]; then
|
||||
install_node $3 $4 $5 $6 $7
|
||||
else
|
||||
echo "invalid arguments for install node"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "invalid arguments for install" >&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
wait)
|
||||
if [ "$#" -eq 2 ]; then
|
||||
wait_for_ready $2
|
||||
else
|
||||
echo "invalid number of arguments for wait"
|
||||
wait)
|
||||
if [ "$#" -eq 2 ]; then
|
||||
wait_for_ready $2
|
||||
else
|
||||
echo "invalid number of arguments for wait"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
esac
|
||||
@@ -1,60 +1,61 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# shellcheck disable=SC1090
|
||||
source "${scriptdir}/../../build/common.sh"
|
||||
|
||||
|
||||
case "${1:-}" in
|
||||
save)
|
||||
case "${2:-}" in
|
||||
arm|arm64|amd64)
|
||||
docker tag ${BUILD_REGISTRY}/ceph-$2:latest rook/ceph:master
|
||||
docker tag ${BUILD_REGISTRY}/ceph-toolbox-$2:latest rook/ceph-toolbox:master
|
||||
docker tag ${BUILD_REGISTRY}/cockroachdb-$2:latest rook/cockroachdb:master
|
||||
if [ ! -z $3 ]
|
||||
save)
|
||||
case "${2:-}" in
|
||||
arm|arm64|amd64)
|
||||
docker tag "${BUILD_REGISTRY}/ceph-$2:latest" rook/ceph:master
|
||||
docker tag "${BUILD_REGISTRY}/ceph-toolbox-$2:latest" rook/ceph-toolbox:master
|
||||
docker tag "${BUILD_REGISTRY}/cockroachdb-$2:latest" rook/cockroachdb:master
|
||||
if [ ! -z "$3" ]
|
||||
then
|
||||
docker tag ${BUILD_REGISTRY}/ceph-$2:latest rook/ceph:$3
|
||||
docker save -o ceph-$2.tar rook/ceph:master rook/ceph:$3 rook/ceph-toolbox:master
|
||||
docker tag ${BUILD_REGISTRY}/cockroachdb-$2:latest rook/cockroachdb:$3
|
||||
docker save -o cockroachdb-$2.tar rook/cockroachdb:master rook/cockroachdb:$3
|
||||
docker tag "${BUILD_REGISTRY}/ceph-$2:latest" "rook/ceph:$3"
|
||||
docker save -o "ceph-$2.tar" rook/ceph:master "rook/ceph:$3" rook/ceph-toolbox:master
|
||||
docker tag "${BUILD_REGISTRY}/cockroachdb-$2:latest" "rook/cockroachdb:$3"
|
||||
docker save -o "cockroachdb-$2.tar" rook/cockroachdb:master "rook/cockroachdb:$3"
|
||||
else
|
||||
docker save -o ceph-$2.tar rook/ceph:master rook/ceph-toolbox:master
|
||||
docker save -o cockroachdb-$2.tar rook/cockroachdb:master
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "usage :" >&2
|
||||
echo "$0 $1 [arm|arm64|amd64] [new_tag]" >&2
|
||||
esac
|
||||
;;
|
||||
load)
|
||||
case "${2:-}" in
|
||||
arm|arm64|amd64)
|
||||
docker load -i ceph-$2.tar
|
||||
docker load -i cockroachdb-$2.tar
|
||||
;;
|
||||
*)
|
||||
echo "usage :" >&2
|
||||
echo "$0 $1 [arm|arm64|amd64]" >&2
|
||||
docker save -o "ceph-$2.tar" rook/ceph:master rook/ceph-toolbox:master
|
||||
docker save -o "cockroachdb-$2.tar" rook/cockroachdb:master
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "usage :" >&2
|
||||
echo "$0 $1 [arm|arm64|amd64] [new_tag]" >&2
|
||||
esac
|
||||
;;
|
||||
load)
|
||||
case "${2:-}" in
|
||||
arm|arm64|amd64)
|
||||
docker load -i "ceph-$2.tar"
|
||||
docker load -i "cockroachdb-$2.tar"
|
||||
;;
|
||||
*)
|
||||
echo "usage :" >&2
|
||||
echo "$0 $1 [arm|arm64|amd64]" >&2
|
||||
|
||||
esac
|
||||
;;
|
||||
tag)
|
||||
case "${2:- }" in
|
||||
arm|arm64|amd64)
|
||||
tag_version="${3:-"master"}"
|
||||
docker tag ${BUILD_REGISTRY}/ceph-$2:latest rook/ceph:${tag_version}
|
||||
docker tag ${BUILD_REGISTRY}/ceph-toolbox-$2:latest rook/ceph-toolbox:${tag_version}
|
||||
docker tag ${BUILD_REGISTRY}/cockroachdb-$2:latest rook/cockroachdb:${tag_version}
|
||||
;;
|
||||
*)
|
||||
echo "usage :" >&2
|
||||
echo "$0 $1 [arm|arm64|amd64] [new_tag]" >&2
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "usage:" >&2
|
||||
echo " $0 save [arm|arm64|amd64] [new_tag]" >&2
|
||||
echo " $0 load [arm|arm64|amd64]" >&2
|
||||
echo " $0 tag [arm|arm64|amd64] [new_tag]" >&2
|
||||
esac
|
||||
;;
|
||||
tag)
|
||||
case "${2:- }" in
|
||||
arm|arm64|amd64)
|
||||
tag_version="${3:-"master"}"
|
||||
docker tag "${BUILD_REGISTRY}/ceph-$2:latest" "rook/ceph:${tag_version}"
|
||||
docker tag "${BUILD_REGISTRY}/ceph-toolbox-$2:latest" "rook/ceph-toolbox:${tag_version}"
|
||||
docker tag "${BUILD_REGISTRY}/cockroachdb-$2:latest" "rook/cockroachdb:${tag_version}"
|
||||
;;
|
||||
*)
|
||||
echo "usage :" >&2
|
||||
echo "$0 $1 [arm|arm64|amd64] [new_tag]" >&2
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "usage:" >&2
|
||||
echo " $0 save [arm|arm64|amd64] [new_tag]" >&2
|
||||
echo " $0 load [arm|arm64|amd64]" >&2
|
||||
echo " $0 tag [arm|arm64|amd64] [new_tag]" >&2
|
||||
esac
|
||||
+27
-26
@@ -1,12 +1,13 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# shellcheck disable=SC1090
|
||||
source "${scriptdir}/../../build/common.sh"
|
||||
|
||||
function init_flexvolume() {
|
||||
local flexname=$1
|
||||
|
||||
cat <<EOF | ssh -i `minikube ssh-key` docker@`minikube ip` -o IdentitiesOnly=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet 'cat - > ~/rook'
|
||||
cat <<EOF | ssh -i "$(minikube ssh-key)" "docker@$(minikube ip)" -o IdentitiesOnly=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet 'cat - > ~/rook'
|
||||
#!/bin/bash
|
||||
echo -ne '{"status": "Success", "capabilities": {"attach": false}}' >&1
|
||||
exit 0
|
||||
@@ -57,11 +58,11 @@ EOF
|
||||
|
||||
function wait_for_ssh() {
|
||||
local tries=100
|
||||
while (( ${tries} > 0 )) ; do
|
||||
if `minikube ssh echo connected &> /dev/null` ; then
|
||||
while (( tries > 0 )) ; do
|
||||
if minikube ssh echo connected &> /dev/null ; then
|
||||
return 0
|
||||
fi
|
||||
tries=$(( ${tries} - 1 ))
|
||||
tries=$(( tries - 1 ))
|
||||
sleep 0.1
|
||||
done
|
||||
echo ERROR: ssh did not come up >&2
|
||||
@@ -71,23 +72,23 @@ function wait_for_ssh() {
|
||||
function copy_image_to_cluster() {
|
||||
local build_image=$1
|
||||
local final_image=$2
|
||||
docker save ${build_image} | (eval $(minikube docker-env --shell bash) && docker load && docker tag ${build_image} ${final_image})
|
||||
docker save "${build_image}" | (eval "$(minikube docker-env --shell bash)" && docker load && docker tag "${build_image}" "${final_image}")
|
||||
}
|
||||
|
||||
# Deletes pods with 'rook-' prefix. Namespace is expected as the first argument
|
||||
function delete_rook_pods() {
|
||||
for P in $(kubectl get pods -n $1 | awk "/$2/ {print \$1}"); do
|
||||
kubectl delete pod $P -n $1
|
||||
done
|
||||
for P in $(kubectl get pods -n "$1" | awk "/$2/ {print \$1}"); do
|
||||
kubectl delete pod "$P" -n "$1"
|
||||
done
|
||||
}
|
||||
|
||||
# current kubectl context == minikube, returns boolean
|
||||
function check_context() {
|
||||
if [ "$(kubectl config view 2>/dev/null | awk '/current-context/ {print $NF}')" = "minikube" ]; then
|
||||
return 0
|
||||
fi
|
||||
if [ "$(kubectl config view 2>/dev/null | awk '/current-context/ {print $NF}')" = "minikube" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
return 1
|
||||
}
|
||||
|
||||
# configure minikube
|
||||
@@ -99,7 +100,7 @@ case "${1:-}" in
|
||||
# Use kubeadm bootstrapper for 1.8+ since localkube was deprecated in 1.8
|
||||
if [[ $KUBE_VERSION == v1.7* ]] ; then
|
||||
echo "starting minikube with localkube bootstrapper"
|
||||
minikube start --memory=${MEMORY} -b localkube --kubernetes-version ${KUBE_VERSION} --extra-config=apiserver.Authorization.Mode=RBAC
|
||||
minikube start --memory="${MEMORY}" -b localkube --kubernetes-version "${KUBE_VERSION}" --extra-config=apiserver.Authorization.Mode=RBAC
|
||||
wait_for_ssh
|
||||
enable_roles_for_RBAC
|
||||
echo "initializing flexvolume for ceph.rook.io"
|
||||
@@ -107,18 +108,18 @@ case "${1:-}" in
|
||||
echo "initializing flexvolume for rook.io"
|
||||
init_flexvolume rook.io
|
||||
echo "restarting minikube"
|
||||
minikube start --memory=${MEMORY} -b localkube --kubernetes-version ${KUBE_VERSION} --extra-config=apiserver.Authorization.Mode=RBAC
|
||||
minikube start --memory="${MEMORY}" -b localkube --kubernetes-version "${KUBE_VERSION}" --extra-config=apiserver.Authorization.Mode=RBAC
|
||||
else
|
||||
echo "starting minikube with kubeadm bootstrapper"
|
||||
minikube start --memory=${MEMORY} -b kubeadm --kubernetes-version ${KUBE_VERSION}
|
||||
minikube start --memory="${MEMORY}" -b kubeadm --kubernetes-version "${KUBE_VERSION}"
|
||||
wait_for_ssh
|
||||
fi
|
||||
# create a link so the default dataDirHostPath will work for this environment
|
||||
minikube ssh "sudo mkdir /mnt/sda1/var/lib/rook;sudo ln -s /mnt/sda1/var/lib/rook /var/lib/rook"
|
||||
copy_image_to_cluster ${BUILD_REGISTRY}/ceph-amd64 rook/ceph:master
|
||||
copy_image_to_cluster ${BUILD_REGISTRY}/ceph-toolbox-amd64 rook/ceph-toolbox:master
|
||||
copy_image_to_cluster ${BUILD_REGISTRY}/cockroachdb-amd64 rook/cockroachdb:master
|
||||
copy_image_to_cluster ${BUILD_REGISTRY}/minio-amd64 rook/minio:master
|
||||
copy_image_to_cluster "${BUILD_REGISTRY}/ceph-amd64" rook/ceph:master
|
||||
copy_image_to_cluster "${BUILD_REGISTRY}/ceph-toolbox-amd64" rook/ceph-toolbox:master
|
||||
copy_image_to_cluster "${BUILD_REGISTRY}/cockroachdb-amd64" rook/cockroachdb:master
|
||||
copy_image_to_cluster "${BUILD_REGISTRY}/minio-amd64" rook/minio:master
|
||||
;;
|
||||
down)
|
||||
minikube stop
|
||||
@@ -129,10 +130,10 @@ case "${1:-}" in
|
||||
;;
|
||||
update)
|
||||
echo "updating the rook images"
|
||||
copy_image_to_cluster ${BUILD_REGISTRY}/ceph-amd64 rook/ceph:master
|
||||
copy_image_to_cluster ${BUILD_REGISTRY}/ceph-toolbox-amd64 rook/ceph-toolbox:master
|
||||
copy_image_to_cluster ${BUILD_REGISTRY}/cockroachdb-amd64 rook/cockroachdb:master
|
||||
copy_image_to_cluster ${BUILD_REGISTRY}/minio-amd64 rook/minio:master
|
||||
copy_image_to_cluster "${BUILD_REGISTRY}/ceph-amd64" rook/ceph:master
|
||||
copy_image_to_cluster "${BUILD_REGISTRY}/ceph-toolbox-amd64" rook/ceph-toolbox:master
|
||||
copy_image_to_cluster "${BUILD_REGISTRY}/cockroachdb-amd64" rook/cockroachdb:master
|
||||
copy_image_to_cluster "${BUILD_REGISTRY}/minio-amd64" rook/minio:master
|
||||
;;
|
||||
restart)
|
||||
if check_context; then
|
||||
@@ -152,9 +153,9 @@ case "${1:-}" in
|
||||
;;
|
||||
helm)
|
||||
echo " copying rook image for helm"
|
||||
helm_tag="`cat _output/version`"
|
||||
copy_image_to_cluster ${BUILD_REGISTRY}/ceph-amd64 rook/ceph:${helm_tag}
|
||||
copy_image_to_cluster ${BUILD_REGISTRY}/minio-amd64 rook/minio:${helm_tag}
|
||||
helm_tag="$(cat _output/version)"
|
||||
copy_image_to_cluster "${BUILD_REGISTRY}/ceph-amd64" "rook/ceph:${helm_tag}"
|
||||
copy_image_to_cluster "${BUILD_REGISTRY}/minio-amd64" "rook/minio:${helm_tag}"
|
||||
;;
|
||||
clean)
|
||||
minikube delete
|
||||
|
||||
Reference in new issue
Block a user