Skip to content

Commit 8c74b5c

Browse files
committed
Calico deployment with Tigera Operator
Added Calico installation using 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 8c74b5c

File tree

3 files changed

+135
-5
lines changed

3 files changed

+135
-5
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,57 @@
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+
IMAGEPATH=${IMAGEPATH%/*}
14+
else
15+
REGISTRY=${_prefix}
16+
fi
17+
echo "Writing ${CHART_NAME} config"
18+
HELM_CHART_DIR="/srv/magnum/kubernetes/helm/calico"
19+
mkdir -p ${HELM_CHART_DIR}
20+
cat << EOF >> ${HELM_CHART_DIR}/values.yaml
21+
installation:
22+
flexVolumePath: /opt/kubernetes/kubelet-plugins/volume/exec/
23+
calicoNetwork:
24+
ipPools:
25+
- blockSize: 26
26+
cidr: ${CALICO_IPV4POOL}
27+
encapsulation: IPIP
28+
nodeAddressAutodetectionV4:
29+
cidrs:
30+
- '${CLUSTER_SUBNET_CIDR}'
31+
registry: ${REGISTRY}
32+
imagePath: ${IMAGEPATH}
33+
imagePrefix: "calico-"
34+
flexVolumePluginDir: /var/lib/kubelet/volumeplugins
35+
EOF
36+
echo "Waiting for Kubernetes API..."
37+
until [ "ok" = "$(kubectl get --raw='/healthz')" ]; do
38+
sleep 5
39+
done
40+
kubectl create namespace ${CHART_NAME}
41+
42+
helm_prepare_cmd="helm repo add projectcalico https://docs.tigera.io/calico/charts"
43+
helm_install_cmd="helm upgrade --install calico projectcalico/tigera-operator --version ${CALICO_TAG} -f values.yaml --namespace tigera-operator"
44+
helm_history_cmd="helm history calico --namespace tigera-operator"
45+
46+
if [[ -d "${HELM_CHART_DIR}" ]]; then
47+
pushd ${HELM_CHART_DIR}
48+
$helm_prepare_cmd
49+
i=0
50+
until ($helm_history_cmd | grep calico | grep deployed) || $helm_install_cmd; do
51+
i=$((i + 1))
52+
[ $i -lt 60 ] || break;
53+
sleep 5
54+
done
55+
popd
56+
fi
57+
fi

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

+20-4
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
@@ -1488,10 +1499,16 @@ resources:
14881499
- "source /etc/bashrc"
14891500
- get_file: ../../common/templates/kubernetes/fragments/kube-apiserver-to-kubelet-role.sh
14901501
- get_file: ../../common/templates/kubernetes/fragments/core-dns-service.sh
1502+
- get_file: ../../common/templates/kubernetes/fragments/install-helm.sh
14911503
- 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
1504+
- equals:
1505+
- get_param: calico_helm
1506+
- false
1507+
- if:
1508+
- calico_v3_26
1509+
- get_file: ../../common/templates/kubernetes/fragments/calico-service-v3-26-x.sh
1510+
- get_file: ../../common/templates/kubernetes/fragments/calico-service-v3-21-x.sh
1511+
- get_file: ../../common/templates/kubernetes/helm/calico-service.sh
14951512
- get_file: ../../common/templates/kubernetes/fragments/flannel-service.sh
14961513
- get_file: ../../common/templates/kubernetes/fragments/enable-helm-tiller.sh
14971514
- str_replace:
@@ -1512,7 +1529,6 @@ resources:
15121529
- get_file: ../../common/templates/kubernetes/fragments/enable-auto-scaling.sh
15131530
- get_file: ../../common/templates/kubernetes/fragments/enable-cinder-csi.sh
15141531
# Helm Based Installation Configuration Scripts
1515-
- get_file: ../../common/templates/kubernetes/fragments/install-helm.sh
15161532
- get_file: ../../common/templates/kubernetes/helm/metrics-server.sh
15171533
- str_replace:
15181534
template: {get_file: ../../common/templates/kubernetes/helm/prometheus-operator.sh}

0 commit comments

Comments
 (0)