Skip to content

Commit

Permalink
Change meaning of KUBEVIRT_NUM_NODES
Browse files Browse the repository at this point in the history
KUBEVIRT_NUM_NODES now refers to the number of schedulable nodes. That
means that a schedulable master counts as node too.
  • Loading branch information
rmohr committed May 2, 2018
1 parent bc87c02 commit ef52de9
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 20 deletions.
3 changes: 2 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ $use_nfs = ENV['VAGRANT_USE_NFS'] == 'true'
$use_rng = ENV['VAGRANT_USE_RNG'] == 'true'
$cache_docker = ENV['VAGRANT_CACHE_DOCKER'] == 'true'
$cache_rpm = ENV['VAGRANT_CACHE_RPM'] == 'true'
$nodes = (ENV['KUBEVIRT_NUM_NODES'] || 0).to_i
$nodes = (ENV['KUBEVIRT_NUM_NODES']).to_i
$nodes = $nodes -1
$vagrant_pool = (ENV['VAGRANT_POOL'] unless
(ENV['VAGRANT_POOL'].nil? or ENV['VAGRANT_POOL'].empty?))
# Used for matrix builds to similar setups on the same node without vagrant
Expand Down
2 changes: 1 addition & 1 deletion automation/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ else
export KUBEVIRT_PROVIDER="k8s-1.9.3"
fi

export KUBEVIRT_NUM_NODES=1
export KUBEVIRT_NUM_NODES=2
export NFS_WINDOWS_DIR=${NFS_WINDOWS_DIR:-/home/nfs/images/windows2016}

kubectl() { cluster/kubectl.sh "$@"; }
Expand Down
9 changes: 2 additions & 7 deletions cluster/ephemeral-provider-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ function _registry_volume() {
}

function _add_common_params() {
# Add one, 0 here means no node at all, but in the kubevirt repo it means master-only
local num_nodes=${KUBEVIRT_NUM_NODES-0}
num_nodes=$((num_nodes + 1))
local params="--nodes ${num_nodes} --random-ports --background --prefix $provider_prefix --registry-volume $(_registry_volume) kubevirtci/${image} ${KUBEVIRT_PROVIDER_EXTRA_ARGS}"
local params="--nodes ${KUBEVIRT_NUM_NODES} --random-ports --background --prefix $provider_prefix --registry-volume $(_registry_volume) kubevirtci/${image} ${KUBEVIRT_PROVIDER_EXTRA_ARGS}"
if [ -d "$NFS_WINDOWS_DIR" ]; then
params="--memory 8192M --nfs-data $NFS_WINDOWS_DIR $params"
fi
Expand Down Expand Up @@ -61,9 +58,7 @@ function build() {
container="${container} ${manifest_docker_prefix}/${name}:${docker_tag}"
container_alias="${container_alias} ${manifest_docker_prefix}/${name}:${docker_tag} kubevirt/${name}:${docker_tag}"
done
local num_nodes=${KUBEVIRT_NUM_NODES-0}
num_nodes=$((num_nodes + 1))
for i in $(seq 1 ${num_nodes}); do
for i in $(seq 1 ${KUBEVIRT_NUM_NODES}); do
${_cli} ssh --prefix $provider_prefix "node$(printf "%02d" ${i})" "echo \"${container}\" | xargs --max-args=1 sudo docker pull"
${_cli} ssh --prefix $provider_prefix "node$(printf "%02d" ${i})" "echo \"${container_alias}\" | xargs --max-args=2 sudo docker tag"
done
Expand Down
2 changes: 1 addition & 1 deletion cluster/k8s-1.9.3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local machine and are the pushed to a registry which is exposed at

```bash
export KUBEVIRT_PROVIDER=k8s-1.9.3
export KUBEVIRT_NUM_NODES=1 # master + one nodes
export KUBEVIRT_NUM_NODES=2 # master + one nodes
make cluster-up
```

Expand Down
4 changes: 2 additions & 2 deletions cluster/os-3.9.0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local machine and are the pushed to a registry which is exposed at

```bash
export KUBEVIRT_PROVIDER=os-3.9.0
export KUBEVIRT_NUM_NODES=1 # master + one nodes
export KUBEVIRT_NUM_NODES=2 # master + one nodes
make cluster-up
```

Expand All @@ -35,7 +35,7 @@ and run your cluster like this:

```bash
export KUBEVIRT_PROVIDER=os-3.9.0
export KUBEVIRT_NUM_NODES=1 # master + one nodes
export KUBEVIRT_NUM_NODES=2 # master + one nodes
export KUBEVIRT_PROVIDER_EXTRA_ARGS="--ocp-port 8443"
make cluster-up
```
Expand Down
2 changes: 1 addition & 1 deletion cluster/vagrant-kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It will deploy k8s only first time when you start a VM.

```bash
export KUBEVIRT_PROVIDER=vagrant-kubernetes
export KUBEVIRT_NUM_NODES=1
export KUBEVIRT_NUM_NODES=2
make cluster-up
```

Expand Down
2 changes: 1 addition & 1 deletion cluster/vagrant-openshift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It will deploy OpenShift only first time when you start a VM.

```bash
export KUBEVIRT_PROVIDER=vagrant-openshift
export KUBEVIRT_NUM_NODES=1
export KUBEVIRT_NUM_NODES=2
make cluster-up
```

Expand Down
2 changes: 1 addition & 1 deletion docs/env-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Usage:

```bash
export KUBEVIRT_PROVIDER=vagrant-kubernetes # choose this provider
export KUBEVIRT_NUM_NODES=2 # master + two nodes
export KUBEVIRT_NUM_NODES=3 # master + two nodes
make cluster-up
```

Expand Down
10 changes: 5 additions & 5 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ make cluster-up
make cluster-sync
```

This will create a VM called `node01` which acts as Kubernetes master and then
deploy KubeVirt there. To create one or more nodes which will register
themselves on master, you can use the `KUBEVIRT_NUM_NODES` environment
variable. This would create a master and one node:
This will create a VM called `node01` which acts as node and master. To create
more nodes which will register themselves on master, you can use the
`KUBEVIRT_NUM_NODES` environment variable. This would create a master and one
node:

```bash
export KUBEVIRT_NUM_NODES=1
export KUBEVIRT_NUM_NODES=2 # schedulable master + one additional node
make cluster-up
```

Expand Down
1 change: 1 addition & 0 deletions hack/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER:-k8s-1.9.3}

# For backward compatibility
KUBEVIRT_NUM_NODES=${KUBEVIRT_NUM_NODES:-${VAGRANT_NUM_NODES}}
KUBEVIRT_NUM_NODES=${KUBEVIRT_NUM_NODES:-1}

provider_prefix=${JOB_NAME:-${KUBEVIRT_PROVIDER}}${EXECUTOR_NUMBER}
job_prefix=${JOB_NAME:-kubevirt}${EXECUTOR_NUMBER}
Expand Down

0 comments on commit ef52de9

Please sign in to comment.