Skip to content

Commit

Permalink
run make generate
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Privitere <cprivite@users.noreply.github.com>
  • Loading branch information
cprivitere authored and davidspek committed Apr 11, 2022
1 parent 857424f commit 277e4a4
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions templates/cluster-template-crs-cni.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec:
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
apt-get update -y
TRIMMED_KUBERNETES_VERSION=$(echo {{ .kubernetesVersion }} | sed 's/\./\\./g' | sed 's/^v//')
TRIMMED_KUBERNETES_VERSION=$(echo {{ .kubernetesVersion }} | sed 's/\./\\\\./g' | sed 's/^v//')
RESOLVED_KUBERNETES_VERSION=$(apt-cache policy kubelet | awk -v VERSION=$${TRIMMED_KUBERNETES_VERSION} '$1~ VERSION { print $1 }' | head -n1)
DEBIAN_FRONTEND=noninteractive apt-get install -y containerd kubelet=$${RESOLVED_KUBERNETES_VERSION} kubeadm=$${RESOLVED_KUBERNETES_VERSION} kubectl=$${RESOLVED_KUBERNETES_VERSION}
---
Expand Down Expand Up @@ -130,17 +130,23 @@ spec:
provider-id: equinixmetal://{{ `{{ v1.instance_id }}` }}
joinConfiguration:
nodeRegistration:
ignorePreflightErrors:
- DirAvailable--etc-kubernetes-manifests
ignorePreflightErrors: []
kubeletExtraArgs:
cloud-provider: external
provider-id: equinixmetal://{{ `{{ v1.instance_id }}` }}
postKubeadmCommands:
- |
cat <<EOF >> /etc/network/interfaces
auto lo:0
iface lo:0 inet static
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
export SECRET_DATA='cloud-sa.json=''{"apiKey": "{{ .apiKey }}","projectID": "${PROJECT_ID}", "loadbalancer": "kube-vip://", "facility": "${FACILITY}"}'''
export SECRET_DATA='cloud-sa.json=''{"apiKey": "{{ .apiKey }}","projectID": "${PROJECT_ID}", "eipTag": "cluster-api-provider-packet:cluster-id:${CLUSTER_NAME}", "eipHealthCheckUseHostIP": true}'''
kubectl create secret generic -n kube-system metal-cloud-config --from-literal="$${SECRET_DATA}" || (sleep 1 && kubectl create secret generic -n kube-system metal-cloud-config --from-literal="$${SECRET_DATA}") || (sleep 1 && kubectl create secret generic -n kube-system metal-cloud-config --from-literal="$${SECRET_DATA}")
kubectl apply -f $${CPEM_YAML} || (sleep 1 && kubectl apply -f $${CPEM_YAML}) || (sleep 1 && kubectl apply -f $${CPEM_YAML})
fi
Expand Down Expand Up @@ -169,23 +175,7 @@ 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
KVVERSION="${KUBE_VIP_VERSION:=v0.4.2}"
ctr image pull ghcr.io/kube-vip/kube-vip:$${KVVERSION}
ctr run --rm --net-host ghcr.io/kube-vip/kube-vip:$KVVERSION vip /kube-vip manifest pod \
--interface "lo" \
--vip "{{ .controlPlaneEndpoint }}" \
--controlplane \
--services \
--bgp \
--peerAS $(cat /run/metadata.json | jq -r '.bgp_neighbors[0].peer_as') \
--peerAddress $(cat /run/metadata.json | jq -r '.bgp_neighbors[0].peer_ips[0]') \
--localAS $(cat /run/metadata.json | jq -r '.bgp_neighbors[0].customer_as') \
--bgpRouterID $(cat /run/metadata.json | jq -r '.bgp_neighbors[0].customer_ip') > /etc/kubernetes/manifests/vip.yaml
rm /run/metadata.json
ping -c 3 -q {{ .controlPlaneEndpoint }} && echo OK || ip addr add {{ .controlPlaneEndpoint }} dev lo
machineTemplate:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
Expand Down

0 comments on commit 277e4a4

Please sign in to comment.