forked from kubeovn/kube-ovn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.e2e
188 lines (162 loc) · 6.87 KB
/
Makefile.e2e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
E2E_BUILD_FLAGS = -ldflags "-w -s"
KUBECONFIG = $(shell echo $${KUBECONFIG:-$(HOME)/.kube/config})
E2E_BRANCH := $(shell echo $${E2E_BRANCH:-master})
E2E_IP_FAMILY := $(shell echo $${E2E_IP_FAMILY:-ipv4})
E2E_NETWORK_MODE := $(shell echo $${E2E_NETWORK_MODE:-overlay})
E2E_CILIUM_CHAINING = $(shell echo $${E2E_CILIUM_CHAINING:-false})
K8S_CONFORMANCE_E2E_FOCUS = "sig-network.*Conformance" "sig-network.*Feature:NoSNAT"
K8S_CONFORMANCE_E2E_SKIP =
K8S_NETPOL_E2E_FOCUS = "sig-network.*Feature:NetworkPolicy"
K8S_NETPOL_E2E_SKIP = "sig-network.*NetworkPolicyLegacy"
K8S_NETPOL_LEGACY_E2E_FOCUS = "sig-network.*NetworkPolicyLegacy"
GINKGO_PARALLEL_MULTIPLIER = $(shell echo $${GINKGO_PARALLEL_MULTIPLIER:-2})
ifeq ($(shell echo $(E2E_BRANCH) | grep -o ^release-),release-)
VERSION_NUM = $(subst release-,,$(E2E_BRANCH))
VER_MAJOR = $(shell echo $(VERSION_NUM) | cut -f1 -d.)
VER_MINOR = $(shell echo $(VERSION_NUM) | cut -f2 -d.)
ifeq ($(shell test $(VER_MAJOR) -lt 1 -o \( $(VER_MAJOR) -eq 1 -a $(VER_MINOR) -lt 12 \) && echo true),true)
K8S_CONFORMANCE_E2E_SKIP += "sig-network.*Services.*session affinity"
else
K8S_CONFORMANCE_E2E_FOCUS += "sig-network.*Networking.*Feature:SCTPConnectivity"
endif
else
K8S_CONFORMANCE_E2E_FOCUS += "sig-network.*Networking.*Feature:SCTPConnectivity"
endif
ifneq ($(E2E_IP_FAMILY),ipv6)
K8S_CONFORMANCE_E2E_FOCUS += "sig-network.*Feature:Networking-IPv4"
ifeq ($(E2E_NETWORK_MODE),overlay)
K8S_CONFORMANCE_E2E_FOCUS += "sig-network.*Feature:Networking-DNS"
endif
endif
ifeq ($(E2E_IP_FAMILY),dual)
K8S_CONFORMANCE_E2E_FOCUS += "sig-network.*Feature:IPv6DualStack"
endif
ifeq ($(E2E_CILIUM_CHAINING),true)
K8S_CONFORMANCE_E2E_SKIP += "sig-network.*Networking.*Feature:SCTPConnectivity"
endif
GINKGO_PARALLEL_OPT = -p
ifeq ($(shell echo $${CI:-false}),true)
GINKGO_PARALLEL_OPT = --procs $$(($$(nproc) * $(GINKGO_PARALLEL_MULTIPLIER)))
endif
define ginkgo_option
--$(1)=$(shell echo '$(2)' | sed -E 's/^[[:space:]]+//' | sed -E 's/"[[:space:]]+"/" --$(1)="/g')
endef
.PHONY: e2e
e2e: kube-ovn-conformance-e2e
.PHONY: e2e-build
e2e-build:
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/k8s-network
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/kube-ovn
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/ovn-ic
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/lb-svc
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/iptables-vpc-nat-gw
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/ovn-vpc-nat-gw
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/security
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/kubevirt
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/webhook
.PHONY: k8s-conformance-e2e
k8s-conformance-e2e:
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/k8s-network
ginkgo $(GINKGO_PARALLEL_OPT) --randomize-all -v --timeout=1h \
$(call ginkgo_option,focus,$(K8S_CONFORMANCE_E2E_FOCUS)) \
$(call ginkgo_option,skip,$(K8S_CONFORMANCE_E2E_SKIP)) \
./test/e2e/k8s-network/k8s-network.test
.PHONY: k8s-netpol-legacy-e2e
k8s-netpol-legacy-e2e:
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/k8s-network
ginkgo $(GINKGO_PARALLEL_OPT) --randomize-all -v --timeout=2h \
$(call ginkgo_option,focus,$(K8S_NETPOL_LEGACY_E2E_FOCUS)) \
./test/e2e/k8s-network/k8s-network.test
.PHONY: k8s-netpol-e2e
k8s-netpol-e2e:
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/k8s-network
ginkgo -p --randomize-all -v --timeout=2h \
$(call ginkgo_option,focus,$(K8S_NETPOL_E2E_FOCUS)) \
$(call ginkgo_option,skip,$(K8S_NETPOL_E2E_SKIP)) \
./test/e2e/k8s-network/k8s-network.test
.PHONY: cyclonus-netpol-e2e
cyclonus-netpol-e2e:
kubectl create ns netpol
kubectl create clusterrolebinding cyclonus --clusterrole=cluster-admin --serviceaccount=netpol:cyclonus
kubectl create sa cyclonus -n netpol
kubectl create -f test/e2e/cyclonus.yaml -n netpol
while ! kubectl wait pod --for=condition=Ready -l job-name=cyclonus -n netpol; do \
sleep 3; \
done
kubectl logs -f -l job-name=cyclonus -n netpol
kubectl -n netpol logs \
$$(kubectl -n netpol get pod -l job-name=cyclonus -o=jsonpath={.items[0].metadata.name}) | \
grep failed; test $$? -ne 0
.PHONY: kube-ovn-conformance-e2e
kube-ovn-conformance-e2e:
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/kube-ovn
E2E_BRANCH=$(E2E_BRANCH) \
E2E_IP_FAMILY=$(E2E_IP_FAMILY) \
E2E_NETWORK_MODE=$(E2E_NETWORK_MODE) \
ginkgo $(GINKGO_PARALLEL_OPT) --randomize-all -v \
--focus=CNI:Kube-OVN ./test/e2e/kube-ovn/kube-ovn.test
.PHONY: kube-ovn-ic-conformance-e2e
kube-ovn-ic-conformance-e2e:
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/ovn-ic
E2E_BRANCH=$(E2E_BRANCH) \
E2E_IP_FAMILY=$(E2E_IP_FAMILY) \
E2E_NETWORK_MODE=$(E2E_NETWORK_MODE) \
ginkgo $(GINKGO_PARALLEL_OPT) --randomize-all -v \
--focus=CNI:Kube-OVN ./test/e2e/ovn-ic/ovn-ic.test
.PHONY: kube-ovn-submariner-conformance-e2e
kube-ovn-submariner-conformance-e2e:
KUBECONFIG=$(KUBECONFIG) subctl verify \
--context kind-kube-ovn --tocontext kind-kube-ovn1 \
--verbose --disruptive-tests
.PHONY: kube-ovn-lb-svc-conformance-e2e
kube-ovn-lb-svc-conformance-e2e:
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/lb-svc
E2E_BRANCH=$(E2E_BRANCH) \
E2E_IP_FAMILY=$(E2E_IP_FAMILY) \
E2E_NETWORK_MODE=$(E2E_NETWORK_MODE) \
ginkgo $(GINKGO_PARALLEL_OPT) --randomize-all -v \
--focus=CNI:Kube-OVN ./test/e2e/lb-svc/lb-svc.test
.PHONY: iptables-vpc-nat-gw-conformance-e2e
iptables-vpc-nat-gw-conformance-e2e:
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/iptables-vpc-nat-gw
E2E_BRANCH=$(E2E_BRANCH) \
E2E_IP_FAMILY=$(E2E_IP_FAMILY) \
E2E_NETWORK_MODE=$(E2E_NETWORK_MODE) \
ginkgo $(GINKGO_PARALLEL_OPT) --randomize-all -v \
--focus=CNI:Kube-OVN ./test/e2e/iptables-vpc-nat-gw/iptables-vpc-nat-gw.test
.PHONY: ovn-vpc-nat-gw-conformance-e2e
ovn-vpc-nat-gw-conformance-e2e:
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/ovn-vpc-nat-gw
E2E_BRANCH=$(E2E_BRANCH) \
E2E_IP_FAMILY=$(E2E_IP_FAMILY) \
E2E_NETWORK_MODE=$(E2E_NETWORK_MODE) \
ginkgo $(GINKGO_PARALLEL_OPT) --randomize-all -v \
--focus=CNI:Kube-OVN ./test/e2e/ovn-vpc-nat-gw/ovn-vpc-nat-gw.test
.PHONY: kube-ovn-security-e2e
kube-ovn-security-e2e:
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/security
E2E_BRANCH=$(E2E_BRANCH) \
E2E_IP_FAMILY=$(E2E_IP_FAMILY) \
E2E_NETWORK_MODE=$(E2E_NETWORK_MODE) \
ginkgo $(GINKGO_PARALLEL_OPT) --randomize-all -v \
--focus=CNI:Kube-OVN ./test/e2e/security/security.test
.PHONY: kube-ovn-kubevirt-e2e
kube-ovn-kubevirt-e2e:
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/kubevirt
E2E_BRANCH=$(E2E_BRANCH) \
E2E_IP_FAMILY=$(E2E_IP_FAMILY) \
E2E_NETWORK_MODE=$(E2E_NETWORK_MODE) \
ginkgo $(GINKGO_PARALLEL_OPT) --randomize-all -v \
--focus=CNI:Kube-OVN ./test/e2e/kubevirt/kubevirt.test
.PHONY: kube-ovn-webhook-e2e
kube-ovn-webhook-e2e:
ginkgo build $(E2E_BUILD_FLAGS) ./test/e2e/webhook
E2E_BRANCH=$(E2E_BRANCH) \
E2E_IP_FAMILY=$(E2E_IP_FAMILY) \
E2E_NETWORK_MODE=$(E2E_NETWORK_MODE) \
ginkgo $(GINKGO_PARALLEL_OPT) --randomize-all -v \
--focus=CNI:Kube-OVN ./test/e2e/webhook/webhook.test
.PHONY: kubectl-ko-log
kubectl-ko-log:
kubectl ko log all
tar -zcvf kubectl-ko-log.tar.gz kubectl-ko-log/