Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix local registry deployments #1808

Merged
merged 3 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions scripts/shared/lib/clusters_kind
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ function provider_create_cluster() {
cat "${RESOURCES_DIR}/${cluster}-config.yaml"
kind create cluster ${image_flag:+"$image_flag"} --name="${cluster}" --config="${RESOURCES_DIR}/${cluster}-config.yaml"
kind_fixup_config
kind_configure_registry "${cluster}"

[[ "$LOAD_BALANCER" != true ]] || delete_cluster_on_fail deploy_load_balancer
[[ "$AIR_GAPPED" != true ]] || air_gap_iptables
Expand Down Expand Up @@ -232,6 +233,28 @@ function run_local_registry() {
fi
}

function kind_configure_registry() {
local cluster="$1"
REGISTRY_DIR="/etc/containerd/certs.d/localhost:5000"
for node in $(kind --name="${cluster}" get nodes); do
docker exec "${node}" mkdir -p "${REGISTRY_DIR}"
docker exec -i "${node}" cp /dev/stdin "${REGISTRY_DIR}/hosts.toml" <<EOF
[host."http://${KIND_REGISTRY}:5000"]
EOF
done
kubectl apply -f - <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: local-registry-hosting
namespace: kube-public
data:
localRegistryHosting.v1: |
host: "localhost:5000"
help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
EOF
}

function provider_failed() {
if [[ "$(cat /proc/sys/fs/inotify/max_user_instances)" -lt 512 ]]; then
echo "Your inotify settings are lower than our recommendation."
Expand Down
9 changes: 6 additions & 3 deletions scripts/shared/lib/deploy_operator
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ component_by_image['submariner-operator']=submariner-operator
component_by_image['submariner-route-agent']=submariner-routeagent
component_by_image['lighthouse-agent']=submariner-lighthouse-agent
component_by_image['lighthouse-coredns']=submariner-lighthouse-coredns
component_by_image['nettest']="submariner-metrics-proxy submariner-nettest"

### Functions ###

Expand Down Expand Up @@ -67,9 +68,11 @@ function subctl_install_subm() {
[[ "$AIR_GAPPED" = true ]] && extra_flags+=(--repository "${SUBM_IMAGE_REPO}" --version "${SUBM_IMAGE_TAG}")

for image in ${PRELOAD_IMAGES}; do
local image_key="${component_by_image[$image]}"
[[ -n "${image_key}" ]] || continue
extra_flags+=(--image-override "${image_key}=${SUBM_IMAGE_REPO}/${image}:${SUBM_IMAGE_TAG}")
local image_keys="${component_by_image[$image]}"
[[ -n "${image_keys}" ]] || continue
for key in ${image_keys}; do
extra_flags+=(--image-override "${key}=${SUBM_IMAGE_REPO}/${image}:${SUBM_IMAGE_TAG}")
done
done
fi

Expand Down
4 changes: 2 additions & 2 deletions scripts/shared/resources/kind-cluster-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ networking:
serviceSubnet: ${service_cidr}
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\"
kubeadmConfigPatches:
- |
apiVersion: kubeadm.k8s.io/v1beta2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ networking:
ipFamily: dual
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\"
kubeadmConfigPatches:
- |
apiVersion: kubeadm.k8s.io/v1beta2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ networking:
ipFamily: ipv6
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\"
kubeadmConfigPatches:
- |
apiVersion: kubeadm.k8s.io/v1beta2
Expand Down
Loading