Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #5 from tamer-hassan/macos-improved-support
Browse files Browse the repository at this point in the history
Fixes Issue #4
  • Loading branch information
nicks committed Jul 26, 2019
2 parents ded8039 + 7973e1f commit cf3912c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions kind-registry.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
#!/bin/bash

# Workaround for MacOS when kind-control-plane container is not started after reboot
name='kind-control-plane'
if [ -z "`docker ps --format '{{.Names}}' | grep $name`" ] && [ "`docker ps -a --format '{{.Names}}' | grep $name`" == "$name" ]; then
echo "Found $name container but stopped, so starting it, and sleeping 15s!"
docker start $name
sleep 15
fi

# set up kubeconfig to point to the kind cluster
export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"

nodes=$(kubectl get nodes -oname)
num_nodes=$(echo "$nodes" | wc -l)
num_nodes=$(echo "$nodes" | wc -l | sed 's/^ *//')

# double-check that we have a 1-node cluster
if [[ "1" != $num_nodes ]]; then
if [[ "1" != "$num_nodes" ]]; then
echo "Required: KIND cluster with exactly 1 node. Actual: $num_nodes"
exit 1
fi
Expand All @@ -16,11 +24,13 @@ fi
for node in $(kubectl get nodes -oname); do
node_name=${node#node/}

echo "node_name: ${node_name}"

# Check to see if containerd is set up already with an insecure registry
config=$(docker exec ${node_name} cat /etc/containerd/config.toml)
if [[ "$config" != *"localhost:32001"* ]]; then
echo "Overwriting /etc/containerd/config.toml"

# Overwrite config.toml with our own
docker cp config.toml ${node_name}:/etc/containerd/config.toml

Expand Down

0 comments on commit cf3912c

Please sign in to comment.