Skip to content

Commit

Permalink
Add k8s-1.9.3 provider
Browse files Browse the repository at this point in the history
  • Loading branch information
rmohr committed Feb 21, 2018
1 parent b0af705 commit 7457527
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ bin/*
.vagrant
cluster/vagrant-kubernetes/.kubeconfig
cluster/vagrant-kubernetes/.kubectl
cluster/k8s-1.9.3/.kubeconfig
cluster/k8s-1.9.3/.kubectl
hack/config-provider-k8s-1.9.3.sh
cluster/vagrant-openshift/.kubeconfig
cluster/vagrant-openshift/.oc
cluster/.console.vv
Expand Down
53 changes: 53 additions & 0 deletions cluster/k8s-1.9.3/provider.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

function _main_ip() {
echo 127.0.0.1
}

function up() {
VAGRANT_NUM_NODES=${VAGRANT_NUM_NODES-0}
# Add one, 0 here means no node at all, but in the kubevirt repo it means master-only
VAGRANT_NUM_NODES=$((VAGRANT_NUM_NODES+1))
docker run --privileged --rm -v /var/run/docker.sock:/var/run/docker.sock rmohr/cli:latest run --nodes ${VAGRANT_NUM_NODES} --tls-port 8443 --ssh-port 2201 --background --registry-port 5000 --base rmohr/kubeadm-1.9.3
docker run --privileged --rm -v /var/run/docker.sock:/var/run/docker.sock rmohr/cli:latest ssh node01 sudo chown vagrant:vagrant /etc/kubernetes/admin.conf

OPTIONS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${KUBEVIRT_PATH}cluster/k8s-1.9.3/vagrant.key -P 2201"

# Copy k8s config and kubectl
scp ${OPTIONS} [email protected]:/usr/bin/kubectl ${KUBEVIRT_PATH}cluster/k8s-1.9.3/.kubectl
chmod u+x cluster/vagrant-kubernetes/.kubectl
scp ${OPTIONS} [email protected]:/etc/kubernetes/admin.conf ${KUBEVIRT_PATH}cluster/k8s-1.9.3/.kubeconfig

# Set server and disable tls check
export KUBECONFIG=${KUBEVIRT_PATH}cluster/k8s-1.9.3/.kubeconfig
${KUBEVIRT_PATH}cluster/k8s-1.9.3/.kubectl config set-cluster kubernetes --server=https://127.0.0.1:8443
${KUBEVIRT_PATH}cluster/k8s-1.9.3/.kubectl config set-cluster kubernetes --insecure-skip-tls-verify=true

# Make sure that local config is correct
prepare_config
}

function prepare_config() {
BASE_PATH=${KUBEVIRT_PATH:-$PWD}
cat >hack/config-provider-k8s-1.9.3.sh <<EOF
master_ip=$(_main_ip)
docker_tag=devel
kubeconfig=${BASE_PATH}/cluster/k8s-1.9.3/.kubeconfig
docker_prefix=localhost:5000/kubevirt
manifest_docker_prefix=registry:5000/kubevirt
EOF
}

function build() {
${KUBEVIRT_PATH}hack/dockerized "DOCKER_TAG=${DOCKER_TAG} PROVIDER=${PROVIDER} ./hack/build-manifests.sh"
make build docker publish
}

function _kubectl() {
export KUBECONFIG=${KUBEVIRT_PATH}cluster/k8s-1.9.3/.kubeconfig
${KUBEVIRT_PATH}cluster/k8s-1.9.3/.kubectl "$@"
}

function down() {
docker run --privileged --rm -v /var/run/docker.sock:/var/run/docker.sock rmohr/cli:latest rm
}
27 changes: 27 additions & 0 deletions cluster/k8s-1.9.3/vagrant.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzI
w+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoP
kcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2
hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NO
Td0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcW
yLbIbEgE98OHlnVYCzRdK8jlqm8t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J
kda/AoGANWrLCz708y7VYgAtW2Uf1DPOIYMdvo6fxIB5i9ZfISgcJ/bbCUkFrhoH
+vq/5CIWxCPp0f85R4qxxQ5ihxJ0YDQT9Jpx4TMss4PSavPaBH3RXow5Ohe+bYoQ
NE5OgEXk2wVfZczCZpigBKbKZHNYcelXtTt/nP3rsCuGcM4h53s=
-----END RSA PRIVATE KEY-----
2 changes: 1 addition & 1 deletion hack/build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ for arg in $args; do
# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
# Because of this we have to manipulate the Dockerfile for kubevirt containers
# that depend on other kubevirt containers.
cat $arg/Dockerfile | sed s/registry-disk-v1alpha/registry-disk-v1alpha\:$docker_tag/g >${CMD_OUT_DIR}/${BIN_NAME}/Dockerfile
cat $arg/Dockerfile | sed -e "s#kubevirt/registry-disk-v1alpha#${docker_prefix}/registry-disk-v1alpha\:${docker_tag}#g" >${CMD_OUT_DIR}/${BIN_NAME}/Dockerfile
(
cd ${CMD_OUT_DIR}/${BIN_NAME}/
docker $target -t ${docker_prefix}/${BIN_NAME}:${docker_tag} .
Expand Down
9 changes: 5 additions & 4 deletions hack/build-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@

set -e

source hack/config.sh
source hack/common.sh
source hack/config.sh

manifest_docker_prefix=${manifest_docker_prefix-${docker_prefix}}

args=$(cd ${KUBEVIRT_DIR}/manifests && find * -type f -name "*.yaml.in")

Expand All @@ -30,8 +32,7 @@ for arg in $args; do
final_out_dir=$(dirname ${MANIFESTS_OUT_DIR}/${arg})
mkdir -p ${final_out_dir}
manifest=$(basename -s .in ${arg})
sed -e "s/{{ master_ip }}/$master_ip/g" \
-e "s/{{ docker_tag }}/$docker_tag/g" \
-e "s/{{ docker_prefix }}/$docker_prefix/g" \
sed -e "s#{{ docker_tag }}#${docker_tag}#g" \
-e "s#{{ docker_prefix }}#${manifest_docker_prefix}#g" \
${KUBEVIRT_DIR}/manifests/$arg >${final_out_dir}/${manifest}
done
2 changes: 1 addition & 1 deletion hack/config.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
unset binaries docker_images docker_prefix docker_tag manifest_templates \
master_ip network_provider kubeconfig
master_ip network_provider kubeconfig manifest_docker_prefix

PROVIDER=${PROVIDER:-vagrant-kubernetes}

Expand Down

0 comments on commit 7457527

Please sign in to comment.