From b3feaf4164227dcd832f60b25e5c24aae362bc68 Mon Sep 17 00:00:00 2001 From: Sam O'Dell <31352624+samodell@users.noreply.github.com> Date: Sun, 22 Jul 2018 16:21:39 -0700 Subject: [PATCH] Buildpack sample edits (#222) * First edits to dotnet buildpack * Updates to buildpack nodejs sample * More edits to dotnet sample * Update README.md * Update README.md * Update README.md * Update README.md * Making Ryan's suggested changes - dotnet * Making Ryan's suggested changes - nodejs --- .../samples/buildpack-app-dotnet/README.md | 34 +++++++++++-------- .../buildpack-function-nodejs/README.md | 32 +++++++++-------- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/serving/samples/buildpack-app-dotnet/README.md b/serving/samples/buildpack-app-dotnet/README.md index f165f5cb5..eeeb5dc46 100644 --- a/serving/samples/buildpack-app-dotnet/README.md +++ b/serving/samples/buildpack-app-dotnet/README.md @@ -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 https://raw.githubusercontent.com/knative/build-templates/master/buildpack/buildpack.yaml ``` -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/" -perl -pi -e "s@DOCKER_REPO_OVERRIDE@$REPO@g" serving/samples/buildpack-app-dotnet/sample.yaml +# Replace with your own registry +export REPO="gcr.io/" + +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: @@ -50,17 +51,18 @@ 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. @@ -68,8 +70,12 @@ export SERVICE_HOST=`kubectl get route buildpack-sample-app -o jsonpath="{.statu # 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] ``` diff --git a/serving/samples/buildpack-function-nodejs/README.md b/serving/samples/buildpack-function-nodejs/README.md index 76434d7b6..901dea64a 100644 --- a/serving/samples/buildpack-function-nodejs/README.md +++ b/serving/samples/buildpack-function-nodejs/README.md @@ -1,22 +1,22 @@ # Buildpack Sample Function -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 https://raw.githubusercontent.com/knative/build-templates/master/buildpack/buildpack.yaml @@ -25,11 +25,12 @@ kubectl apply -f https://raw.githubusercontent.com/knative/build-templates/maste 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/" -perl -pi -e "s@DOCKER_REPO_OVERRIDE@$REPO@g" serving/samples/buildpack-function-nodejs/sample.yaml +# Replace with your own registry +export REPO="gcr.io/" -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: @@ -49,17 +50,17 @@ 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. @@ -67,9 +68,12 @@ $ export SERVICE_HOST=`kubectl get route buildpack-function -o jsonpath="{.statu # 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] ```