Skip to content

Improvements to compile and run Kube 1.6 #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |c|

config.vm.box = "bento/centos-7.2"

ip = "10.1.2.3"
config.vm.network "private_network", ip: ip
# TODO: For some reason the private_network static IP does not work with
# nsf mounts.
# ip = "10.1.2.3"
# config.vm.network "private_network", ip: ip
config.vm.network "private_network", type: "dhcp"

config.vm.boot_timeout = 3000

Expand All @@ -58,7 +61,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |c|
vb.cpus = $vb_cpus
end

config.vm.provision "shell", inline: "HOST_GOPATH=#{$gopath} GUEST_IP=#{ip} /vagrant/setup.sh"
# TODO: Disabled static ip because it does not work with NFS mounts.
# config.vm.provision "shell", inline: "HOST_GOPATH=#{$gopath} GUEST_IP=#{ip} /vagrant/setup.sh"
config.vm.provision "shell", inline: "HOST_GOPATH=#{$gopath} /vagrant/setup.sh"
end
end

52 changes: 47 additions & 5 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ function install_system_tools() {
# Packages useful for testing/interacting with containers and
# source control tools are so go get works properly.
# net-tools: for ifconfig
yum -y install yum-fastestmirror git mercurial subversion curl nc gcc net-tools
yum -y install yum-fastestmirror git mercurial subversion curl nc gcc net-tools \
wget psmisc lsof vim unzip
}

# Add a repository to yum so that we can download
Expand Down Expand Up @@ -116,6 +117,26 @@ function install_etcd() {
)
}

# Download and install java8 from oracle
function install_java() {
(
cd /vagrant
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.rpm"
yum localinstall -y jdk-8u121-linux-x64.rpm
)
}


function install_bazel() {
(
cd /vagrant
wget https://github.com/bazelbuild/bazel/releases/download/0.4.4/bazel-0.4.4-installer-darwin-x86_64.sh
chmod +x bazel-0.4.4-installer-darwin-x86_64.sh
./bazel-0.4.4-installer-darwin-x86_64.sh
)

}

# Knowing the HOST_GOPATH, set up the gopath in the Guest.
# Not that this setup assumes that the HOST_GOPATH will be in the
# /Users directory tree in the host machine. The Vagrantfile sets up
Expand Down Expand Up @@ -151,6 +172,12 @@ function install_go_packages() {
# Kubernetes compilation requires this
sudo -u vagrant -E go get -u github.com/jteeuwen/go-bindata/go-bindata

# local-up-cluster wants cloudflare ssl toolkit
sudo -u vagrant -E go get -u github.com/cloudflare/cfssl/cmd/...

# dlv for debugging
sudo -u vagrant -E go get github.com/derekparker/delve/cmd/dlv

echo "Completed install_go_packages"
}

Expand All @@ -165,15 +192,30 @@ cat >/etc/profile.d/kubernetes.sh <<EOL
# Golang setup.
export GOPATH=${guestGopath}
export PATH=\$PATH:${guestGopath}/bin

# Add the local cluster related script to the PATH
export PATH=\$PATH:\$GOPATH/src/k8s.io/kubernetes/cluster

# So docker works without sudo.
export DOCKER_HOST=tcp://127.0.0.1:2375

# So you can start using cluster/kubecfg.sh right away.
export KUBERNETES_PROVIDER=local

# Run apiserver on guestIP (instead of 127.0.0.1) so you can access
# apiserver from your OS X host machine.
export API_HOST=${guestIp}
# TODO: The private network static IP/nfs mount combination does not work in vagrant.
# Disable this API host overwrite it is not very useful without static ip's anyways.
# export API_HOST=${guestIp}

# So you can access apiserver from kubectl in the VM.
export KUBERNETES_MASTER=\${API_HOST}:8080
# TODO: No need to do this. local-up-cluster helps you set up your ~/.kube/config
# file for successfull access.
# export KUBERNETES_MASTER=\${API_HOST}:8080

# For some reason basic authentication by default does not work from
# local-up-cluster.
# export ALLOW_ANY_TOKEN=true

# For convenience.
alias k="cd \$GOPATH/src/k8s.io/kubernetes"
Expand Down Expand Up @@ -205,9 +247,9 @@ install_docker
configure_and_start_docker

# Get the go and etcd releases.
install_go "1.6.3"
install_go "1.7.4"
# Latest kubernetes requires a recent version of etcd
install_etcd "v3.0.10"
install_etcd "v3.0.14"

# HOST_GOPATH is passed by the VagrantFile looking at the Mac's environment.
GUEST_GOPATH=/home/vagrant/gopath
Expand Down