#!/usr/bin/env bash # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Allocate a Kind cluster with Knative, Kourier and a local container registry. # set -o errexit set -o nounset set -o pipefail export TERM="${TERM:-dumb}" main() { local kubernetes_version=v1.21.1 local knative_version=v1.3.1 local kourier_version=v1.3.0 local em=$(tput bold)$(tput setaf 2) local me=$(tput sgr0) echo "${em}Allocating...${me}" kubernetes serving dns eventing networking registry configure next_steps echo "${em}DONE${me}" } kubernetes() { echo "${em}① Kubernetes${me}" cat <=n )); then echo "Unable to set knative domain" exit 1 fi echo 'Retrying...' sleep 5 done } networking() { echo "${em}④ Kourier Networking${me}" # Install Eourier kubectl apply --filename https://github.com/knative/net-kourier/releases/download/knative-$kourier_version/kourier.yaml sleep 5 kubectl wait pod --for=condition=Ready -l '!job-name' -n kourier-system --timeout=5m kubectl wait pod --for=condition=Ready -l '!job-name' -n knative-serving --timeout=5m # Configure Knative to use Kourier kubectl patch configmap/config-network \ --namespace knative-serving \ --type merge \ --patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}' # Create NodePort ingress for kourier kubectl apply -f - <Channel kubectl apply -f - << EOF apiVersion: v1 kind: ConfigMap metadata: name: config-br-defaults namespace: knative-eventing data: default-br-config: | # This is the cluster-wide default broker channel. clusterDefault: brokerClass: MTChannelBasedBroker apiVersion: v1 kind: ConfigMap name: imc-channel namespace: knative-eventing EOF } next_steps() { local red=$(tput bold)$(tput setaf 1) echo "${em}Configure Registry${me}" echo "If not in CI (running ci.sh): " echo " ${red}set registry as insecure${me} in the docker daemon config (/etc/docker/daemon.json on linux or ~/.docker/daemon.json on OSX):" echo " { \"insecure-registries\": [ \"localhost:50000\" ] }" } main "$@"