forked from openstack/magnum
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
3 changed files
with
137 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
magnum/drivers/common/templates/kubernetes/helm/calico-service.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
set +x | ||
. /etc/sysconfig/heat-params | ||
set -ex | ||
|
||
CHART_NAME="tigera-operator" | ||
|
||
if [ "$NETWORK_DRIVER" = "calico" ]; then | ||
#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 | ||
_prefix=${CONTAINER_INFRA_PREFIX:-quay.io/} | ||
if [[ "${_prefix}" =~ .+/.+ ]]; then | ||
REGISTRY=${_prefix%%/*}/ | ||
IMAGEPATH=${_prefix##*/} | ||
else | ||
REGISTRY=${_prefix} | ||
fi | ||
echo "Writing ${CHART_NAME} config" | ||
HELM_CHART_DIR="/srv/magnum/kubernetes/helm/calico" | ||
mkdir -p ${HELM_CHART_DIR} | ||
cat << EOF >> ${HELM_CHART_DIR}/values.yaml | ||
installation: | ||
flexVolumePath: /opt/kubernetes/kubelet-plugins/volume/exec/ | ||
calicoNetwork: | ||
ipPools: | ||
- blockSize: 26 | ||
cidr: ${CALICO_IPV4POOL} | ||
encapsulation: IPIP | ||
nodeAddressAutodetectionV4: | ||
cidrs: | ||
- '${CLUSTER_SUBNET_CIDR}' | ||
registry: ${REGISTRY} | ||
imagePath: ${IMAGEPATH} | ||
flexVolumePluginDir: /var/lib/kubelet/volumeplugins | ||
EOF | ||
echo "Waiting for Kubernetes API..." | ||
until [ "ok" = "$(kubectl get --raw='/healthz')" ]; do | ||
sleep 5 | ||
done | ||
kubectl create namespace ${CHART_NAME} | ||
|
||
helm_prepare_cmd="helm repo add projectcalico https://docs.tigera.io/calico/charts" | ||
helm_install_cmd="helm upgrade --install calico projectcalico/tigera-operator --version ${CALICO_TAG} -f values.yaml --namespace tigera-operator" | ||
helm_history_cmd="helm history calico --namespace tigera-operator" | ||
|
||
if [[ -d "${HELM_CHART_DIR}" ]]; then | ||
pushd ${HELM_CHART_DIR} | ||
$helm_prepare_cmd | ||
i=0 | ||
until ($helm_history_cmd | grep calico | grep deployed) || $helm_install_cmd; do | ||
i=$((i + 1)) | ||
[ $i -lt 60 ] || break; | ||
sleep 5 | ||
done | ||
popd | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters