1
0
mirror of https://github.com/ubuntu/microk8s.git synced 2021-05-23 02:23:41 +03:00

Update knative to 0.21 (#2153)

This commit is contained in:
Konstantinos Tsakalozos
2021-04-08 16:56:47 +03:00
committed by GitHub
parent 41fe39b2cb
commit af19a2e0a7
6 changed files with 39 additions and 75 deletions

View File

@@ -1,20 +0,0 @@
#!/bin/bash
set -eu
mkdir -p $KUBE_SNAP_BINS
(cd $KUBE_SNAP_BINS
# Knative is released only on amd64
if [ "$KUBE_ARCH" = "amd64" ]
then
# Knative, not quite binares but still fetcing.
mkdir -p knative-yaml/setup
curl -L https://github.com/knative/serving/releases/download/$KNATIVE_SERVING_VERSION/serving-crds.yaml -o ./knative-yaml/setup/serving-crds.yaml
curl -L https://github.com/knative/serving/releases/download/$KNATIVE_SERVING_VERSION/serving-core.yaml -o ./knative-yaml/serving-core.yaml
curl -L https://github.com/knative/eventing/releases/download/$KNATIVE_EVENTING_VERSION/eventing-crds.yaml -o ./knative-yaml/setup/eventing-crds.yaml
curl -L https://github.com/knative/eventing/releases/download/$KNATIVE_EVENTING_VERSION/eventing-core.yaml -o ./knative-yaml/eventing-core.yaml
curl -L https://github.com/knative/eventing/releases/download/$KNATIVE_EVENTING_VERSION/in-memory-channel.yaml -o ./knative-yaml/in-memory-channel.yaml
curl -L https://github.com/knative/eventing/releases/download/$KNATIVE_EVENTING_VERSION/channel-broker.yaml -o ./knative-yaml/channel-broker.yaml
curl -L https://github.com/knative/serving/releases/download/$KNATIVE_EVENTING_VERSION/monitoring-core.yaml -o ./knative-yaml/monitoring-core.yaml
fi
)

View File

@@ -6,8 +6,23 @@ source $SNAP/actions/common/utils.sh
echo "Disabling Knative"
# || true is there to handle race conditions in deleting resources
KUBECTL="$SNAP/kubectl --kubeconfig=${SNAP_DATA}/credentials/client.config"
$KUBECTL delete -f "$SNAP/actions/knative/" || true
declare -a yamls=("https://github.com/knative/serving/releases/download/v0.21.0/serving-core.yaml"
"https://github.com/knative/net-istio/releases/download/v0.21.0/net-istio.yaml"
"https://github.com/knative/serving/releases/download/v0.21.0/serving-default-domain.yaml"
"https://github.com/knative/eventing/releases/download/v0.21.0/eventing-core.yaml"
"https://github.com/knative/eventing/releases/download/v0.21.0/in-memory-channel.yaml"
"https://github.com/knative/eventing/releases/download/v0.21.0/mt-channel-broker.yaml"
"https://github.com/knative/serving/releases/download/v0.21.0/serving-crds.yaml"
"https://github.com/knative/eventing/releases/download/v0.21.0/eventing-crds.yaml"
)
# || true is there to handle race conditions in deleting resources
for yaml in "${yamls[@]}"
do
$KUBECTL delete -f "$yaml" 2>&1 > /dev/null || true
sleep 3
done
echo "Knative is terminating"

View File

@@ -6,49 +6,28 @@ source $SNAP/actions/common/utils.sh
echo "Enabling Knative"
# Knative require istio
"$SNAP/microk8s-enable.wrapper" istio
echo "Waiting for Istio to be ready"
JSONPATH='{range .items[*]}{range @.status.readyReplicas}{@}{"\n"}{end}{end}'
KUBECTL="$SNAP/kubectl --kubeconfig=${SNAP_DATA}/credentials/client.config"
# Wait for all 12 Istio deployments to be ready.
while ! [ $($KUBECTL get deployments -n istio-system -o jsonpath="$JSONPATH" | grep 1 | wc -l) -eq 12 ]
declare -a yamls=("https://github.com/knative/serving/releases/download/v0.21.0/serving-crds.yaml"
"https://github.com/knative/eventing/releases/download/v0.21.0/eventing-crds.yaml"
"https://github.com/knative/serving/releases/download/v0.21.0/serving-core.yaml"
"https://github.com/knative/net-istio/releases/download/v0.21.0/net-istio.yaml"
"https://github.com/knative/serving/releases/download/v0.21.0/serving-default-domain.yaml"
"https://github.com/knative/eventing/releases/download/v0.21.0/eventing-core.yaml"
"https://github.com/knative/eventing/releases/download/v0.21.0/in-memory-channel.yaml"
"https://github.com/knative/eventing/releases/download/v0.21.0/mt-channel-broker.yaml"
)
for yaml in "${yamls[@]}"
do
echo -n "."
sleep 2
$KUBECTL apply -f "$yaml"
sleep 3
done
echo
echo "Installing Knative CRDs"
n=0
until [ $n -ge 10 ]
do
sleep 3
($KUBECTL apply -f ${SNAP}/actions/knative/setup/) && break
n=$[$n+1]
if [ $n -ge 10 ]; then
echo "Knative failed to install"
exit 1
fi
done
echo "Installing Knative dependencies"
n=0
until [ $n -ge 10 ]
do
sleep 3
($KUBECTL apply -f ${SNAP}/actions/knative/eventing-core.yaml) && \
($KUBECTL apply -f ${SNAP}/actions/knative/serving-core.yaml) && \
($KUBECTL apply -f ${SNAP}/actions/knative/channel-broker.yaml) && \
($KUBECTL apply -f ${SNAP}/actions/knative/in-memory-channel.yaml) && \
($KUBECTL apply -f ${SNAP}/actions/knative/monitoring-core.yaml) && break
n=$[$n+1]
if [ $n -ge 10 ]; then
echo "Knative failed to install"
exit 1
fi
done
echo "Knative is starting"
echo ""
echo ""
echo "Visit https://knative.dev/docs/install/any-kubernetes-cluster/ to customize which broker channel"
echo "implementation is used and to specify which configurations are used for which namespaces."
echo ""

View File

@@ -66,8 +66,8 @@ microk8s-addons:
- name: "knative"
description: "The Knative framework on Kubernetes."
version: "0.13.0"
check_status: "clusterrole.rbac.authorization.k8s.io/knative"
version: "0.21.0"
check_status: "deployment.apps/eventing-webhook"
supported_architectures:
- amd64

View File

@@ -258,8 +258,6 @@ parts:
if [ -z "${KUBE_SNAP_BINS}" ]; then
. ./set-env-binaries-location.sh
fi
echo "Downloading binaries"
. ./fetch-other-binaries.sh
echo "Building k8s binaries"
. ./build-k8s-binaries.sh
else
@@ -272,13 +270,6 @@ parts:
bins/kubectl completion bash | sed "s/complete -o default -F __start_kubectl kubectl/complete -o default -F __start_kubectl microk8s kubectl/g" | sed "s/complete -o default -o nospace -F __start_kubectl kubectl/complete -o default -o nospace -F __start_kubectl kubectl/g" > kubectl.bash
bins/kubectl completion bash | sed "s/complete -o default -F __start_kubectl kubectl/complete -o default -F __start_kubectl microk8s.kubectl/g" | sed "s/complete -o default -o nospace -F __start_kubectl kubectl/complete -o default -o nospace -F __start_kubectl kubectl/g" > kubectl.bash
mkdir -p ./actions/
if [ "${ARCH}" = "amd64" ]
then
# Knative support
echo "Preparing knative"
cp -r $KUBE_SNAP_BINS/knative-yaml ./actions/knative
fi
snapcraftctl build
organize:
bins/*: .
@@ -286,7 +277,6 @@ parts:
- kubelite
- kubectl
- kubectl.bash
- actions
libmnl:
plugin: autotools

View File

@@ -1,4 +1,4 @@
apiVersion: serving.knative.dev/v1alpha1 # Current version of Knative
apiVersion: serving.knative.dev/v1 # Current version of Knative
kind: Service
metadata:
name: helloworld-go # The name of the app