Skip to content

Commit 787a52a

Browse files
authored
Revert "Upgrade to calico 3.29 and use windows support (#5523)"
This reverts commit db8c747.
1 parent 31fcaaa commit 787a52a

File tree

60 files changed

+12287
-7534
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+12287
-7534
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,8 @@ generate-e2e-templates: $(KUSTOMIZE) ## Generate Azure infrastructure templates
536536
generate-addons: fetch-calico-manifests ## Generate metric-server, calico, calico-ipv6, azure cni v1 addons.
537537
$(KUSTOMIZE) build $(ADDONS_DIR)/metrics-server > $(ADDONS_DIR)/metrics-server/metrics-server.yaml
538538
$(KUSTOMIZE) build $(ADDONS_DIR)/calico > $(ADDONS_DIR)/calico.yaml
539-
$(KUSTOMIZE) build $(ADDONS_DIR)/metrics-server > $(ADDONS_DIR)/metrics-server/metrics-server.yaml
539+
$(KUSTOMIZE) build $(ADDONS_DIR)/calico-ipv6 > $(ADDONS_DIR)/calico-ipv6.yaml
540+
$(KUSTOMIZE) build $(ADDONS_DIR)/calico-dual-stack > $(ADDONS_DIR)/calico-dual-stack.yaml
540541
$(KUSTOMIZE) build $(ADDONS_DIR)/azure-cni-v1 > $(ADDONS_DIR)/azure-cni-v1.yaml
541542

542543
.PHONY: generate-aso-crds
@@ -551,7 +552,7 @@ generate-aso-crds: $(YQ)
551552
> $(ASO_CRDS_PATH)
552553

553554
# When updating this, make sure to also update the Windows image version in templates/addons/windows/calico.
554-
export CALICO_VERSION := v3.29.4
555+
export CALICO_VERSION := v3.26.1
555556
# Where all downloaded Calico manifests are unpacked and stored.
556557
CALICO_RELEASES := $(ARTIFACTS)/calico
557558
# Path to manifests directory in a Calico release archive.

Tiltfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,15 @@ def deploy_worker_templates(template, substitutions):
469469
echo "API Server of ${CLUSTER_NAME} is accessible";
470470
'''
471471

472+
# copy the kubeadm configmap to the calico-system namespace.
473+
# This is a workaround needed for the calico-node-windows daemonset to be able to run in the calico-system namespace.
474+
if "windows" in flavor_name:
475+
flavor_cmd += """
476+
until """ + kubectl_cmd + """ --kubeconfig ./${CLUSTER_NAME}.kubeconfig get configmap kubeadm-config --namespace=kube-system > /dev/null 2>&1; do sleep 5; done;
477+
""" + kubectl_cmd + """ --kubeconfig ./${CLUSTER_NAME}.kubeconfig create namespace calico-system --dry-run=client -o yaml | """ + kubectl_cmd + """ --kubeconfig ./${CLUSTER_NAME}.kubeconfig apply -f -;
478+
""" + kubectl_cmd + """ --kubeconfig ./${CLUSTER_NAME}.kubeconfig get configmap kubeadm-config --namespace=kube-system -o yaml | sed 's/namespace: kube-system/namespace: calico-system/' | """ + kubectl_cmd + """ --kubeconfig ./${CLUSTER_NAME}.kubeconfig apply -f -;
479+
"""
480+
472481
if "aks_as_mgmt_settings" in settings and needs_vnet_peering(flavor_name):
473482
flavor_cmd += create_private_dns_zone()
474483

docs/book/src/self-managed/addons.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ helm repo add projectcalico https://docs.tigera.io/calico/charts && \
6363
helm install calico projectcalico/tigera-operator --version v3.26.1 -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-azure/main/templates/addons/calico-dual-stack/values.yaml --set-string "installation.calicoNetwork.ipPools[0].cidr=${IPV4_CIDR_BLOCK}","installation.calicoNetwork.ipPools[1].cidr=${IPV6_CIDR_BLOCK}" --namespace tigera-operator --create-namespace
6464
```
6565

66+
<aside class="note">
67+
68+
<h1> Note </h1>
69+
70+
For Windows nodes, you also need to copy the kubeadm-config configmap to the calico-system namespace so the calico-node-windows Daemonset can find it:
71+
72+
```bash
73+
kubectl create ns calico-system
74+
kubectl get configmap kubeadm-config --namespace=kube-system -o yaml \
75+
| sed 's/namespace: kube-system/namespace: calico-system/' \
76+
| kubectl create -f -
77+
```
78+
79+
</aside>
80+
6681
For more information, see the [official Calico documentation](https://projectcalico.docs.tigera.io/getting-started/kubernetes/helm).
6782

6883
## Flannel

scripts/ci-configmap.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
# Copyright 2022 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
22+
KUBECTL="${REPO_ROOT}/hack/tools/bin/kubectl"
23+
make --directory="${REPO_ROOT}" "${KUBECTL##*/}"
24+
25+
CM_NAMES=("calico-addon" "calico-ipv6-addon" "calico-dual-stack-addon" "calico-windows-addon")
26+
CM_FILES=("calico.yaml" "calico-ipv6.yaml" "calico-dual-stack.yaml" "windows/calico")
27+
for i in "${!CM_NAMES[@]}"; do
28+
"${KUBECTL}" create configmap "${CM_NAMES[i]}" --from-file="${REPO_ROOT}/templates/addons/${CM_FILES[i]}" --dry-run=client -o yaml | kubectl apply -f -
29+
done

scripts/ci-entrypoint.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,29 @@ create_cluster() {
146146
export KUBE_SSH_USER
147147
}
148148

149+
# copy_kubeadm_config_map copies the kubeadm configmap into the calico-system namespace.
150+
# any retryable operation in this function must return a non-zero exit code on failure so that we can
151+
# retry it using a `until copy_kubeadm_config_map; do sleep 5; done` pattern;
152+
# and any statement must be idempotent so that subsequent retry attempts can make forward progress.
153+
copy_kubeadm_config_map() {
154+
# Copy the kubeadm configmap to the calico-system namespace.
155+
# This is a workaround needed for the calico-node-windows daemonset
156+
# to be able to run in the calico-system namespace.
157+
# First, validate that the kubeadm-config configmap has been created.
158+
"${KUBECTL}" get configmap kubeadm-config --namespace=kube-system -o yaml || return 1
159+
"${KUBECTL}" create namespace calico-system --dry-run=client -o yaml | kubectl apply -f - || return 1
160+
if ! "${KUBECTL}" get configmap kubeadm-config --namespace=calico-system; then
161+
"${KUBECTL}" get configmap kubeadm-config --namespace=kube-system -o yaml | sed 's/namespace: kube-system/namespace: calico-system/' | "${KUBECTL}" apply -f - || return 1
162+
fi
163+
}
164+
165+
wait_for_copy_kubeadm_config_map() {
166+
echo "Copying kubeadm ConfigMap into calico-system namespace"
167+
until copy_kubeadm_config_map; do
168+
sleep 5
169+
done
170+
}
171+
149172
# wait_for_nodes returns when all nodes in the workload cluster are Ready.
150173
wait_for_nodes() {
151174
echo "Waiting for ${CONTROL_PLANE_MACHINE_COUNT} control plane machine(s), ${WORKER_MACHINE_COUNT} worker machine(s), and ${WINDOWS_WORKER_MACHINE_COUNT:-0} windows machine(s) to become Ready"
@@ -183,6 +206,8 @@ wait_for_pods() {
183206
}
184207

185208
install_addons() {
209+
export -f copy_kubeadm_config_map wait_for_copy_kubeadm_config_map
210+
timeout --foreground 600 bash -c wait_for_copy_kubeadm_config_map
186211
# In order to determine the successful outcome of CNI and cloud-provider-azure,
187212
# we need to wait a little bit for nodes and pods terminal state,
188213
# so we block successful return upon the cluster being fully operational.

0 commit comments

Comments
 (0)