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.
Introduce interface to support different envs
Signed-off-by: Roman Mohr <[email protected]>
- Loading branch information
Showing
14 changed files
with
199 additions
and
185 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
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,52 @@ | ||
#!/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 () { | ||
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-local.sh <<EOF | ||
master_ip=$(_main_ip) | ||
docker_tag=devel | ||
EOF | ||
} | ||
|
||
function build () { | ||
make manifests docker | ||
} | ||
|
||
function _kubectl () { | ||
export KUBECONFIG=$(_cert_dir)/admin.kubeconfig | ||
$GOPATH/src/k8s.io/kubernetes/cluster/kubectl.sh "$@" | ||
} | ||
|
||
function down () { | ||
true | ||
} | ||
|
||
# Make sure that local config is correct | ||
prepare_config |
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 | ||
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,47 @@ | ||
#!/bin/bash | ||
|
||
function _main_ip { | ||
echo 192.168.200.2 | ||
} | ||
|
||
function up () { | ||
# 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 | ||
} | ||
|
||
function prepare_config () { | ||
cat > hack/config-local.sh <<EOF | ||
master_ip=$(_main_ip) | ||
docker_tag=devel | ||
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=devel && 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 | ||
} | ||
|
||
# Make sure that local config is correct | ||
prepare_config |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.