Skip to content

Commit

Permalink
namespace ngrok kind cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobsonchase committed Mar 5, 2024
1 parent 835b611 commit d767aea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scripts/kind-down.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash

kind delete cluster
kind delete cluster --name ngrok-ingress-controller
docker stop kind-registry | xargs docker rm
8 changes: 6 additions & 2 deletions scripts/kind-up.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -o errexit

cluster_name=ngrok-ingress-controller

# 1. Create registry container unless it already exists
reg_name='kind-registry'
reg_port='5001'
Expand All @@ -18,7 +20,7 @@ fi
# https://github.com/kubernetes-sigs/kind/issues/2875
# https://github.com/containerd/containerd/blob/main/docs/cri/config.md#registry-configuration
# See: https://github.com/containerd/containerd/blob/main/docs/hosts.md
cat <<EOF | kind create cluster --config=-
cat <<EOF | kind create cluster --name $cluster_name --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
containerdConfigPatches:
Expand All @@ -36,7 +38,7 @@ EOF
# We want a consistent name that works from both ends, so we tell containerd to
# alias localhost:${reg_port} to the registry container when pulling images
REGISTRY_DIR="/etc/containerd/certs.d/localhost:${reg_port}"
for node in $(kind get nodes); do
for node in $(kind get nodes --name $cluster_name); do
docker exec "${node}" mkdir -p "${REGISTRY_DIR}"
cat <<EOF | docker exec -i "${node}" cp /dev/stdin "${REGISTRY_DIR}/hosts.toml"
[host."http://${reg_name}:5000"]
Expand All @@ -62,3 +64,5 @@ data:
host: "localhost:${reg_port}"
help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
EOF

kubectl config set-context --current --namespace=ngrok-ingress-controller

0 comments on commit d767aea

Please sign in to comment.