test: fix kind local registry config for kms ci jobs

Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
This commit is contained in:
Anish Ramasekar
2026-01-12 12:58:43 -08:00
parent 477b99a8d8
commit 900a8030f3
2 changed files with 16 additions and 2 deletions

View File

@@ -3,11 +3,14 @@ apiVersion: kind.x-k8s.io/v1alpha4
# this containerd config patch sets the registry to the local registry where we push mock kms provider
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:5000"]
endpoint = ["http://kind-registry:5000"]
[plugins."io.containerd.grpc.v1.cri".registry]
config_path = "/etc/containerd/certs.d"
nodes:
- role: control-plane
extraMounts:
- containerPath: /etc/containerd/certs.d
hostPath: test/e2e/testing-manifests/auth/encrypt/certs.d
readOnly: true
- containerPath: /etc/kubernetes/encryption-config.yaml
hostPath: test/e2e/testing-manifests/auth/encrypt/encryption-config.yaml
readOnly: true

View File

@@ -90,6 +90,14 @@ connect_registry(){
fi
}
# create_hosts_toml creates the hosts.toml file used to configure the local registry for the kind cluster.
create_hosts_toml() {
mkdir -p "test/e2e/testing-manifests/auth/encrypt/certs.d/localhost:5000"
cat <<EOF > "test/e2e/testing-manifests/auth/encrypt/certs.d/localhost:5000/hosts.toml"
[host."http://kind-registry:5000"]
EOF
}
# create_cluster_and_run_test creates a kind cluster using kubetest2 and runs e2e tests.
create_cluster_and_run_test() {
CLUSTER_CREATE_ATTEMPTED=true
@@ -112,6 +120,8 @@ create_cluster_and_run_test() {
}
cleanup() {
rm -rf test/e2e/testing-manifests/auth/encrypt/certs.d
# CLUSTER_CREATE_ATTEMPTED is true once we run kubetest2 kind --up
if [ "${CLUSTER_CREATE_ATTEMPTED:-}" = true ]; then
if [ "${SKIP_COLLECT_LOGS:-}" != "true" ]; then
@@ -162,6 +172,7 @@ main(){
done;
create_registry
create_hosts_toml
build_and_push_mock_plugin
connect_registry &
create_cluster_and_run_test