Skip to content

Commit

Permalink
wip: add script to run internal encryption e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KauzClay committed Jun 12, 2023
1 parent da5f8ea commit ed90501
Showing 1 changed file with 69 additions and 1 deletion.
70 changes: 69 additions & 1 deletion test/e2e-internal-encryption-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,74 @@
# See the License for the specific language governing permissions and
# limitations under the License.

echo "TODO(KauzClay): Implement Me!"
source $(dirname $0)/e2e-common.sh

function setup_internal_encryption_env_variables() {
export TLS_TEST_NAMESPACE="tls"

local INGRESS_NAMESPACE=${GATEWAY_NAMESPACE_OVERRIDE}
if [[ -z "${GATEWAY_NAMESPACE_OVERRIDE}" ]]; then
INGRESS_NAMESPACE="istio-system"
fi
local INGRESS_SERVICE=${GATEWAY_OVERRIDE}
if [[ -z "${GATEWAY_OVERRIDE}" ]]; then
INGRESS_SERVICE="istio-ingressgateway"
fi
local IP=$(kubectl get svc -n ${INGRESS_NAMESPACE} ${INGRESS_SERVICE} -o jsonpath="{.status.loadBalancer.ingress[0].ip}")
export INTERNAL_ENCRYPTION_TEST_INGRESS_IP=${IP}
}

function setup_internal_encryption() {
toggle_feature dataplane-trust enabled config-network

sleep 5

# with the current implementation, Activator is always in the request path, and needs to be restarted after configuring dataplane-trust
kubectl -n ${SYSTEM_NAMESPACE} delete pod -l app=activator
}

function cleanup_internal_encryption() {
toggle_feature dataplane-trust disabled config-network

sleep 5

# with the current implementation, Activator is always in the request path, and needs to be restarted after configuring dataplane-trust
kubectl -n ${SYSTEM_NAMESPACE} delete pod -l app=activator
}

# Script entry point.
initialize "$@" --skip-istio-addon --min-nodes=4 --max-nodes=4 --enable-ha --cluster-version=1.25

# Run the tests
header "Running tests"

failed=0

# Currently only Contour and Kourier implement the alpha features.
alpha=""
if [[ -z "${INGRESS_CLASS}" \
|| "${INGRESS_CLASS}" == "contour.ingress.networking.knative.dev" \
|| "${INGRESS_CLASS}" == "kourier.ingress.networking.knative.dev" ]]; then
alpha="--enable-alpha"
fi

INTERNAL_ENCRYPTION_TEST_OPTIONS="${INTERNAL_ENCRYPTION_TEST_OPTIONS:-${alpha} --enable-beta}"

# Auto TLS E2E tests mutate the cluster and must be ran separately
# because they need auto-tls and cert-manager specific configurations
subheader "Setup internal encryption"
setup_internal_encryption
add_trap "cleanup_internal_encryption" EXIT SIGKILL SIGTERM SIGQUIT

(( failed )) && fail_test

subheader "Cleanup internal encryption"
cleanup_internal_encryption

# Remove the kail log file if the test flow passes.
# This is for preventing too many large log files to be uploaded to GCS in CI.
rm "${ARTIFACTS}/k8s.log-$(basename "${E2E_SCRIPT}").txt"
success

exit 0

0 comments on commit ed90501

Please sign in to comment.