Skip to content

Instantly share code, notes, and snippets.

@rhuss
Created June 24, 2019 12:11
Show Gist options
  • Save rhuss/bf1daf2a38c78d53e0a6b3ddd02f5a48 to your computer and use it in GitHub Desktop.
Save rhuss/bf1daf2a38c78d53e0a6b3ddd02f5a48 to your computer and use it in GitHub Desktop.
create.sh
#!/usr/bin/env bash
set -e
# Turn colors in this script off by setting the NO_COLOR variable in your
# environment to any value:
#
# $ NO_COLOR=1 test.sh
NO_COLOR=${NO_COLOR:-""}
if [ -z "$NO_COLOR" ]; then
header=$'\e[1;33m'
reset=$'\e[0m'
else
header=''
reset=''
fi
serving_version="nightly"
eventing_version="nightly"
istio_version="1.1.7"
#kube_version="v1.12.1"
kube_version="v1.13.4"
MEMORY="$(minikube config view | awk '/memory/ { print $3 }')"
CPUS="$(minikube config view | awk '/cpus/ { print $3 }')"
DISKSIZE="$(minikube config view | awk '/disk-size/ { print $3 }')"
DRIVER="$(minikube config view | awk '/vm-driver/ { print $3 }')"
header_text() {
echo "$header$*$reset"
}
header_text "Starting Knative on minikube!"
header_text "Using Kubernetes Version: ${kube_version}"
header_text "Using Knative Serving Version: ${serving_version}"
header_text "Using Knative Eventing Version: ${eventing_version}"
header_text "Using Istio (minimal) Version: ${istio_version}"
minikube start --memory="${MEMORY:-12288}" --cpus="${CPUS:-4}" --kubernetes-version="${kube_version}" --vm-driver="${DRIVER:-kvm2}" --disk-size="${DISKSIZE:-30g}" --extra-config=apiserver.enable-admission-plugins="LimitRanger,NamespaceExists,NamespaceLifecycle,ResourceQuota,ServiceAccount,DefaultStorageClass,MutatingAdmissionWebhook"
header_text "Waiting for core k8s services to initialize"
sleep 5; while echo && kubectl get pods -n kube-system | grep -v -E "(Running|Completed|STATUS)"; do sleep 5; done
header_text "Setting up Istio lean"
# Replace "master" below with the next serving release, when released.
curl -L "https://raw.githubusercontent.com/knative/serving/master/third_party/istio-${istio_version}/istio-lean.yaml" \
| sed 's/LoadBalancer/NodePort/' \
| kubectl apply --filename -
# Label the default namespace with istio-injection=enabled.
header_text "Labeling default namespace w/ istio-injection=enabled"
kubectl label namespace default istio-injection=enabled
header_text "Waiting for istio to become ready"
sleep 5; while echo && kubectl get pods -n istio-system | grep -v -E "(Running|Completed|STATUS)"; do sleep 5; done
header_text "Setting up Knative Serving"
kubectl apply --selector knative.dev/crd-install=true --filename https://storage.googleapis.com/knative-nightly/serving/latest/serving.yaml
sleep 20
curl -L "https://storage.googleapis.com/knative-nightly/serving/latest/serving.yaml" \
| sed 's/LoadBalancer/NodePort/' \
| kubectl apply --filename -
header_text "Waiting for Knative Serving to become ready"
sleep 5; while echo && kubectl get pods -n knative-serving | grep -v -E "(Running|Completed|STATUS)"; do sleep 5; done
header_text "Setting up Knative Eventing"
#kubectl apply --filename https://github.com/knative/eventing/releases/download/${eventing_version}/release.yaml
kubectl apply --selector knative.dev/crd-install=true --filename https://storage.googleapis.com/knative-nightly/eventing/latest/release.yaml
sleep 5
kubectl apply --filename https://storage.googleapis.com/knative-nightly/eventing/latest/release.yaml
header_text "Waiting for Knative Eventing to become ready"
sleep 5; while echo && kubectl get pods -n knative-eventing | grep -v -E "(Running|Completed|STATUS)"; do sleep 5; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment