forked from kubevirt/kubevirt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kubevirt#611 from rmohr/providers
Introduce interface to support different envs
- Loading branch information
Showing
36 changed files
with
448 additions
and
555 deletions.
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
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
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,5 @@ | ||
#!/bin/bash | ||
|
||
PROVIDER=${PROVIDER:-vagrant} | ||
source cluster/$PROVIDER/provider.sh | ||
down |
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,53 @@ | ||
#!/bin/bash | ||
|
||
function _cert_dir() { | ||
echo $GOPATH/src/kubevirt.io/kubevirt/cluster/local/certs | ||
} | ||
|
||
function _main_ip() { | ||
ip -o -4 a | tr -s ' ' | cut -d' ' -f 2,4 | | ||
grep -v -e '^lo[0-9:]*' | head -1 | | ||
cut -d' ' -f 2 | cut -d'/' -f1 | ||
} | ||
|
||
function up() { | ||
# Make sure that local config is correct | ||
prepare_config | ||
|
||
go get -d k8s.io/kubernetes | ||
|
||
export API_HOST_IP=$(_main_ip) | ||
export KUBELET_HOST=$(_main_ip) | ||
export HOSTNAME_OVERRIDE=kubdev | ||
export ALLOW_PRIVILEGED=1 | ||
export ALLOW_SECURITY_CONTEXT=1 | ||
export KUBE_DNS_DOMAIN="cluster.local" | ||
export KUBE_DNS_SERVER_IP="10.0.0.10" | ||
export KUBE_ENABLE_CLUSTER_DNS=true | ||
export CERT_DIR=$(_cert_dir) | ||
( | ||
cd $GOPATH/src/k8s.io/kubernetes | ||
./hack/local-up-cluster.sh | ||
) | ||
} | ||
|
||
function prepare_config() { | ||
cat >hack/config-provider-local.sh <<EOF | ||
master_ip=$(_main_ip) | ||
docker_tag=devel | ||
kubeconfig=$(_cert_dir)/admin.kubeconfig | ||
EOF | ||
} | ||
|
||
function build() { | ||
make manifests docker | ||
} | ||
|
||
function _kubectl() { | ||
export KUBECONFIG=$(_cert_dir)/admin.kubeconfig | ||
$GOPATH/src/k8s.io/kubernetes/cluster/kubectl.sh "$@" | ||
} | ||
|
||
function down() { | ||
echo "Not supported by this provider. Please kill the running script manually." | ||
} |
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,5 @@ | ||
#!/bin/bash | ||
|
||
PROVIDER=${PROVIDER:-vagrant} | ||
source cluster/$PROVIDER/provider.sh | ||
up |
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,53 @@ | ||
#!/bin/bash | ||
|
||
function _main_ip() { | ||
echo 192.168.200.2 | ||
} | ||
|
||
function up() { | ||
export USING_KUBE_SCRIPTS=true | ||
# Make sure that the vagrant environment is up and running | ||
vagrant up --provider=libvirt | ||
# Synchronize kubectl config | ||
vagrant ssh-config master 2>&1 | grep "not yet ready for SSH" >/dev/null && | ||
{ | ||
echo "Master node is not up" | ||
exit 1 | ||
} | ||
|
||
OPTIONS=$(vagrant ssh-config master | grep -v '^Host ' | awk -v ORS=' ' 'NF{print "-o " $1 "=" $2}') | ||
|
||
scp $OPTIONS master:/usr/bin/kubectl ${KUBEVIRT_PATH}cluster/vagrant/.kubectl | ||
chmod u+x cluster/vagrant/.kubectl | ||
|
||
vagrant ssh master -c "sudo cat /etc/kubernetes/admin.conf" >${KUBEVIRT_PATH}cluster/vagrant/.kubeconfig | ||
|
||
# Make sure that local config is correct | ||
prepare_config | ||
} | ||
|
||
function prepare_config() { | ||
BASE_PATH=${KUBEVIRT_PATH:-$PWD} | ||
cat >hack/config-provider-vagrant.sh <<EOF | ||
master_ip=$(_main_ip) | ||
docker_tag=devel | ||
kubeconfig=${BASE_PATH}/cluster/vagrant/.kubeconfig | ||
EOF | ||
} | ||
|
||
function build() { | ||
make build manifests | ||
for VM in $(vagrant status | grep -v "^The Libvirt domain is running." | grep running | cut -d " " -f1); do | ||
vagrant rsync $VM # if you do not use NFS | ||
vagrant ssh $VM -c "cd /vagrant && export DOCKER_TAG=${docker_tag} && sudo -E hack/build-docker.sh build && sudo -E hack/build-docker.sh build optional" | ||
done | ||
} | ||
|
||
function _kubectl() { | ||
export KUBECONFIG=${KUBEVIRT_PATH}cluster/vagrant/.kubeconfig | ||
${KUBEVIRT_PATH}cluster/vagrant/.kubectl "$@" | ||
} | ||
|
||
function down() { | ||
vagrant halt | ||
} |
Oops, something went wrong.