@@ -16,7 +16,7 @@ export SHELLOPTS
16
16
#
17
17
# The EmptyDir test is a canary; it will fail if mount propagation is
18
18
# not properly configured on the host.
19
- NETWORKING_E2E_FOCUS=" ${NETWORKING_E2E_FOCUS:- etworking|EmptyDir volumes should support \( root,0644,tmpfs\) } "
19
+ NETWORKING_E2E_FOCUS=" ${NETWORKING_E2E_FOCUS:- etworking|Feature : OSNetworkPolicy| EmptyDir volumes should support \( root,0644,tmpfs\) } "
20
20
NETWORKING_E2E_SKIP=" ${NETWORKING_E2E_SKIP:- } "
21
21
22
22
DEFAULT_SKIP_LIST=(
@@ -313,6 +313,25 @@ function disable-selinux() {
313
313
fi
314
314
}
315
315
316
+ function kernel-supports-networkpolicy() {
317
+ # There's really no good way to test this "correctly" if OVS isn't installed.
318
+ # The mainline kernel got support for OVS NAT support in 4.6. RHEL kernels have
319
+ # it in 3.10.0-514 and later.
320
+ version=" $( uname -r) "
321
+ case " ${version} " in
322
+ 3.10.0-* .el7.* )
323
+ build=$( sed -e ' s/.*-\([0-9]*\)\..*/\1/' <<< " ${version}" )
324
+ if [[ " ${build} " -lt 514 ]]; then
325
+ return 1
326
+ fi
327
+ ;;
328
+ [0-3].* |4.[0-5].* )
329
+ return 1
330
+ ;;
331
+ esac
332
+ return 0
333
+ }
334
+
316
335
os::log::info " Starting 'networking' extended tests"
317
336
if [[ -n " ${CONFIG_ROOT} " ]]; then
318
337
KUBECONFIG=" $( get-kubeconfig-from-root " ${CONFIG_ROOT} " ) "
@@ -377,11 +396,16 @@ else
377
396
# Docker-in-docker is not compatible with selinux
378
397
disable-selinux
379
398
380
- # Skip the subnet tests during a minimal test run
399
+ # Skip subnet and networkpolicy tests during a minimal test run
381
400
if [[ -z " ${NETWORKING_E2E_MINIMAL} " ]]; then
382
401
# Ignore deployment errors for a given plugin to allow other plugins
383
402
# to be tested.
384
403
test-osdn-plugin " subnet" " redhat/openshift-ovs-subnet" " false" " false" || true
404
+ if kernel-supports-networkpolicy; then
405
+ test-osdn-plugin " networkpolicy" " redhat/openshift-ovs-networkpolicy" " false" " true" || true
406
+ else
407
+ os::log::warning " Skipping networkpolicy tests due to kernel version"
408
+ fi
385
409
fi
386
410
387
411
test-osdn-plugin " multitenant" " redhat/openshift-ovs-multitenant" " true" " false" || true
0 commit comments