diff --git a/ci-operator/config/openshift-kni/eco-ci-cd/openshift-kni-eco-ci-cd-main__cnf-compute-nrop-stage-nightly.yaml b/ci-operator/config/openshift-kni/eco-ci-cd/openshift-kni-eco-ci-cd-main__cnf-compute-nrop-stage-nightly.yaml index b8c29079d472b..c211affbec1a7 100644 --- a/ci-operator/config/openshift-kni/eco-ci-cd/openshift-kni-eco-ci-cd-main__cnf-compute-nrop-stage-nightly.yaml +++ b/ci-operator/config/openshift-kni/eco-ci-cd/openshift-kni-eco-ci-cd-main__cnf-compute-nrop-stage-nightly.yaml @@ -75,6 +75,7 @@ tests: PQC_CHECK: "true" SCAN_NAMESPACE: openshift-numaresources SCANNER_CPU: "2" + SCANNER_NAMESPACE: tls-scanner TEST_ENV: stage VERSION: "5.0" workflow: telcov10n-functional-cnf-compute-nrop-tls-scanner diff --git a/ci-operator/step-registry/telcov10n/functional/cnf-compute/nrop/create-network-policy/OWNERS b/ci-operator/step-registry/telcov10n/functional/cnf-compute/nrop/create-network-policy/OWNERS new file mode 100644 index 0000000000000..42fcae862b9e3 --- /dev/null +++ b/ci-operator/step-registry/telcov10n/functional/cnf-compute/nrop/create-network-policy/OWNERS @@ -0,0 +1,7 @@ +approvers: +- eifrach +- ccardenosa +- mrniranjan +- rshemtov13 +- sargunnarula +- oblau diff --git a/ci-operator/step-registry/telcov10n/functional/cnf-compute/nrop/create-network-policy/telcov10n-functional-cnf-compute-nrop-create-network-policy-commands.sh b/ci-operator/step-registry/telcov10n/functional/cnf-compute/nrop/create-network-policy/telcov10n-functional-cnf-compute-nrop-create-network-policy-commands.sh new file mode 100755 index 0000000000000..f59230883d009 --- /dev/null +++ b/ci-operator/step-registry/telcov10n/functional/cnf-compute/nrop/create-network-policy/telcov10n-functional-cnf-compute-nrop-create-network-policy-commands.sh @@ -0,0 +1,55 @@ +#!/bin/bash +set -o nounset +set -o errexit +set -o pipefail + +# The TLS scanner connects to pods in the NROP namespace (e.g. the secondary +# scheduler metrics endpoint on port 10259) over the pod network. NROP +# namespaces enforce NetworkPolicy that denies ingress from other namespaces, +# so the scanner running in its own namespace cannot reach those pods. +# +# NetworkPolicies are additive: this creates a policy that allows ingress to the +# scheduler pods from both the NROP namespace and the scanner namespace, so the +# scan can complete without loosening the existing isolation for other traffic. + +SCAN_NAMESPACE="${SCAN_NAMESPACE:-openshift-numaresources}" +SCANNER_NAMESPACE="${SCANNER_NAMESPACE:-tls-scanner}" +SCHEDULER_POD_LABEL_KEY="${SCHEDULER_POD_LABEL_KEY:-app}" +SCHEDULER_POD_LABEL_VALUE="${SCHEDULER_POD_LABEL_VALUE:-secondary-scheduler}" +SCHEDULER_PORT="${SCHEDULER_PORT:-10259}" + +# The scanner runs pod-networked in SCANNER_NAMESPACE so the namespaceSelector +# below matches its traffic. In that mode the tls-scanner-run step does not +# create the namespace itself, so ensure it exists here before the scan. +echo "Ensuring scanner namespace ${SCANNER_NAMESPACE} exists..." +oc create namespace "${SCANNER_NAMESPACE}" --dry-run=client -o yaml | oc apply -f - + +echo "Allowing TLS scanner (ns: ${SCANNER_NAMESPACE}) ingress to ${SCHEDULER_POD_LABEL_KEY}=${SCHEDULER_POD_LABEL_VALUE} pods on port ${SCHEDULER_PORT} in ${SCAN_NAMESPACE}..." + +cat <