added some comments and refactored idempotency
This commit is contained in:
parent
318f6adc5d
commit
f5faecaae4
@ -5,19 +5,27 @@ export PATH=$PATH:$(go env GOPATH)/bin
|
|||||||
reg_name="kind-registry"
|
reg_name="kind-registry"
|
||||||
reg_port="5001"
|
reg_port="5001"
|
||||||
|
|
||||||
|
# Build utility image if it doesn't already exist
|
||||||
|
if [ "$(podman image list --format='{{.Repository}}:{{.Tag}}' 2>/dev/null | cut -d/ -f2 | tr '[:upper:]' '[:lower:]' | egrep 'utility:latest')" != 'utility:latest' ]; then
|
||||||
|
podman build -t utility .
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Deploy local registry container
|
||||||
if [ "$(podman inspect -f '{{.State.Running}}' ${reg_name} 2>/dev/null || true)" != 'true' ]; then
|
if [ "$(podman inspect -f '{{.State.Running}}' ${reg_name} 2>/dev/null || true)" != 'true' ]; then
|
||||||
podman run -d -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" registry:2
|
podman run -d -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" registry:2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kind get clusters -q | egrep '^ek-demo$' >/dev/null || cat <<EOF | kind create cluster -n ek-demo --image kindest/node:v1.24.15 --kubeconfig .kube/config --config=-
|
# Create cluster, with ingress and registry patches
|
||||||
kind: Cluster
|
if [ ! "$(kind get clusters -q | egrep '^ek-demo$' >/dev/nulli)" ]; then
|
||||||
apiVersion: kind.x-k8s.io/v1alpha4
|
cat <<-EOF | kind create cluster -n ek-demo --image kindest/node:v1.24.15 --kubeconfig .kube/config --config=-
|
||||||
containerdConfigPatches:
|
kind: Cluster
|
||||||
- |-
|
apiVersion: kind.x-k8s.io/v1alpha4
|
||||||
|
containerdConfigPatches:
|
||||||
|
- |-
|
||||||
[plugins."io.containerd.grpc.v1.cri".registry]
|
[plugins."io.containerd.grpc.v1.cri".registry]
|
||||||
config_path = "/etc/containerd/certs.d"
|
config_path = "/etc/containerd/certs.d"
|
||||||
nodes:
|
nodes:
|
||||||
- role: control-plane
|
- role: control-plane
|
||||||
kubeadmConfigPatches:
|
kubeadmConfigPatches:
|
||||||
- |
|
- |
|
||||||
kind: InitConfiguration
|
kind: InitConfiguration
|
||||||
@ -31,11 +39,13 @@ nodes:
|
|||||||
- containerPort: 443
|
- containerPort: 443
|
||||||
hostPort: 443
|
hostPort: 443
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- role: worker
|
- role: worker
|
||||||
- role: worker
|
- role: worker
|
||||||
- role: worker
|
- role: worker
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add registry to each node
|
||||||
REGISTRY_DIR="/etc/containerd/certs.d/localhost:${reg_port}"
|
REGISTRY_DIR="/etc/containerd/certs.d/localhost:${reg_port}"
|
||||||
for node in $(kind get nodes -q --name staticweb); do
|
for node in $(kind get nodes -q --name staticweb); do
|
||||||
podman exec "${node}" mkdir -p "${REGISTRY_DIR}"
|
podman exec "${node}" mkdir -p "${REGISTRY_DIR}"
|
||||||
|
Loading…
Reference in New Issue
Block a user