Skip to content

Commit

Permalink
Merge pull request #5 from nicolaferraro/knative-1
Browse files Browse the repository at this point in the history
Add test and docs for Knative 1.0.0
  • Loading branch information
nicolaferraro committed Nov 8, 2021
2 parents e8b36d4 + 27d6796 commit fdfd7e7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 20 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ jobs:
fi
test-knative:
strategy:
matrix:
knative_version:
- v0.24.0
- v1.0.0
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -131,9 +136,9 @@ jobs:
- name: Create kind cluster
uses: ./
with:
knative_serving: v0.24.0
knative_kourier: v0.24.0
knative_eventing: v0.24.0
knative_serving: "${{ matrix.knative_version }}"
knative_kourier: "${{ matrix.knative_version }}"
knative_eventing: "${{ matrix.knative_version }}"

- name: Test
run: |
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ For more information on inputs, see the [API Documentation](https://developer.gi
- `log_level`: The log level for KinD
- `registry`: Configures an insecure registry on `kind-registry:5000` to be used with KinD (default: `true`)
- `kubectl_version`: The kubectl version to use (default: `v1.21.1`)
- `knative_serving`: The version of Knative Serving to install on the Kind cluster (not installed by default - example: `v0.24.0`)
- `knative_kourier`: The version of Knative Net Kourier to install on the Kind cluster (not installed by default - example: `v0.24.0`)
- `knative_eventing`: The version of Knative Eventing to install on the Kind cluster (not installed by default - example: `v0.24.0`)
- `knative_serving`: The version of Knative Serving to install on the Kind cluster (not installed by default - example: `v1.0.0`)
- `knative_kourier`: The version of Knative Net Kourier to install on the Kind cluster (not installed by default - example: `v1.0.0`)
- `knative_eventing`: The version of Knative Eventing to install on the Kind cluster (not installed by default - example: `v1.0.0`)

### Example Workflow

Expand Down Expand Up @@ -67,9 +67,9 @@ jobs:
- name: Kubernetes KinD Cluster
uses: container-tools/kind-action@v1
with:
knative_serving: v0.24.0
knative_kourier: v0.24.0
knative_eventing: v0.24.0
knative_serving: v1.0.0
knative_kourier: v1.0.0
knative_eventing: v1.0.0
```

This will install Knative Serving, Eventing and a Kourier Ingress on your Kind cluster. To make Knative run on Kind, resource request and limits are removed from the original Knative descriptors.
Expand Down
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ inputs:
kubectl_version:
description: "The version of kubectl to use (default: v1.20.0)"
knative_serving:
description: "The version of Knative Serving to install on the Kind cluster (not installed by default - example: v0.24.0)"
description: "The version of Knative Serving to install on the Kind cluster (not installed by default - example: v1.0.0)"
knative_kourier:
description: "The version of Knative Net Kourier to install on the Kind cluster (not installed by default - example: v0.24.0)"
description: "The version of Knative Net Kourier to install on the Kind cluster (not installed by default - example: v1.0.0)"
knative_eventing:
description: "The version of Knative Eventing to install on the Kind cluster (not installed by default - example: v0.24.0)"
description: "The version of Knative Eventing to install on the Kind cluster (not installed by default - example: v1.0.0)"
runs:
using: "node12"
main: "main.js"
Expand Down
28 changes: 20 additions & 8 deletions knative.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,14 @@ install_prerequisites() {
install_serving() {
# TODO find alternative to sleep
echo "Installing Knative Serving $serving_version..."
kubectl apply --filename https://github.com/knative/serving/releases/download/$serving_version/serving-crds.yaml
base=https://github.com/knative/serving/releases/download/$serving_version
if [[ $serving_version = v1* ]]; then
base=https://github.com/knative/serving/releases/download/knative-$serving_version
fi
kubectl apply --filename $base/serving-crds.yaml
echo "Waiting for resources to be initialized..."
sleep 5
curl -L -s https://github.com/knative/serving/releases/download/$serving_version/serving-core.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | yq 'del(.metadata.annotations."knative.dev/example-checksum")' -y | kubectl apply -f -
curl -L -s $base/serving-core.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | yq 'del(.metadata.annotations."knative.dev/example-checksum")' -y | kubectl apply -f -
echo "Waiting for resources to be initialized..."
sleep 60
kubectl get pod -n knative-serving
Expand All @@ -123,7 +127,11 @@ install_serving() {
install_kourier() {
# TODO find alternative to sleep
echo "Installing Knative Net Kourier $kourier_version..."
kubectl apply --filename https://github.com/knative-sandbox/net-kourier/releases/download/$kourier_version/kourier.yaml
base=https://github.com/knative-sandbox/net-kourier/releases/download/$kourier_version
if [[ $serving_version = v1* ]]; then
base=https://github.com/knative-sandbox/net-kourier/releases/download/knative-$kourier_version
fi
kubectl apply --filename $base/kourier.yaml
kubectl patch configmap/config-network \
--namespace knative-serving \
--type merge \
Expand All @@ -136,20 +144,24 @@ install_kourier() {
install_eventing() {
# TODO find alternative to sleep
echo "Installing Knative Eventing $eventing_version..."
kubectl apply --filename https://github.com/knative/eventing/releases/download/$eventing_version/eventing-crds.yaml
base=https://github.com/knative/eventing/releases/download/$eventing_version
if [[ $serving_version = v1* ]]; then
base=https://github.com/knative/eventing/releases/download/knative-$eventing_version
fi
kubectl apply --filename $base/eventing-crds.yaml
echo "Waiting for resources to be initialized..."
sleep 5
curl -L -s https://github.com/knative/eventing/releases/download/$eventing_version/eventing-core.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | yq 'del(.metadata.annotations."knative.dev/example-checksum")' -y | kubectl apply -f -
curl -L -s $base/eventing-core.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | yq 'del(.metadata.annotations."knative.dev/example-checksum")' -y | kubectl apply -f -
# Eventing channels
set +e
curl -L -s https://github.com/knative/eventing/releases/download/$eventing_version/in-memory-channel.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | yq 'del(.metadata.annotations."knative.dev/example-checksum")' -y | kubectl apply -f -
curl -L -s $base/in-memory-channel.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | yq 'del(.metadata.annotations."knative.dev/example-checksum")' -y | kubectl apply -f -
if [ $? -ne 0 ]; then
set -e
curl -L -s https://github.com/knative/eventing/releases/download/$eventing_version/in-memory-channel.yaml | kubectl apply -f -
curl -L -s $base/in-memory-channel.yaml | kubectl apply -f -
fi
set -e
# Eventing broker
curl -L -s https://github.com/knative/eventing/releases/download/$eventing_version/mt-channel-broker.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | yq 'del(.metadata.annotations."knative.dev/example-checksum")' -y | kubectl apply -f -
curl -L -s $base/mt-channel-broker.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | yq 'del(.metadata.annotations."knative.dev/example-checksum")' -y | kubectl apply -f -
echo "Waiting for resources to be initialized..."
sleep 30
kubectl get pod -n knative-eventing
Expand Down

0 comments on commit fdfd7e7

Please sign in to comment.