Created
June 23, 2021 17:38
-
-
Save jayunit100/0433517f065d54c9f0275f9fcda99d21 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
diff --git a/Vagrantfile b/Vagrantfile | |
index 4586d12..5f5480e 100644 | |
--- a/Vagrantfile | |
+++ b/Vagrantfile | |
@@ -1,11 +1,16 @@ | |
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
require 'yaml' | |
+ | |
+# Modify these in the variables.yaml file... they are described there in gory detail... | |
settings = YAML.load_file 'sync/shared/variables.yaml' | |
-kubernetes_version_linux = settings['kubernetes_version_linux'] | |
-kubernetes_version_windows = settings['kubernetes_version_windows'] | |
-overwrite_linux = settings['overwrite_linux_bins'] | |
-overwrite_windows = settings['overwrite_windows_bins'] ? "-OverwriteBins" : "" | |
+k8s_linux_registry=settings['k8s_linux_registry'] | |
+k8s_linux_kubelet_deb=settings['k8s_linux_kubelet_deb'] | |
+k8s_linux_apiserver=settings['k8s_linux_apiserver'] | |
+kubernetes_version_windows=settings['kubernetes_version_windows'] | |
+ | |
+overwrite_linux_bins = settings['overwrite_linux_bins'] | |
+overwrite_windows_bins = settings['overwrite_windows_bins'] ? "-OverwriteBins" : "" | |
Vagrant.configure(2) do |config| | |
@@ -23,7 +28,7 @@ Vagrant.configure(2) do |config| | |
vb.memory = 8192 | |
vb.cpus = 4 | |
end | |
- controlplane.vm.provision :shell, privileged: false, path: "sync/linux/controlplane.sh", args: "#{kubernetes_version_linux} #{overwrite_linux}" | |
+ controlplane.vm.provision :shell, privileged: false, path: "sync/linux/controlplane.sh", args: "#{overwrite_linux_bins} ${k8s_linux_registry} ${k8s_linux_kubelet_deb} ${k8s_linux_apiserver} " | |
end | |
# WINDOWS WORKER (win server 2019) | |
@@ -54,7 +59,7 @@ Vagrant.configure(2) do |config| | |
winw1.vm.provision "shell", path: "sync/windows/containerd2.ps1", privileged: true #, run: "never" | |
- winw1.vm.provision "shell", path: "forked/PrepareNode.ps1", privileged: true, args: "-KubernetesVersion #{kubernetes_version_windows} -ContainerRuntime containerD #{overwrite_windows }" #, run: "never" | |
+ winw1.vm.provision "shell", path: "forked/PrepareNode.ps1", privileged: true, args: "-KubernetesVersion #{kubernetes_version_windows} -ContainerRuntime containerD #{overwrite_windows_bins }" #, run: "never" | |
winw1.vm.provision "shell", path: "sync/shared/kubejoin.ps1", privileged: true #, run: "never" | |
diff --git a/forked/PrepareNode.ps1 b/forked/PrepareNode.ps1 | |
index c485e08..8c4a341 100644 | |
--- a/forked/PrepareNode.ps1 | |
+++ b/forked/PrepareNode.ps1 | |
@@ -43,6 +43,8 @@ Param( | |
[ValidateSet("containerD", "Docker")] | |
[string] $ContainerRuntime = "Docker", | |
+ # This is a modifcation for the windows-dev-tools where we | |
+ # OVERWRITE the WINDOWS kubelet AND kubeadm BINARY. | |
[parameter(HelpMessage="Allows to overwrite bins with self-built ones")] | |
[switch] $OverwriteBins | |
) | |
@@ -93,7 +95,7 @@ $env:Path += ";$global:KubernetesPath" | |
[Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::Machine) | |
# DownloadFile $kubeletBinPath https://dl.k8s.io/$KubernetesVersion/bin/windows/amd64/kubelet.exe | |
-# We replaced this ↑ with that ↓ | |
+# We replaced this ↑ with ↓ | |
Write-Output "Deciding source to use for Kubelet.exe ..." | |
$SelfBuiltKubeletSource = "C:\sync\windows\bin\kubelet.exe" | |
if ((Test-Path -Path $SelfBuiltKubeletSource -PathType Leaf) -and ($OverwriteBins)) { | |
@@ -116,7 +118,6 @@ if ($OverwriteBins) { | |
} | |
DownloadFile "$global:KubernetesPath\kubeadm.exe" https://dl.k8s.io/$KubernetesVersion/bin/windows/amd64/kubeadm.exe | |
-DownloadFile "$global:KubernetesPath\wins.exe" https://github.com/rancher/wins/releases/download/v0.0.4/wins.exe | |
if ($ContainerRuntime -eq "Docker") { | |
# Create host network to allow kubelet to schedule hostNetwork pods | |
diff --git a/sync/linux/controlplane.sh b/sync/linux/controlplane.sh | |
index 1dc7ed7..fc23dc8 100644 | |
--- a/sync/linux/controlplane.sh | |
+++ b/sync/linux/controlplane.sh | |
@@ -14,9 +14,14 @@ See the License for the specific language governing permissions and | |
limitations under the License. | |
' | |
set -e | |
-kubernetes_version=${1-1.21.0} | |
+ | |
+# TODO Add these as command line options | |
+overwrite_linux_bins=${1-false} | |
+k8s_linux_registry=${2-"gcr.io/k8s-staging-ci-images"} | |
+k8s_linux_kubelet_deb=${3-"1.21.0"} | |
+k8s_linux_apiserver=${4-"v1.22.0-alpha.3.31+a3abd06ad53b2f"} | |
+ | |
echo "Using $kubernetes_version as the Kubernetes version" | |
-overwrite_bins=${2-false} | |
echo "Overwriting bins is set to '$overwrite_bins'" | |
# Add GDP keys and repositories for both Docker and Kubernetes | |
@@ -51,13 +56,16 @@ EOF | |
# Apply sysctl params without reboot | |
sudo sysctl --system | |
+#Install Docker and Kubernetes, | |
+sudo apt-get install -y docker-ce=5:20.10.5~3-0~ubuntu-$(lsb_release -cs) \ | |
+kubelet=${k8s_linux_kubelet_deb}-00 \ | |
+kubeadm=${k8s_linux_kubelet_deb}-00 \ | |
+kubectl=${k8s_linux_kubelet_deb}-00 | |
-#Install Docker and Kubernetes, hold versions | |
-sudo apt-get install -y docker-ce=5:20.10.5~3-0~ubuntu-$(lsb_release -cs) kubelet=$kubernetes_version-00 kubeadm=$kubernetes_version-00 kubectl=$kubernetes_version-00 | |
sudo apt-mark hold docker-ce kubelet kubeadm kubectl | |
-if $overwrite_bins ; then | |
+if $overwrite_linux_bins ; then | |
echo "overwriting binaries ..." | |
for BIN in kubeadm kubectl kubelet | |
do | |
@@ -105,7 +113,11 @@ sudo docker pull k8s.gcr.io/coredns/coredns:v1.8.0 | |
sudo docker tag k8s.gcr.io/etcd:3.4.13-0 gcr.io/k8s-staging-ci-images/etcd:3.4.13-0 | |
sudo docker tag k8s.gcr.io/pause:3.4.1 gcr.io/k8s-staging-ci-images/pause:3.4.1 | |
sudo docker tag k8s.gcr.io/coredns/coredns:v1.8.0 gcr.io/k8s-staging-ci-images/coredns/coredns:v1.8.0 | |
-sudo kubeadm init --apiserver-advertise-address=10.20.30.10 --pod-network-cidr=10.244.0.0/16 --image-repository="gcr.io/k8s-staging-ci-images" --kubernetes-version="v1.22.0-alpha.3.31+a3abd06ad53b2f" --v=6 | |
+sudo kubeadm init --apiserver-advertise-address=10.20.30.10 \ | |
+--pod-network-cidr=10.244.0.0/16 \ | |
+--image-repository=$k8s_version_linux_registry \ | |
+--kubernetes-version=$k8s_version_linux_apiserver \ | |
+--v=6 | |
#to start the cluster with the current user: | |
mkdir -p $HOME/.kube | |
@@ -115,20 +127,7 @@ sudo chown $(id -u):$(id -g) $HOME/.kube/config | |
rm -f /var/sync/shared/config | |
cp $HOME/.kube/config /var/sync/shared/config | |
-# CNI: Not 100% tested, just a prototype... | |
-# Not used at all... probably should delete | |
-function cni_flannel { | |
- wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml -P /tmp -q | |
- ## this is important for windows: | |
- sed -i 's/"Type": "vxlan"/"Type": "vxlan","VNI": 4096,"Port": 4789/' /tmp/kube-flannel.yml | |
- kubectl apply -f /tmp/kube-flannel.yml | |
- | |
- curl -s -L https://github.com/kubernetes-sigs/sig-windows-tools/releases/latest/download/kube-proxy.yml | sed "s#VERSION#v$kubernetes_version#g" | kubectl apply -f - | |
- kubectl apply -f https://github.com/kubernetes-sigs/sig-windows-tools/releases/latest/download/flannel-overlay.yml | |
-} | |
- | |
function cni_antrea { | |
-# curl -s -L https://github.com/kubernetes-sigs/sig-windows-tools/releases/latest/download/kube-proxy.yml | sed "s#VERSION#v$kubernetes_version#g" | kubectl apply -f - | |
kubectl apply -f https://github.com/antrea-io/antrea/releases/download/v0.13.2/antrea.yml | |
} | |
diff --git a/sync/shared/kubejoin.ps1 b/sync/shared/kubejoin.ps1 | |
index e873b21..21f13ef 100644 | |
--- a/sync/shared/kubejoin.ps1 | |
+++ b/sync/shared/kubejoin.ps1 | |
@@ -1,3 +1,3 @@ | |
$env:path += ";C:\Program Files\containerd" | |
[Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::Machine) | |
-kubeadm join 10.20.30.10:6443 --cri-socket "npipe:////./pipe/containerd-containerd" --token xvufl4.cwao8gzg1i5prq3f --discovery-token-ca-cert-hash sha256:f980e7e73169e876b091304482b97bca2f6aeeae3c06d62936968a527ba0e2c8 | |
+kubeadm join 10.20.30.10:6443 --cri-socket "npipe:////./pipe/containerd-containerd" --token vn33of.7e3gwju6rx7q3dj3 --discovery-token-ca-cert-hash sha256:d06b177229ace7243c9595270a808a91c2a36b6430128a56aa4d5bd9b5a84577 | |
diff --git a/sync/shared/variables.yaml b/sync/shared/variables.yaml | |
index e8b0c1e..b0fdec4 100644 | |
--- a/sync/shared/variables.yaml | |
+++ b/sync/shared/variables.yaml | |
@@ -1,7 +1,26 @@ | |
kubelet_path: "./sync/windows/bin/kubelet.exe" | |
kubeproxy_path: "./sync/windows/bin/kube-proxy.exe" | |
-kubernetes_version_linux: "1.21.0" | |
+ | |
+# LINUX KUBELET VERSION | |
+# LINUX KUBEADM VERSION | |
+# The RPM versions of the kubelet pulled down remotely | |
+# from https://apt.kubernetes.io/ | |
+k8s_linux_registry: "gcr.io/k8s-staging-ci-images" | |
+k8s_linux_kubelet_deb: "1.21.0" | |
+k8s_linux_apiserver: "v1.22.0-alpha.3.31+a3abd06ad53b2f" | |
+ | |
+# WINDOWS KUBELET VERSION | |
+# This is the -KubernetesVersion sent to | |
+# The PrepareNode.ps1 script, which is maintained | |
+# by sig-windows. It determines what | |
+# WINDOWS KUBELET, KUBEADM we download. | |
kubernetes_version_windows: "1.21.0" | |
+ | |
+# kubernetes_version_build: this changes the branch that is fetched... | |
kubernetes_version_build: "1.21.0" | |
+ | |
+### THIS WILL OVERWRITE THE KUBEADM and KUBELET with LOCAL SOURCE | |
+# TODO make these explicit about what they are overwriting | |
+# Seperate kubelet from kubeadm | |
overwrite_linux_bins: false | |
overwrite_windows_bins: false | |
\ No newline at end of file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment