Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cni): use our cni with calico #4801

Merged
merged 5 commits into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mk/e2e.new.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ endef

ifdef K3D
K8S_CLUSTER_TOOL=k3d
E2E_ENV_VARS += KUMA_K8S_TYPE=k3d
E2E_ENV_VARS += KUMA_K8S_TYPE=k3d-calico
else
K8S_CLUSTER_TOOL=kind
GINKGO_E2E_LABEL_FILTERS := $(call append_label_filter,!kind-not-supported)
Expand Down
22 changes: 22 additions & 0 deletions mk/k3d.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@ k3d/network/create:

.PHONY: k3d/start
k3d/start: ${KIND_KUBECONFIG_DIR} k3d/network/create
@echo "PORT_PREFIX=$(PORT_PREFIX)"
@KUBECONFIG=$(KIND_KUBECONFIG) \
k3d cluster create "$(KIND_CLUSTER_NAME)" \
-i rancher/k3s:$(CI_K3S_VERSION) \
--k3s-arg '--no-deploy=traefik@server:0' \
--k3s-arg '--flannel-backend=none@server:*' \
--volume "/tmp/calico.yaml:/var/lib/rancher/k3s/server/manifests/calico.yaml" \
slonka marked this conversation as resolved.
Show resolved Hide resolved
--k3s-arg '--disable=metrics-server@server:0' \
--network kind \
--port "$(PORT_PREFIX)80-$(PORT_PREFIX)89:30080-30089@server:0" \
--timeout 120s && \
$(MAKE) k3d/wait
@echo
@echo '>>> You need to manually run the following command in your shell: >>>'
@echo
@echo export KUBECONFIG="$(KIND_KUBECONFIG)"
@echo
@echo '<<< ------------------------------------------------------------- <<<'
@echo

.PHONY: k3d-flannel/start
k3d-flannel/start: ${KIND_KUBECONFIG_DIR} k3d/network/create
@echo "PORT_PREFIX=$(PORT_PREFIX)"
@KUBECONFIG=$(KIND_KUBECONFIG) \
k3d cluster create "$(KIND_CLUSTER_NAME)" \
Expand Down
7 changes: 7 additions & 0 deletions test/framework/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ func (c E2eConfig) AutoConfigure() error {
NetDir: "/var/lib/rancher/k3s/agent/etc/cni/net.d",
BinDir: "/bin",
}
case K3dCalicoK8sType:
Config.CNIConf = CniConf{
ConfName: "10-calico.conflist",
NetDir: "/etc/cni/net.d/",
BinDir: "/opt/cni/bin",
}
case AzureK8sType:
Config.CNIConf = CniConf{
ConfName: "10-azure.conflist",
Expand Down Expand Up @@ -121,6 +127,7 @@ type K8sType string
const (
KindK8sType K8sType = "kind"
K3dK8sType K8sType = "k3d"
K3dCalicoK8sType K8sType = "k3d-calico"
AzureK8sType K8sType = "azure"
AwsK8sType K8sType = "aws"
)
Expand Down
6 changes: 3 additions & 3 deletions test/framework/k8s_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ func (c *K8sCluster) SetCP(cp *K8sControlPlane) {
// warning: there seems to be a bug in k3s1 v1.19.16 so that each tests needs a unique node name
func (c *K8sCluster) CreateNode(name string, label string) error {
switch Config.K8sType {
case K3dK8sType:
case K3dK8sType, K3dCalicoK8sType:
createCmd := exec.Command("k3d", "node", "create", name, "-c", c.name, "--k3s-node-label", label)
createCmd.Stdout = os.Stdout
return createCmd.Run()
Expand All @@ -1159,7 +1159,7 @@ func (c *K8sCluster) CreateNode(name string, label string) error {

func (c *K8sCluster) LoadImages(names ...string) error {
switch Config.K8sType {
case K3dK8sType:
case K3dK8sType, K3dCalicoK8sType:
version := kuma_version.Build.Version

var fullImageNames []string
Expand All @@ -1182,7 +1182,7 @@ func (c *K8sCluster) LoadImages(names ...string) error {

func (c *K8sCluster) DeleteNode(name string) error {
switch Config.K8sType {
case K3dK8sType:
case K3dK8sType, K3dCalicoK8sType:
err := c.DeleteNodeViaApi(name)
if err != nil {
return err
Expand Down
Loading