Skip to content

Commit 0e89d6e

Browse files
committed
Calico deployment with Tigera Operator
Switched Calico installation to Helm charts - Tigera Operator. Added necessary port opening. Depends-On: https://review.opendev.org/c/openstack/magnum-tempest-plugin/+/909444 Change-Id: I9e0cba930b70643bf19595f7cb544bc982ca027a
1 parent 1129c2e commit 0e89d6e

File tree

3 files changed

+137
-4
lines changed

3 files changed

+137
-4
lines changed

Diff for: .zuul.yaml

+58-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,61 @@
4747
post-run: playbooks/container-publish.yaml
4848
secrets:
4949
- magnum_docker_login
50-
timeout: 2400
50+
timeout: 7200
51+
52+
- job:
53+
name: magnum-tempest-plugin-tests-cluster-k8s_fcos_v1-1.27
54+
parent: magnum-tempest-plugin-tests-cluster-k8s_fcos_v1
55+
vars:
56+
devstack_localrc:
57+
MAGNUM_KUBECTL_TAG: v1.27.8
58+
devstack_local_conf:
59+
test-config:
60+
$TEMPEST_CONFIG:
61+
magnum:
62+
labels:
63+
kube_tag: v1.27.8-rancher2
64+
container_runtime: containerd
65+
containerd_version: 1.6.28
66+
containerd_tarball_sha256: f70736e52d61e5ad225f4fd21643b5ca1220013ab8b6c380434caeefb572da9b
67+
cloud_provider_tag: v1.27.3
68+
cinder_csi_plugin_tag: v1.27.3
69+
k8s_keystone_auth_tag: v1.27.3
70+
magnum_auto_healer_tag: v1.27.3
71+
octavia_ingress_controller_tag: v1.27.3
72+
73+
- job:
74+
name: magnum-tempest-plugin-tests-cluster-k8s_fcos_v1-1.27-calico
75+
parent: magnum-tempest-plugin-tests-cluster-k8s_fcos_v1-1.27
76+
vars:
77+
devstack_local_conf:
78+
test-config:
79+
$TEMPEST_CONFIG:
80+
magnum:
81+
network_driver: calico
82+
83+
- job:
84+
name: magnum-tempest-plugin-tests-cluster-k8s_fcos_v1-1.27-calico-helm
85+
parent: magnum-tempest-plugin-tests-cluster-k8s_fcos_v1-1.27
86+
vars:
87+
devstack_local_conf:
88+
test-config:
89+
$TEMPEST_CONFIG:
90+
magnum:
91+
network_driver: calico
92+
labels:
93+
calico_helm: true
94+
95+
96+
- job:
97+
name: magnum-tempest-plugin-tests-cluster-k8s_fcos_v1-1.27-flannel
98+
parent: magnum-tempest-plugin-tests-cluster-k8s_fcos_v1-1.27
99+
vars:
100+
devstack_local_conf:
101+
test-config:
102+
$TEMPEST_CONFIG:
103+
magnum:
104+
network_driver: flannel
51105

