Skip to content

Commit

Permalink
feat(kind): add calico
Browse files Browse the repository at this point in the history
  • Loading branch information
mborne committed Oct 10, 2023
1 parent 4674b62 commit 8abe22f
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
26 changes: 26 additions & 0 deletions kind/calico/custom-resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This section includes base Calico installation configuration.
# For more information, see: https://projectcalico.docs.tigera.io/master/reference/installation/api#operator.tigera.io/v1.Installation
apiVersion: operator.tigera.io/v1
kind: Installation
metadata:
name: default
spec:
# Configures Calico networking.
calicoNetwork:
# Note: The ipPools section cannot be modified post-install.
ipPools:
- blockSize: 26
cidr: 10.244.0.0/16
encapsulation: VXLANCrossSubnet
natOutgoing: Enabled
nodeSelector: all()

---

# This section configures the Calico API server.
# For more information, see: https://projectcalico.docs.tigera.io/master/reference/installation/api#operator.tigera.io/v1.APIServer
apiVersion: operator.tigera.io/v1
kind: APIServer
metadata:
name: default
spec: {}
5 changes: 4 additions & 1 deletion kind/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ export DEVBOX_INGRESS=nginx
export OIDC_ISSUER_URL=https://keycloak.quadtreeworld.net/realms/master
# use a mirror for dockerhub
export DOCKERHUB_PROXY=https://docker-mirror.quadtreeworld.net
# use canal (flannel + calico) instead of default CNI to test NetworkPolicies

# Install custom CNI
#export DISABLE_DEFAULT_CNI=true
export USE_CANAL=1
#export USE_CALICO=1

# Delete cluster if exists
kind delete clusters devbox
Expand Down
22 changes: 21 additions & 1 deletion kind/quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ echo "-- kind/quickstart.sh"
echo "---------------------------------------------"

USE_CANAL=${USE_CANAL:-0}
if [ "$USE_CANAL" != "0" ];
USE_CALICO=${USE_CALICO:-0}
if [ "$USE_CANAL" != "0" ] || [ "$USE_CALICO" != "0" ];
then
export DISABLE_DEFAULT_CNI=true
fi
Expand All @@ -26,8 +27,27 @@ then
--for=condition=ready pod \
--selector=k8s-app=canal \
--timeout=90s

fi

#---------------------------------------------------------------------------
# Install calico
# see https://docs.tigera.io/calico/latest/getting-started/kubernetes/quickstart#install-calico
#---------------------------------------------------------------------------
if [ "$USE_CALICO" != "0" ];
then
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.1/manifests/tigera-operator.yaml
# wait for tigera-operator
kubectl wait --namespace tigera-operator \
--for=condition=ready pod \
--selector=k8s-app=tigera-operator \
--timeout=90s

# install calico with consistent pod subnet
kubectl apply -f ${SCRIPT_DIR}/calico/custom-resources.yaml
fi


#----------------------------------------
# Install metric-server
#----------------------------------------
Expand Down

0 comments on commit 8abe22f

Please sign in to comment.