Created
January 23, 2020 09:46
-
-
Save matzew/c41f284d221abd1a6d78a3265cddef0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
strimzi_version=`curl https://github.com/strimzi/strimzi-kafka-operator/releases/latest | awk -F 'tag/' '{print $2}' | awk -F '"' '{print $1}' 2>/dev/null` | |
serving_version="v0.11.0" | |
eventing_version="v0.12.0" | |
istio_version="1.4.0" | |
kube_version="v1.16.0" | |
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 }')" | |
function header_text { | |
echo "$header$*$reset" | |
} | |
header_text "Starting Knative on minikube!" | |
header_text "Using Kubernetes Version: ${kube_version}" | |
header_text "Using Strimzi Version: ${strimzi_version}" | |
header_text "Using Knative Serving Version: ${serving_version}" | |
header_text "Using Knative Eventing Version: ${eventing_version}" | |
header_text "Using Istio Version: ${istio_version}" | |
minikube start --memory="${MEMORY:-12288}" --cpus="${CPUS:-8}" --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 "Strimzi install" | |
kubectl create namespace kafka | |
curl -L "https://github.com/strimzi/strimzi-kafka-operator/releases/download/${strimzi_version}/strimzi-cluster-operator-${strimzi_version}.yaml" \ | |
| sed 's/namespace: .*/namespace: kafka/' \ | |
| kubectl -n kafka apply -f - | |
header_text "Applying Strimzi Cluster file" | |
kubectl -n kafka apply -f "https://raw.githubusercontent.com/strimzi/strimzi-kafka-operator/${strimzi_version}/examples/kafka/kafka-persistent-single.yaml" | |
header_text "Waiting for Strimzi to become ready" | |
sleep 5; while echo && kubectl get pods -n kafka | grep -v -E "(Running|Completed|STATUS)"; do sleep 5; done | |
header_text "Setting up Istio" | |
curl -L "https://raw.githubusercontent.com/knative/serving/${serving_version}/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" | |
n=0 | |
until [ $n -ge 2 ] | |
do | |
kubectl apply --filename https://github.com/knative/serving/releases/download/${serving_version}/serving.yaml && break | |
n=$[$n+1] | |
sleep 5 | |
done | |
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}/eventing.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 | |
header_text "Setting up Knative Apache Kafka Source" | |
kubectl apply --filename https://github.com/knative/eventing-contrib/releases/download/${eventing_version}/kafka-source.yaml | |
header_text "Waiting for Knative Apache Kafka Source to become ready" | |
sleep 5; while echo && kubectl get pods -n knative-sources | grep -v -E "(Running|Completed|STATUS)"; do sleep 5; done | |
header_text "Setting up Knative Apache Kafka Channel" | |
curl -L "https://github.com/knative/eventing-contrib/releases/download/${eventing_version}/kafka-channel.yaml" \ | |
| sed 's/REPLACE_WITH_CLUSTER_URL/my-cluster-kafka-bootstrap.kafka:9092/' \ | |
| kubectl apply --filename - | |
header_text "Waiting for Knative Apache Kafka Channel 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