52106
- project:
53107
queue: magnum
@@ -60,6 +114,9 @@
60114
check:
61115
jobs:
62116
- magnum-tempest-plugin-tests-api
117+
- magnum-tempest-plugin-tests-cluster-k8s_fcos_v1-1.27-flannel
118+
- magnum-tempest-plugin-tests-cluster-k8s_fcos_v1-1.27-calico
119+
- magnum-tempest-plugin-tests-cluster-k8s_fcos_v1-1.27-calico-helm
63120
- magnum-container-build
64121
gate:
65122
jobs:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
set +x
2+
. /etc/sysconfig/heat-params
3+
set -ex
4+
5+
CHART_NAME="tigera-operator"
6+
7+
if [ "$NETWORK_DRIVER" = "calico" ]; then
8+
#NOTE(mnasiadka): Split infra_prefix to registry and imagePath as per https://docs.tigera.io/calico/latest/reference/installation/api#operator.tigera.io/v1.Installation
9+
_prefix=${CONTAINER_INFRA_PREFIX:-quay.io/}
10+
if [[ "${_prefix}" =~ .+/.+ ]]; then
11+
REGISTRY=${_prefix%%/*}/
12+
IMAGEPATH=${_prefix##*/}
13+
else
14+
REGISTRY=${_prefix}
15+
fi
16+
echo "Writing ${CHART_NAME} config"
17+
HELM_CHART_DIR="/srv/magnum/kubernetes/helm/calico"
18+
mkdir -p ${HELM_CHART_DIR}
19+
cat << EOF >> ${HELM_CHART_DIR}/values.yaml
20+
installation:
21+
flexVolumePath: /opt/kubernetes/kubelet-plugins/volume/exec/
22+
calicoNetwork:
23+
ipPools:
24+
- blockSize: 26
25+
cidr: ${CALICO_IPV4POOL}
26+
encapsulation: IPIP
27+
nodeAddressAutodetectionV4:
28+
cidrs:
29+
- '${CLUSTER_SUBNET_CIDR}'
30+
registry: ${REGISTRY}
31+
imagePath: ${IMAGEPATH}
32+
flexVolumePluginDir: /var/lib/kubelet/volumeplugins
33+
EOF
34+
echo "Waiting for Kubernetes API..."
35+
until [ "ok" = "$(kubectl get --raw='/healthz')" ]; do
36+
sleep 5
37+
done
38+
kubectl create namespace ${CHART_NAME}
39+
40+
helm_prepare_cmd="helm repo add projectcalico https://docs.tigera.io/calico/charts"
41+
helm_install_cmd="helm upgrade --install calico projectcalico/tigera-operator --version ${CALICO_TAG} -f values.yaml --namespace tigera-operator"
42+
helm_history_cmd="helm history calico --namespace tigera-operator"
43+
44+
if [[ -d "${HELM_CHART_DIR}" ]]; then
45+
pushd ${HELM_CHART_DIR}
46+
$helm_prepare_cmd
47+
i=0
48+
until ($helm_history_cmd | grep calico | grep deployed) || $helm_install_cmd; do
49+
i=$((i + 1))
50+
[ $i -lt 60 ] || break;
51+
sleep 5
52+
done
53+
popd
54+
fi
55+
fi

Diff for: magnum/drivers/k8s_fedora_coreos_v1/templates/kubecluster.yaml

+24-3
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,13 @@ parameters:
10621062
tag of the k8s.gcr.io/sig-storage/liveness-probe container
10631063
default: v2.5.0
10641064

1065+
calico_helm:
1066+
type: boolean
1067+
description: >
1068+
If true, use Helm for Calico deployment otherwise, use
1069+
static Calico manifest' to the end of description
1070+
default: false
1071+
10651072
resources:
10661073

10671074
######################################################################
@@ -1132,6 +1139,10 @@ resources:
11321139
- protocol: tcp
11331140
port_range_min: 179
11341141
port_range_max: 179
1142+
# Calico - Typha
1143+
- protocol: tcp
1144+
port_range_min: 5473
1145+
port_range_max: 5473
11351146
- protocol: tcp
11361147
port_range_min: 7080
11371148
port_range_max: 7080
@@ -1489,9 +1500,14 @@ resources:
14891500
- get_file: ../../common/templates/kubernetes/fragments/kube-apiserver-to-kubelet-role.sh
14901501
- get_file: ../../common/templates/kubernetes/fragments/core-dns-service.sh
14911502
- if:
1492-
- calico_v3_26
1493-
- get_file: ../../common/templates/kubernetes/fragments/calico-service-v3-26-x.sh
1494-
- get_file: ../../common/templates/kubernetes/fragments/calico-service-v3-21-x.sh
1503+
- equals:
1504+
- get_param: calico_helm
1505+
- "false"
1506+
- if:
1507+
- calico_v3_26
1508+
- get_file: ../../common/templates/kubernetes/fragments/calico-service-v3-26-x.sh
1509+
- get_file: ../../common/templates/kubernetes/fragments/calico-service-v3-21-x.sh
1510+
- get_file: ../../common/templates/kubernetes/helm/calico-service.sh
14951511
- get_file: ../../common/templates/kubernetes/fragments/flannel-service.sh
14961512
- get_file: ../../common/templates/kubernetes/fragments/enable-helm-tiller.sh
14971513
- str_replace:
@@ -1513,6 +1529,11 @@ resources:
15131529
- get_file: ../../common/templates/kubernetes/fragments/enable-cinder-csi.sh
15141530
# Helm Based Installation Configuration Scripts
15151531
- get_file: ../../common/templates/kubernetes/fragments/install-helm.sh
1532+
- if:
1533+
- equals:
1534+
- get_param: calico_helm
1535+
- "true"
1536+
- get_file: ../../common/templates/kubernetes/helm/calico-service.sh
15161537
- get_file: ../../common/templates/kubernetes/helm/metrics-server.sh
15171538
- str_replace:
15181539
template: {get_file: ../../common/templates/kubernetes/helm/prometheus-operator.sh}

0 commit comments

Comments
 (0)