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

add support for mac and some notes #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ failover & traffic-splitting in a multi-cluster mesh of Kubernetes clusters.
- [`k3d:v3`](https://github.com/rancher/k3d/releases/tag/v3.0.0-beta.1)
- [`smallstep/cli`](https://github.com/smallstep/cli/releases)
- [`linkerd:edge-20.5.3`+](https://github.com/linkerd/linkerd2/releases)
- [`kubectl 1.16`+](https://github.com/kubernetes/kubectl/releases)

[`./create.sh`](./create.sh) initializes a temporary CA and a set of clusters
in `k3d`: _dev_, _east_, and _west_.
Expand Down
28 changes: 24 additions & 4 deletions create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,27 @@ set -x

export ORG_DOMAIN="${ORG_DOMAIN:-k3d.example.com}"

CA_DIR=$(mktemp --tmpdir="${TMPDIR:-/tmp}" -d k3d-ca.XXXXX)
if ! command -v linkerd &>/dev/null
then
echo "Install Linkerd with the command"
echo "curl -sL https://run.linkerd.io/install | sh"
exit 1
fi

case $(uname) in
Darwin)
# host_platform=darwin
CA_DIR=$(mktemp -d k3d-ca.XXXXX)
;;
Linux)
# host_platform=linux
CA_DIR=$(mktemp --tmpdir="${TMPDIR:-/tmp}" -d k3d-ca.XXXXX)
;;
*)
echo "Unknown operating system: $(uname)"
exit 1
;;
esac

# Generate the trust roots. These never touch the cluster. In the real world
# we'd squirrel these away in a vault.
Expand All @@ -20,18 +40,18 @@ step certificate create \

port=6440
for cluster in dev east west ; do
if k3d get cluster "$cluster" >/dev/null 2>&1 ; then
if k3d cluster get "$cluster" >/dev/null 2>&1 ; then
echo "Already exists: $cluster" >&2
exit 1
fi

k3d create cluster "$cluster" \
k3d cluster create "$cluster" \
--api-port="$((port++))" \
--network=multicluster-example \
--k3s-server-arg="--cluster-domain=$cluster.${ORG_DOMAIN}" \
--wait

k3d get kubeconfig "$cluster"
k3d kubeconfig get "$cluster"

# Check that the cluster is up and running.
while ! linkerd --context="k3d-$cluster" check --pre ; do :; done
Expand Down