Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions serving/samples/buildpack-app-dotnet/README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
# Buildpack Sample App

A sample app that demonstrates usage of Cloud Foundry buildpacks on Knative Serving,
using the [packs Docker images](https://github.com/sclevine/packs).
A sample app that demonstrates using [Cloud Foundry](https://www.cloudfoundry.org/)
buildpacks on Knative Serving, using the [packs Docker images](https://github.com/sclevine/packs).

This deploys the [.NET Core Hello World](https://github.com/cloudfoundry-samples/dotnet-core-hello-world)
sample app for Cloud Foundry.

## Prerequisites

[Install Knative Serving](https://github.com/knative/docs/blob/master/install/README.md)
* [Install Knative Serving](../../../install/README.md)

## Running

This sample uses the [Buildpack build
template](https://github.com/knative/build-templates/blob/master/buildpack/buildpack.yaml)
in the [build-templates](https://github.com/knative/build-templates/) repo.

First, install the Buildpack build template from that repo:
Save a copy of `buildpack.yaml`, then install it:

```shell
kubectl apply -f buildpack.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do I get this file from? Maybe call out to save it from the [Buildpack build template] link?

```

Then you can deploy this to Knative Serving from the root directory via:
Then you can deploy this to Knative Serving from the root directory
by entering the following commands:

```shell
# Replace the token string with a suitable registry
REPO="gcr.io/<your-project-here>"
perl -pi -e "s@DOCKER_REPO_OVERRIDE@$REPO@g" serving/samples/buildpack-app-dotnet/sample.yaml
# Replace <your-project-here> with your own registry
export REPO="gcr.io/<your-project-here>"

perl -pi -e "s@DOCKER_REPO_OVERRIDE@$REPO@g" sample.yaml

# Create the Kubernetes resources
kubectl apply -f serving/samples/buildpack-app-dotnet/sample.yaml
kubectl apply -f sample.yaml
```

Once deployed, you will see that it first builds:
Expand All @@ -50,26 +51,31 @@ items:
...
```

Once the `BuildComplete` status becomes `True` the resources will start getting created.
Once the `BuildComplete` status is `True`, resource creation begins.

To access this service using `curl`, we first need to determine its ingress address:

To access this service via `curl`, we first need to determine its ingress address:
```shell
$ watch kubectl get svc knative-ingressgateway -n istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
```

Once the `ADDRESS` gets assigned to the cluster, you can run:
Once the `EXTERNAL-IP` gets assigned to the cluster, enter the follow commands to capture
the host URL and the IP of the ingress endpoint in environment variables:

```shell
# Put the Host name into an environment variable.
export SERVICE_HOST=`kubectl get route buildpack-sample-app -o jsonpath="{.status.domain}"`

# Put the ingress IP into an environment variable.
export SERVICE_IP=`kubectl get svc knative-ingressgateway -n istio-system -o jsonpath="{.status.loadBalancer.ingress[*].ip}"`
```

# Curl the ingress IP "as-if" DNS were properly configured.
Now curl the service IP to make sure the deployment succeeded:

```shell
# Curl the ingress IP as if DNS were properly configured
curl --header "Host: $SERVICE_HOST" http://${SERVICE_IP}/
[response]
```
Expand Down
32 changes: 18 additions & 14 deletions serving/samples/buildpack-function-nodejs/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Buildpack Sample Function
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my comments above apply here too, so I won't repeat them.


A sample function that demonstrates usage of Cloud Foundry buildpacks on
Knative Serving, using the [packs Docker images](https://github.com/sclevine/packs).
A sample function that demonstrates using [Cloud Foundry](https://www.cloudfoundry.org/)
buildpacks on Knative Serving, using the [packs Docker images](https://github.com/sclevine/packs).

This deploys the [riff square](https://github.com/scothis/riff-square-buildpack)
sample function for riff.

## Prerequisites

[Install Knative Serving](https://github.com/knative/docs/blob/master/install/README.md)
* [Install Knative Serving](../../../install/README.md)

## Running

This sample uses the [Buildpack build
template](https://github.com/knative/build-templates/blob/master/buildpack/buildpack.yaml)
in the [build-templates](https://github.com/knative/build-templates/) repo.
from the [build-templates](https://github.com/knative/build-templates/) repo.

First, install the Buildpack build template from that repo:
Save a copy of `buildpack.yaml`, then install it:

```shell
kubectl apply -f buildpack.yaml
Expand All @@ -25,11 +25,12 @@ kubectl apply -f buildpack.yaml
Then you can deploy this to Knative Serving from the root directory via:

```shell
# Replace the token string with a suitable registry
REPO="gcr.io/<your-project-here>"
perl -pi -e "s@DOCKER_REPO_OVERRIDE@$REPO@g" serving/samples/buildpack-function-nodejs/sample.yaml
# Replace <your-project-here> with your own registry
export REPO="gcr.io/<your-project-here>"

kubectl apply -f serving/samples/buildpack-function-nodejs/sample.yaml
perl -pi -e "s@DOCKER_REPO_OVERRIDE@$REPO@g" sample.yaml

kubectl apply -f sample.yaml
```

Once deployed, you will see that it first builds:
Expand All @@ -49,27 +50,30 @@ items:
...
```

Once the `BuildComplete` status becomes `True` the resources will start getting created.

Once the `BuildComplete` status is `True`, resource creation begins.

To access this service via `curl`, we first need to determine its ingress address:
To access this service using `curl`, we first need to determine its ingress address:
```shell
watch kubectl get svc knative-ingressgateway -n istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
```

Once the `EXTERNAL-IP` gets assigned to the cluster, you can run:
Once the `EXTERNAL-IP` gets assigned to the cluster, enter the follow commands to capture
the host URL and the IP of the ingress endpoint in environment variables:

```shell
# Put the Host name into an environment variable.
$ export SERVICE_HOST=`kubectl get route buildpack-function -o jsonpath="{.status.domain}"`

# Put the ingress IP into an environment variable.
$ export SERVICE_IP=`kubectl get svc knative-ingressgateway -n istio-system -o jsonpath="{.status.loadBalancer.ingress[*].ip}"`
```

Now curl the service IP to make sure the deployment succeeded:

# Curl the ingress IP "as-if" DNS were properly configured.
```shell
# Curl the ingress IP as if DNS were properly configured
$ curl http://${SERVICE_IP}/ -H "Host: $SERVICE_HOST" -H "Content-Type: application/json" -d "33"
[response]
```
Expand Down