From f1fb7a9a679a37ec727971d6562072b5fa4b287e Mon Sep 17 00:00:00 2001 From: cprivitere <23177737+cprivitere@users.noreply.github.com> Date: Fri, 8 Apr 2022 15:25:14 +0200 Subject: [PATCH] Further refinements to the templates. bgp sections are only for kube-vip, remove systemctl restart networking to avoid networking service error. Signed-off-by: Chris Privitere --- templates/cluster-template-crs-cni.yaml | 6 ------ templates/cluster-template.yaml | 6 ------ 2 files changed, 12 deletions(-) diff --git a/templates/cluster-template-crs-cni.yaml b/templates/cluster-template-crs-cni.yaml index 2e90299db..c1dda29f0 100644 --- a/templates/cluster-template-crs-cni.yaml +++ b/templates/cluster-template-crs-cni.yaml @@ -143,7 +143,6 @@ spec: address {{ .controlPlaneEndpoint }} netmask 255.255.255.255 EOF - systemctl restart networking if [ -f "/run/kubeadm/kubeadm.yaml" ]; then export KUBECONFIG=/etc/kubernetes/admin.conf export CPEM_YAML=https://github.com/equinix/cloud-provider-equinix-metal/releases/download/v3.4.0/deployment.yaml @@ -176,11 +175,6 @@ spec: TRIMMED_KUBERNETES_VERSION=$(echo {{ .kubernetesVersion }} | sed 's/\./\\\\./g' | sed 's/^v//') RESOLVED_KUBERNETES_VERSION=$(apt-cache madison kubelet | awk -v VERSION=$${TRIMMED_KUBERNETES_VERSION} '$3~ VERSION { print $3 }' | head -n1) DEBIAN_FRONTEND=noninteractive apt-get install -y containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION} - curl -o /run/metadata.json -fsSL https://metadata.platformequinix.com/metadata - for i in $(cat /run/metadata.json | jq -r '.bgp_neighbors[0].peer_ips[]'); do - ip route add $i via $(cat /run/metadata.json | jq -r '.network.addresses[] | select(.public == false and .address_family == 4) | .gateway') - done - rm /run/metadata.json ping -c 3 -q {{ .controlPlaneEndpoint }} && echo OK || ip addr add {{ .controlPlaneEndpoint }} dev lo machineTemplate: infrastructureRef: diff --git a/templates/cluster-template.yaml b/templates/cluster-template.yaml index d9dee6c22..c915d30ab 100644 --- a/templates/cluster-template.yaml +++ b/templates/cluster-template.yaml @@ -55,11 +55,6 @@ spec: TRIMMED_KUBERNETES_VERSION=$(echo {{ .kubernetesVersion }} | sed 's/\./\\\\./g' | sed 's/^v//') RESOLVED_KUBERNETES_VERSION=$(apt-cache madison kubelet | awk -v VERSION=$${TRIMMED_KUBERNETES_VERSION} '$3~ VERSION { print $3 }' | head -n1) DEBIAN_FRONTEND=noninteractive apt-get install -y containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION} - curl -o /run/metadata.json -fsSL https://metadata.platformequinix.com/metadata - for i in $(cat /run/metadata.json | jq -r '.bgp_neighbors[0].peer_ips[]'); do - ip route add $i via $(cat /run/metadata.json | jq -r '.network.addresses[] | select(.public == false and .address_family == 4) | .gateway') - done - rm /run/metadata.json ping -c 3 -q {{ .controlPlaneEndpoint }} && echo OK || ip addr add {{ .controlPlaneEndpoint }} dev lo postKubeadmCommands: - | @@ -69,7 +64,6 @@ spec: address {{ .controlPlaneEndpoint }} netmask 255.255.255.255 EOF - systemctl restart networking if [ -f "/run/kubeadm/kubeadm.yaml" ]; then export KUBECONFIG=/etc/kubernetes/admin.conf export CPEM_YAML=https://github.com/equinix/cloud-provider-equinix-metal/releases/download/v3.4.0/deployment.yaml