diff --git a/scripts/airgapped/get-all-images.sh b/scripts/airgapped/get-all-images.sh index fedf94cb..d9c3ed97 100755 --- a/scripts/airgapped/get-all-images.sh +++ b/scripts/airgapped/get-all-images.sh @@ -46,6 +46,9 @@ rm -rf resource-dispatcher # manually retrieve pipelines runner image to test pipelines IMAGES+=($(echo "charmedkubeflow/pipelines-runner:ckf-1.8")) +# manually retrieve helloworld image to test knative +IMAGES+=($(echo "ghcr.io/knative/helloworld-go:latest")) + # ensure we only show unique images IMAGES=($(echo "${IMAGES[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')) diff --git a/tests/airgapped/knative/README.md b/tests/airgapped/knative/README.md new file mode 100644 index 00000000..75b6b9e9 --- /dev/null +++ b/tests/airgapped/knative/README.md @@ -0,0 +1,37 @@ +# Testing Knative in airgapped + +This directory is dedicated to testing Knative in an airgapped environment. + +## Prerequisites + +Prepare the airgapped environment and deploy CKF by following the steps in [Airgapped test scripts](https://github.com/canonical/bundle-kubeflow/tree/main/tests/airgapped#testing-airgapped-installation). + +Once you run the test scripts, the `knative/helloworld-go` image used in the `helloworld` example will be included in your airgapped environment. It's specifically added in the [`get-all-images.sh` script](../../../scripts/airgapped/get-all-images.sh). + +## How to test Knative in an Airgapped environment +1. Connect to the dashboard by visiting the IP of your airgapped VM. To get the IP run: +``` +lxc ls | grep eth0 +``` +2. Log in to the dashboard and create a Profile. +3. Apply the `helloworld.yaml` found in this directory to your Profile's Namespace: +``` +kubectl apply -f ./helloworld.yaml -n +``` +4. Wait for the Knative Service to be `Ready` +``` +kubectl get ksvc -n +``` +Expected output: +``` +NAME URL LATESTCREATED LATESTREADY READY REASON +helloworld http://helloworld.admin.10.64.140.43.nip.io helloworld-00001 helloworld-00001 True +``` +5. Curl the Knative Service using the `URL` from the previous step +``` +curl -L http://helloworld.admin.10.64.140.43.nip.io +``` +Expected output: +``` +Hello World! +``` \ No newline at end of file diff --git a/tests/airgapped/knative/helloworld.yaml b/tests/airgapped/knative/helloworld.yaml new file mode 100644 index 00000000..096d23b2 --- /dev/null +++ b/tests/airgapped/knative/helloworld.yaml @@ -0,0 +1,19 @@ +# This example is based on the [Knative Serving tutorial](https://knative.dev/docs/getting-started/first-service/#__tabbed_1_2) +apiVersion: serving.knative.dev/v1 +kind: Service +metadata: + name: hello +spec: + template: + metadata: + labels: + # Disable istio sidecar due to https://github.com/canonical/kserve-operators/issues/216 + sidecar.istio.io/inject : "false" + spec: + containers: + - image: 172.17.0.2:5000/knative/helloworld-go:latest + ports: + - containerPort: 8080 + env: + - name: TARGET + value: "World"