Skip to content

Commit

Permalink
Support calico for k8s 1.8 and above versions (ipdk-io#225)
Browse files Browse the repository at this point in the history
Signed-off-by: Neelakanta Venkatesh Petla <[email protected]>
  • Loading branch information
venkateshpnv authored Jun 24, 2024
1 parent 4fcf8ec commit ff5e9e4
Show file tree
Hide file tree
Showing 2 changed files with 5,004 additions and 3 deletions.
21 changes: 18 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ K8S_SECRET_MGR_SERVER?=manager-server-secret
K8S_SECRET_MGR_CLIENT?=manager-client-secret
K8S_SECRET_AGENT_CLIENT?=agent-client-secret
K8S_SECRET_SRC_DIR?=./scripts/tls/certs
TARGET_K8S_VER?=1.28

# KUBECONFIG_CM: ConfigMap with kubeconfig used by Infra Agent.
# If you change the ConfigMap name here dont forget to update the configMap
Expand Down Expand Up @@ -33,6 +34,7 @@ bindir=/opt/infra
sbindir=/sbin/infra
certdir=/etc/pki
jsonfiles=/share/infra/jsonfiles
host_k8s_ver=$(shell kubelet --version | awk '{print $$2}' | awk -F 'v' '{print $$2}')

RUNFILES:=$(logdir)/arp-proxy* $(logdir)/infra* $(cnidir)/infra* $(sysconfdir)/config.yaml $(datadir)
RUNFILES+=$(bindir)/felix-api* $(bindir)/infra* $(bindir)/arp-proxy*
Expand Down Expand Up @@ -161,12 +163,25 @@ undeploy: kustomize delete-kubeconfig-cm
rm -rf ${RUNFILES}

deploy-calico:
kubectl apply -f deploy/calico-with-grpc.yaml
@if [ $(host_k8s_ver) = $(TARGET_K8S_VER) ]; then \
kubectl apply -f deploy/calico-with-grpc-3.26.1.yaml ;\
elif [ "$(TARGET_K8S_VER)" = "`echo -e "$(host_k8s_ver)\n$(TARGET_K8S_VER)" | sort -V | head -n1`" ] ; then \
kubectl apply -f deploy/calico-with-grpc-3.26.1.yaml ;\
else \
kubectl apply -f deploy/calico-with-grpc.yaml ;\
fi
kubectl apply -f deploy/felix-configuration.yaml

undeploy-calico:
undeploy-calico:
kubectl delete -f deploy/felix-configuration.yaml
kubectl delete -f deploy/calico-with-grpc.yaml
@if [ $(host_k8s_ver) = $(TARGET_K8S_VER) ]; then \
kubectl delete -f deploy/calico-with-grpc-3.26.1.yaml ;\
elif [ "$(TARGET_K8S_VER)" = "`echo -e "$(host_k8s_ver)\n$(TARGET_K8S_VER)" | sort -V | head -n1`" ] ; then \
kubectl delete -f deploy/calico-with-grpc-3.26.1.yaml ;\
else \
echo "host version is less than target version."; \
kubectl delete -f deploy/calico-with-grpc.yaml ;\
fi

create-kubeconfig-cm:
@echo "Using kubeconfig file:$(KUBECONFIG)"
Expand Down
Loading

0 comments on commit ff5e9e4

Please sign in to comment.