Skip to content

Apply different CNI to e2e test #8

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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: 2 additions & 0 deletions test/e2e/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const (
KubernetesVersion = "KUBERNETES_VERSION"
CNIPath = "CNI"
CNIResources = "CNI_RESOURCES"
CNIPath2 = "CNI2"
CNIResources2 = "CNI_RESOURCES2"
KubernetesVersionUpgradeFrom = "KUBERNETES_VERSION_UPGRADE_FROM"
KubernetesVersionUpgradeTo = "KUBERNETES_VERSION_UPGRADE_TO"
EtcdVersionUpgradeTo = "ETCD_VERSION_UPGRADE_TO"
Expand Down
1 change: 1 addition & 0 deletions test/e2e/config/docker-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ variables:
DOCKER_POD_CIDRS: "192.168.0.0/16"
#CNI: "./data/cni/calico/calico.yaml"
CNI: "./data/cni/kindnet/kindnet.yaml"
CNI2: "./data/cni/kindnet/kindnet2.yaml"
EXP_CLUSTER_RESOURCE_SET: "true"

intervals:
Expand Down
113 changes: 113 additions & 0 deletions test/e2e/data/cni/kindnet/kindnet2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# kindnetd networking manifest
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kindnet
rules:
- apiGroups:
- policy
resources:
- podsecuritypolicies
verbs:
- use
resourceNames:
- kindnet
- apiGroups:
- ""
resources:
- nodes
verbs:
- list
- watch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kindnet
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kindnet
subjects:
- kind: ServiceAccount
name: kindnet
namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kindnet
namespace: kube-system
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: kindnet
namespace: kube-system
labels:
tier: node
app: kindnet
k8s-app: kindnet
spec:
selector:
matchLabels:
app: kindnet
template:
metadata:
labels:
tier: node
app: kindnet
k8s-app: kindnet
spec:
hostNetwork: true
tolerations:
- operator: Exists
effect: NoSchedule
serviceAccountName: kindnet
containers:
- name: kindnet-cni
image: kindest/kindnetd:0.5.4
env:
- name: HOST_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: POD_SUBNET
value: "192.168.0.0/16"
volumeMounts:
- name: cni-cfg
mountPath: /etc/cni/net.d
- name: xtables-lock
mountPath: /run/xtables.lock
readOnly: false
- name: lib-modules
mountPath: /lib/modules
readOnly: true
resources:
requests:
cpu: "100m"
memory: "50Mi"
limits:
cpu: "100m"
memory: "50Mi"
securityContext:
privileged: false
capabilities:
add: ["NET_RAW", "NET_ADMIN"]
volumes:
- name: cni-cfg
hostPath:
path: /etc/cni/net.d
- name: xtables-lock
hostPath:
path: /run/xtables.lock
type: FileOrCreate
- name: lib-modules
hostPath:
path: /lib/modules
---
2 changes: 1 addition & 1 deletion test/e2e/data/infrastructure-docker/cluster-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: "cni-${CLUSTER_NAME}-crs-0"
data: ${CNI_RESOURCES}
data: ${CNI_RESOURCES2}
---
apiVersion: addons.cluster.x-k8s.io/v1alpha3
kind: ClusterResourceSet
Expand Down
9 changes: 6 additions & 3 deletions test/e2e/quick_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ package e2e
import (
"context"
"fmt"
"os"
"path/filepath"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"os"
"path/filepath"

corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
Expand Down Expand Up @@ -72,6 +71,10 @@ func QuickStartSpec(ctx context.Context, inputGetter func() QuickStartSpecInput)

By("Creating a workload cluster")

// Read CNI file and set CNI_RESOURCES environmental variable
Expect(input.E2EConfig.Variables).To(HaveKey(CNIPath2), "Missing %s variable in the config", CNIPath2)
clusterctl.SetCNIEnvVar(input.E2EConfig.GetVariable(CNIPath2), CNIResources2)

cluster, _, _ = clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
ClusterProxy: input.BootstrapClusterProxy,
ConfigCluster: clusterctl.ConfigClusterInput{
Expand Down