Skip to content

Commit

Permalink
muck with minikube.sh for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
dmolik committed Aug 4, 2024
1 parent 39dd108 commit be8abde
Showing 1 changed file with 35 additions and 7 deletions.
42 changes: 35 additions & 7 deletions scripts/minikube.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
#!/bin/sh


export CILIUM_CLI_MODE=classic
export SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

bootcluster() {

bootcluster_linux() {
name=$1
clusterid=$2
podcidr=$3
servicecidr=$4

helm repo add cilium https://helm.cilium.io/ || true
helm repo update cilium
helm pull cilium/cilium --untar

echo "---
kind: ConfigMap
apiVersion: v1
Expand All @@ -17,8 +24,8 @@ metadata:
data:
description: This CM intentioanlly left blank to fake out minikube/kubeadm
" > blank.yaml
minikube start --memory 4G --container-runtime=cri-o \
--kubernetes-version=v${K8S_VERSION} \
minikube start --memory 4g --container-runtime=cri-o \
--kubernetes-version=v${k8s_version} \
--extra-config kubeadm.pod-network-cidr=$podcidr \
--service-cluster-ip-range $servicecidr \
--extra-config kubeadm.skip-phases=addon/kube-proxy \
Expand Down Expand Up @@ -103,6 +110,22 @@ data:
# sleep 15 #@TODO build a watch loop
}

bootcluster_macos() {
name=$1
clusterid=$2
podcidr=$3
servicecidr=$4

minikube start --memory 4g --container-runtime=cri-o \
--kubernetes-version=v${k8s_version} \
--extra-config kubeadm.pod-network-cidr=$podcidr \
--service-cluster-ip-range $servicecidr \
--network north-south \
--subnet 10.59.0.0/16 \
--host-only-cidr 10.59.0.0/16 \
--dns-domain cluster.$name --cni=cilium --profile=$name
}

addons() {
kubectl delete pod -l k8s-app=kube-dns -n kube-system
minikube addons enable registry -p north
Expand All @@ -122,10 +145,15 @@ addons() {
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v${CERTMANAGER_VERSION}/cert-manager.yaml
}

helm repo add cilium https://helm.cilium.io/ || true
helm repo update cilium
helm pull cilium/cilium --untar
OS=$(uname)

bootcluster north 1 10.60.0.0/16 10.96.0.0/16
if [ "$OS" = "Darwin" ]; then
bootcluster_macos north 1 10.60.0.0/16 10.96.0.0/16
elif [ "$OS" = "Linux" ]; then
bootcluster_linux north 1 10.60.0.0/16 10.96.0.0/16
else
echo "Unsupported OS"
exit 1
fi

addons

0 comments on commit be8abde

Please sign in to comment.