mirror of https://github.com/knative/docs.git
Migrate serving samples away from features disabled in 0.7. (#1439)
Eliminate several samples using JIT Builds. Stop using `.status.domain` everywhere. Fixes: #1438
This commit is contained in:
parent
e406c71542
commit
d1733f7a2c
|
@ -157,9 +157,9 @@ folder) you're ready to build and deploy the sample app.
|
||||||
1. To find the URL for your service, use
|
1. To find the URL for your service, use
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl get ksvc helloworld-clojure --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-clojure --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-clojure helloworld-clojure.default.example.com
|
helloworld-clojure http://helloworld-clojure.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now you can make a request to your app to see the results. Replace
|
1. Now you can make a request to your app to see the results. Replace
|
||||||
|
|
|
@ -156,9 +156,9 @@ folder) you're ready to build and deploy the sample app.
|
||||||
1. To find the URL for your service, use
|
1. To find the URL for your service, use
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl get ksvc helloworld-dart --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-dart --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-dart helloworld-dart.default.example.com
|
helloworld-dart http://helloworld-dart.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now you can make a request to your app to see the result. Replace
|
1. Now you can make a request to your app to see the result. Replace
|
||||||
|
|
|
@ -179,10 +179,10 @@ above.
|
||||||
1. To find the URL for your service, use
|
1. To find the URL for your service, use
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl get ksvc helloworld-elixir --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-elixir --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
|
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-elixir helloworld-elixir.default.example.com
|
helloworld-elixir http://helloworld-elixir.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now you can make a request to your app to see the results. Replace
|
1. Now you can make a request to your app to see the results. Replace
|
||||||
|
|
|
@ -190,9 +190,9 @@ folder) you're ready to build and deploy the sample app.
|
||||||
1. To find the URL for your service, enter:
|
1. To find the URL for your service, enter:
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl get ksvc helloworld-haskell --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-haskell --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-haskell helloworld-haskell.default.example.com
|
helloworld-haskell http://helloworld-haskell.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now you can make a request to your app and see the result. Replace
|
1. Now you can make a request to your app and see the result. Replace
|
||||||
|
|
|
@ -276,14 +276,14 @@ To verify that your sample app has been successfully deployed:
|
||||||
command:
|
command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get services.serving.knative.dev helloworld-java-micronaut --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get services.serving.knative.dev helloworld-java-micronaut --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
```
|
```
|
||||||
|
|
||||||
Example result:
|
Example result:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-java-micronaut helloworld-java-micronaut.default.example.com
|
helloworld-java-micronaut http://helloworld-java-micronaut.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Run the following `curl` command to test your deployed sample app. You must
|
1. Run the following `curl` command to test your deployed sample app. You must
|
||||||
|
|
|
@ -277,19 +277,15 @@ folder) you're ready to build and deploy the sample app.
|
||||||
```shell
|
```shell
|
||||||
kubectl get ksvc helloworld-java-quarkus
|
kubectl get ksvc helloworld-java-quarkus
|
||||||
|
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-java-quarkus helloworld-java-quarkus.default.example.com
|
helloworld-java-quarkus http://helloworld-java-quarkus.default.example.com
|
||||||
|
|
||||||
# Or simply:
|
|
||||||
export DOMAIN_NAME=$(kubectl get ksvc helloworld-java-quarkus \
|
|
||||||
--output jsonpath={.status.domain}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now you can make a request to your app to see the result. Presuming, the IP
|
1. Now you can make a request to your app to see the result. Presuming, the IP
|
||||||
address you got in the step above is in the `${IP_ADDRESS}` env variable:
|
address you got in the step above is in the `${IP_ADDRESS}` env variable:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl -H "Host: ${DOMAIN_NAME}" http://${IP_ADDRESS}
|
curl -H "Host: helloworld-java-quarkus.default.example.com" http://${IP_ADDRESS}
|
||||||
|
|
||||||
Namaste Knative World!
|
Namaste Knative World!
|
||||||
```
|
```
|
||||||
|
|
|
@ -181,9 +181,9 @@ folder) you're ready to build and deploy the sample app.
|
||||||
1. To find the URL for your service, enter:
|
1. To find the URL for your service, enter:
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl get ksvc helloworld-rust --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-rust --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-rust helloworld-rust.default.example.com
|
helloworld-rust http://helloworld-rust.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now you can make a request to your app and see the result. Replace
|
1. Now you can make a request to your app and see the result. Replace
|
||||||
|
|
|
@ -155,9 +155,9 @@ folder) you're ready to build and deploy the sample app.
|
||||||
1. To find the URL for your service, use the following command:
|
1. To find the URL for your service, use the following command:
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl get ksvc helloworld-swift --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-swift --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-swift helloworld-swift.default.example.com
|
helloworld-swift http://helloworld-swift.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now you can make a request to your app to see the result. Replace
|
1. Now you can make a request to your app to see the result. Replace
|
||||||
|
|
|
@ -243,14 +243,14 @@ To verify that your sample app has been successfully deployed:
|
||||||
command:
|
command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get services.serving.knative.dev helloworld-vertx --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get services.serving.knative.dev helloworld-vertx --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
```
|
```
|
||||||
|
|
||||||
Example result:
|
Example result:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-vertx helloworld-vertx.default.example.com
|
helloworld-vertx http://helloworld-vertx.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Run the following `curl` command to test your deployed sample app. You must
|
1. Run the following `curl` command to test your deployed sample app. You must
|
||||||
|
|
|
@ -232,14 +232,14 @@ http://192.168.99.230:31864
|
||||||
Run the following command to find the domain URL for your service:
|
Run the following command to find the domain URL for your service:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
kubectl get ksvc helloworld-go -n default --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-go -n default --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
```
|
```
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-go helloworld-go.default.example.com
|
helloworld-go http://helloworld-go.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
Test your app by sending it a request. Use the following `curl` command with the
|
Test your app by sending it a request. Use the following `curl` command with the
|
||||||
|
|
|
@ -130,21 +130,15 @@ assigned an external IP address.
|
||||||
1. To find the host URL for your service, enter:
|
1. To find the host URL for your service, enter:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get route helloworld-go --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get route helloworld-go --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-go helloworld-go.default.example.com
|
helloworld-go http://helloworld-go.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note: By default, Knative uses the `example.com` domain. To configure a
|
> Note: By default, Knative uses the `example.com` domain. To configure a
|
||||||
> custom DNS domain, see
|
> custom DNS domain, see
|
||||||
> [Using a Custom Domain](../serving/using-a-custom-domain.md).
|
> [Using a Custom Domain](../serving/using-a-custom-domain.md).
|
||||||
|
|
||||||
You can also export the host URL as a variable using the following command:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
export HOST_URL=$(kubectl get route helloworld-go --output jsonpath='{.status.domain}')
|
|
||||||
```
|
|
||||||
|
|
||||||
If you changed the name from `helloworld-go` to something else when creating
|
If you changed the name from `helloworld-go` to something else when creating
|
||||||
the `.yaml` file, replace `helloworld-go` in the above commands with the name
|
the `.yaml` file, replace `helloworld-go` in the above commands with the name
|
||||||
you entered.
|
you entered.
|
||||||
|
@ -159,14 +153,6 @@ assigned an external IP address.
|
||||||
Hello World: Go Sample v1!
|
Hello World: Go Sample v1!
|
||||||
```
|
```
|
||||||
|
|
||||||
If you exported the host URL and IP address as variables in the previous
|
|
||||||
steps, you can use those variables to simplify your cURL request:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
curl -H "Host: ${HOST_URL}" http://${IP_ADDRESS}
|
|
||||||
Hello World: Go Sample v1!
|
|
||||||
```
|
|
||||||
|
|
||||||
If you deployed your own app, you might want to customize this cURL request
|
If you deployed your own app, you might want to customize this cURL request
|
||||||
to interact with your application.
|
to interact with your application.
|
||||||
|
|
||||||
|
|
|
@ -216,14 +216,14 @@ to the IBM Container Registry, we will use the Kaniko build template.
|
||||||
1. Run the following command to find the domain URL for your service:
|
1. Run the following command to find the domain URL for your service:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get ksvc helloworld-go --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-go --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
```
|
```
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-go helloworld-go.default.example.com
|
helloworld-go http://helloworld-go.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Test your app by sending it a request. Use the following `curl` command with
|
1. Test your app by sending it a request. Use the following `curl` command with
|
||||||
|
|
|
@ -1,255 +0,0 @@
|
||||||
This sample demonstrates:
|
|
||||||
|
|
||||||
- Pulling source code from a private Github repository using a deploy-key
|
|
||||||
- Pushing a Docker container to a private DockerHub repository using a username
|
|
||||||
/ password
|
|
||||||
- Deploying to Knative Serving using image pull secrets
|
|
||||||
|
|
||||||
## Before you begin
|
|
||||||
|
|
||||||
- [Install Knative Serving](../../../install/README.md)
|
|
||||||
- Download a copy of the code:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
git clone -b "release-0.6" https://github.com/knative/docs knative-docs
|
|
||||||
cd knative-docs/serving/samples/build-private-repo-go
|
|
||||||
```
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
### 1. Setting up the default service account
|
|
||||||
|
|
||||||
Knative Serving will run pods as the default service account in the namespace
|
|
||||||
where you created your resources. You can see its body by entering the following
|
|
||||||
command:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ kubectl get serviceaccount default --output yaml
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: default
|
|
||||||
namespace: default
|
|
||||||
...
|
|
||||||
secrets:
|
|
||||||
- name: default-token-zd84v
|
|
||||||
```
|
|
||||||
|
|
||||||
We are going to add to this an image pull Secret.
|
|
||||||
|
|
||||||
1. Create your image pull Secret with the following command, replacing values as
|
|
||||||
necessary:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
kubectl create secret docker-registry dockerhub-pull-secret \
|
|
||||||
--docker-server=https://index.docker.io/v1/ --docker-email=not@val.id \
|
|
||||||
--docker-username=<your-name> --docker-password=<your-pword>
|
|
||||||
```
|
|
||||||
|
|
||||||
To learn more about Kubernetes pull Secrets, see
|
|
||||||
[Creating a Secret in the cluster that holds your authorization token](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-secret-in-the-cluster-that-holds-your-authorization-token).
|
|
||||||
|
|
||||||
2. Add the newly created `imagePullSecret` to your default service account by
|
|
||||||
entering:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
kubectl edit serviceaccount default
|
|
||||||
```
|
|
||||||
|
|
||||||
This will open the resource in your default text editor. Under `secrets:`,
|
|
||||||
add:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
secrets:
|
|
||||||
- name: default-token-zd84v
|
|
||||||
# This is the secret we just created:
|
|
||||||
imagePullSecrets:
|
|
||||||
- name: dockerhub-pull-secret
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Configuring the build
|
|
||||||
|
|
||||||
The objects in this section are all defined in `build-bot.yaml`, and the fields
|
|
||||||
that need to be changed say `REPLACE_ME`. Open the `build-bot.yaml` file and
|
|
||||||
make the necessary replacements.
|
|
||||||
|
|
||||||
The following sections explain the different configurations in the
|
|
||||||
`build-bot.yaml` file, as well as the necessary changes for each section.
|
|
||||||
|
|
||||||
#### Setting up our Build service account
|
|
||||||
|
|
||||||
To separate our Build's credentials from our applications credentials, the Build
|
|
||||||
runs as its own service account:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: build-bot
|
|
||||||
secrets:
|
|
||||||
- name: deploy-key
|
|
||||||
- name: dockerhub-push-secrets
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Creating a deploy key
|
|
||||||
|
|
||||||
You can set up a deploy key for a private Github repository following
|
|
||||||
[these](https://developer.github.com/v3/guides/managing-deploy-keys/)
|
|
||||||
instructions. The deploy key in the `build-bot.yaml` file in this folder is
|
|
||||||
_real_; you do not need to change it for the sample to work.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: deploy-key
|
|
||||||
annotations:
|
|
||||||
# This tells us that this credential is for use with
|
|
||||||
# github.com repositories.
|
|
||||||
build.knative.dev/git-0: github.com
|
|
||||||
type: kubernetes.io/ssh-auth
|
|
||||||
data:
|
|
||||||
# Generated by:
|
|
||||||
# cat id_rsa | base64 -w 0
|
|
||||||
ssh-privatekey: <long string>
|
|
||||||
|
|
||||||
# Generated by:
|
|
||||||
# ssh-keyscan github.com | base64 -w 0
|
|
||||||
known_hosts: <long string>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Creating a DockerHub push credential
|
|
||||||
|
|
||||||
Create a new Secret for your DockerHub credentials. Replace the necessary
|
|
||||||
values:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: dockerhub-push-secrets
|
|
||||||
annotations:
|
|
||||||
build.knative.dev/docker-0: https://index.docker.io/v1/
|
|
||||||
type: kubernetes.io/basic-auth
|
|
||||||
stringData:
|
|
||||||
username: <dockerhub-user>
|
|
||||||
password: <dockerhub-password>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Creating the build bot
|
|
||||||
|
|
||||||
When finished with the replacements, create the build bot by entering the
|
|
||||||
following command:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
kubectl create --filename build-bot.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Installing a Build template and updating `manifest.yaml`
|
|
||||||
|
|
||||||
1. Install the
|
|
||||||
[Kaniko build template](https://github.com/knative/build-templates/blob/master/kaniko/kaniko.yaml)
|
|
||||||
by entering the following command:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
kubectl apply --filename https://raw.githubusercontent.com/knative/build-templates/master/kaniko/kaniko.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
1. Open `manifest.yaml` and substitute your private DockerHub repository name
|
|
||||||
for `REPLACE_ME`.
|
|
||||||
|
|
||||||
## Deploying your application
|
|
||||||
|
|
||||||
At this point, you're ready to deploy your application:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
kubectl create --filename manifest.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
To make sure everything works, capture the host URL and the IP of the ingress
|
|
||||||
endpoint in environment variables:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# Put the Host URL into an environment variable.
|
|
||||||
export SERVICE_HOST=$(kubectl get route private-repos \
|
|
||||||
--output jsonpath="{.status.domain}")
|
|
||||||
```
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# In Knative 0.2.x and prior versions, the `knative-ingressgateway` service was used instead of `istio-ingressgateway`.
|
|
||||||
INGRESSGATEWAY=knative-ingressgateway
|
|
||||||
INGRESSGATEWAY_LABEL=knative
|
|
||||||
|
|
||||||
# The use of `knative-ingressgateway` is deprecated in Knative v0.3.x.
|
|
||||||
# Use `istio-ingressgateway` instead, since `knative-ingressgateway`
|
|
||||||
# will be removed in Knative v0.4.
|
|
||||||
if kubectl get configmap config-istio -n knative-serving &> /dev/null; then
|
|
||||||
INGRESSGATEWAY=istio-ingressgateway
|
|
||||||
INGRESSGATEWAY_LABEL=istio
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Put the IP address into an environment variable
|
|
||||||
export SERVICE_IP=$(kubectl get svc $INGRESSGATEWAY --namespace istio-system \
|
|
||||||
--output jsonpath="{.status.loadBalancer.ingress[*].ip}")
|
|
||||||
```
|
|
||||||
|
|
||||||
> Note: If your cluster is running outside a cloud provider (for example, on
|
|
||||||
> Minikube), your services will never get an external IP address. In that case,
|
|
||||||
> use the Istio `hostIP` and `nodePort` as the service IP:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
export SERVICE_IP=$(kubectl get po --selector $INGRESSGATEWAY_LABEL=ingressgateway --namespace istio-system \
|
|
||||||
--output 'jsonpath= . {.items[0].status.hostIP}'):$(kubectl get svc $INGRESSGATEWAY \
|
|
||||||
--namespace istio-system --output 'jsonpath={.spec.ports[? (@.port==80)].nodePort}')
|
|
||||||
```
|
|
||||||
|
|
||||||
Now curl the service IP to make sure the deployment succeeded:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
curl -H "Host: $SERVICE_HOST" http://$SERVICE_IP
|
|
||||||
```
|
|
||||||
|
|
||||||
## Appendix: Sample Code
|
|
||||||
|
|
||||||
The sample code is in a private Github repository consisting of two files.
|
|
||||||
|
|
||||||
1. `Dockerfile`
|
|
||||||
|
|
||||||
```Dockerfile
|
|
||||||
# Use golang:alpine to optimize the image size.
|
|
||||||
# See https://hub.docker.com/_/golang/ for more information
|
|
||||||
# about the difference between golang and golang:alpine.
|
|
||||||
FROM golang:alpine
|
|
||||||
|
|
||||||
ENV GOPATH /go
|
|
||||||
|
|
||||||
ADD . /go/src/github.com/dewitt/knative-build
|
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 go build github.com/dewitt/knative-build
|
|
||||||
|
|
||||||
ENTRYPOINT ["knative-build"]
|
|
||||||
```
|
|
||||||
|
|
||||||
1. `main.go`
|
|
||||||
|
|
||||||
```go
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"
|
|
||||||
"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
port = ":8080"
|
|
||||||
)
|
|
||||||
|
|
||||||
func helloWorld(w http.ResponseWriter, r *http.Request) {
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
```
|
|
|
@ -1,8 +0,0 @@
|
||||||
---
|
|
||||||
title: "Deploying to Knative from a Private GitHub Repo - Go"
|
|
||||||
linkTitle: "Private GitHub repo - Go"
|
|
||||||
weight: 1
|
|
||||||
type: "docs"
|
|
||||||
---
|
|
||||||
|
|
||||||
{{% readfile file="README.md" relative="true" markdown="true" %}}
|
|
|
@ -1,50 +0,0 @@
|
||||||
# Copyright 2018 The Knative Authors
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: dockerhub-push-secrets
|
|
||||||
annotations:
|
|
||||||
build.knative.dev/docker-0: https://index.docker.io/v1/
|
|
||||||
type: kubernetes.io/basic-auth
|
|
||||||
data:
|
|
||||||
# Generated by:
|
|
||||||
# echo -n dockerhub-user | base64
|
|
||||||
username: REPLACE_ME
|
|
||||||
# Generated by:
|
|
||||||
# echo -n dockerhub-password | base64
|
|
||||||
password: REPLACE_ME
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: deploy-key
|
|
||||||
annotations:
|
|
||||||
build.knative.dev/git-0: github.com
|
|
||||||
type: kubernetes.io/ssh-auth
|
|
||||||
data:
|
|
||||||
# Generated by:
|
|
||||||
# cat id_rsa | base64 -w 0
|
|
||||||
ssh-privatekey: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlKS1FJ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UZXWXBxYkNXczZuc0hrVFIKLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K
|
|
||||||
# Generated by:
|
|
||||||
# ssh-keyscan github.com | base64 -w 0
|
|
||||||
known_hosts: Z2l0aHViLmNvbSBzc2gtcnNhIEFBQUFCM056YUMxeWMyRUFBQUFCSXdBQUFRRUFxMkE3aFJHbWRubTl0VURiTzlJRFN3Qks2VGJRYStQWFlQQ1B5NnJiVHJUdHc3UEhrY2NLcnBwMHlWaHA1SGRFSWNLcjZwTGxWREJmT0xYOVFVc3lDT1Ywd3pmaklKTmxHRVlzZGxMSml6SGhibjJtVWp2U0FIUXFaRVRZUDgxZUZ6TFFOblBIdDRFVlZVaDdWZkRFU1U4NEtlem1ENVFsV3BYTG12VTMxL3lNZitTZTh4aEhUdktTQ1pJRkltV3dvRzZtYlVvV2Y5bnpwSW9hU2pCK3dlcXFVVW1wYWFhc1hWYWw3MkorVVgyQisyUlBXM1JjVDBlT3pRZ3FsSkwzUktyVEp2ZHNqRTNKRUF2R3EzbEdIU1pYeTI4RzNza3VhMlNtVmkvdzR5Q0U2Z2JPRHFuVFdsZzcrd0M2MDR5ZEdYQThWSmlTNWFwNDNKWGlVRkZBYVE9PQo=
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: build-bot
|
|
||||||
secrets:
|
|
||||||
- name: deploy-key
|
|
||||||
- name: dockerhub-push-secrets
|
|
|
@ -1,51 +0,0 @@
|
||||||
-----BEGIN RSA PRIVATE KEY-----
|
|
||||||
MIIJKQIBAAKCAgEAo+vrdfnaxya3KtPdF8ErHrZsKm2B0CBnEPgBIVXQvaGMmJ1o
|
|
||||||
30VwpcfJSGbYwhxRRAD8BRvYgTLejDJcrfhYnSd5FPaG1RFk6tc/3gU3/adtg3EQ
|
|
||||||
0FF7RG/nUrBvQCVz4WsDy/RYCtvdryUGs0o2CjJbMDTcXtEqx8IN3Ghy9z481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t
|
|
||||||
50dE+Q39jWLT3IFVgHK7UqKQxxXk3VJk2jZQfcyINyw39rB12i6CXgn1huFgWVAX
|
|
||||||
WEemNYl/TmGXSvYSulPenk6CiU9SZ6FQWvapb7ekkcgmFWYpqbCWs6nsHkTR
|
|
||||||
-----END RSA PRIVATE KEY-----
|
|
|
@ -1 +0,0 @@
|
||||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCj6+t1+drHJrcq090XwSsetmwqbYHQIGcQ+AEhVdC9oYyYnWjfRXClx8lIZtjCHFFEAPwFG9iBMt6MMlyt+FidJ3kU9obVEWTq1z/eBTf9p22DcRDQUXtEb+dSsG9AJXPhawPL9FgK292vJQazSjYKMlswNNxe0SrHwg3caHL3PjzVOfRaZYGaCleuxeN3Jtmil17ocBCN1x+3U2uoRhq+10+M02hJxe8+anfTj54CvBgxCk4HSqRKiwdXKNe1GoAnR5OIjHAqTs2Co3TxmJ2t+XWgN89S3wmDThV1Dm52TILjANCfwpMjZhARx4ngp4S35fYAEGXtQ1DNrpYp2WVHjV9qmcYeDwqhV+cQUcVH/+es+QztzvFOcgg9uTMQFx3ixrs2QeSvigqJGRQp2fH4MUgFfhvsTweTsAIkzuOb035UeznpxqUnlQV18ft3xJ+xusCOxlSL/HsaXQqdOUMxa3EJC3vVCSZduYM19i++UDVAfCDQhdhHdQOhYWxaC1RNx5grNc+Dwqkr10yQ2RsTgtYsnHPftxtrrSWzjwWKqOU8c7pifz+vSvrpWYGAA/eX/Vou4B5tFuGmdTJdmI2QoEVHS+TD1loT0caTD2mx1KCEZXQ2oexRYrPu6DbtnOWSwZL/4lKbr2uzU0ebZD0wAtm6HnptNcHpWei3DPRi4w== noreply@google.com
|
|
|
@ -1,46 +0,0 @@
|
||||||
# Copyright 2018 The Knative Authors
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
apiVersion: serving.knative.dev/v1alpha1
|
|
||||||
kind: Route
|
|
||||||
metadata:
|
|
||||||
name: private-repos
|
|
||||||
spec:
|
|
||||||
traffic:
|
|
||||||
- configurationName: private-repos
|
|
||||||
percent: 100
|
|
||||||
---
|
|
||||||
apiVersion: serving.knative.dev/v1alpha1
|
|
||||||
kind: Configuration
|
|
||||||
metadata:
|
|
||||||
name: private-repos
|
|
||||||
spec:
|
|
||||||
build:
|
|
||||||
# Run this build as our build-bot
|
|
||||||
serviceAccountName: build-bot
|
|
||||||
source:
|
|
||||||
git:
|
|
||||||
url: git@github.com:dewitt/knative-build.git
|
|
||||||
revision: master
|
|
||||||
template:
|
|
||||||
name: kaniko
|
|
||||||
arguments:
|
|
||||||
- name: IMAGE
|
|
||||||
value: REPLACE_ME
|
|
||||||
revisionTemplate:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
knative.dev/type: app
|
|
||||||
spec:
|
|
||||||
container:
|
|
||||||
image: REPLACE_ME
|
|
|
@ -1,104 +0,0 @@
|
||||||
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](../../../install/README.md)
|
|
||||||
|
|
||||||
## Running
|
|
||||||
|
|
||||||
This sample uses the
|
|
||||||
[Buildpack build template](https://github.com/knative/build-templates/blob/master/buildpacks/cnb.yaml)
|
|
||||||
in the [build-templates](https://github.com/knative/build-templates/) repo. Save
|
|
||||||
a copy of `buildpack.yaml`, then install it:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
kubectl apply --filename https://raw.githubusercontent.com/knative/build-templates/master/buildpack/buildpack.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
Then you can deploy this to Knative Serving from the root directory by entering
|
|
||||||
the following commands:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# 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 --filename sample.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
Once deployed, you will see that it first builds:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ kubectl get revision --output yaml
|
|
||||||
apiVersion: v1
|
|
||||||
items:
|
|
||||||
- apiVersion: serving.knative.dev/v1alpha1
|
|
||||||
kind: Revision
|
|
||||||
...
|
|
||||||
status:
|
|
||||||
conditions:
|
|
||||||
- reason: Building
|
|
||||||
status: "False"
|
|
||||||
type: BuildComplete
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
Once the `BuildComplete` status is `True`, resource creation begins.
|
|
||||||
|
|
||||||
To access this service using `curl`, we first need to determine its ingress
|
|
||||||
address:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# In Knative 0.2.x and prior versions, the `knative-ingressgateway` service was used instead of `istio-ingressgateway`.
|
|
||||||
INGRESSGATEWAY=knative-ingressgateway
|
|
||||||
|
|
||||||
# The use of `knative-ingressgateway` is deprecated in Knative v0.3.x.
|
|
||||||
# Use `istio-ingressgateway` instead, since `knative-ingressgateway`
|
|
||||||
# will be removed in Knative v0.4.
|
|
||||||
if kubectl get configmap config-istio -n knative-serving &> /dev/null; then
|
|
||||||
INGRESSGATEWAY=istio-ingressgateway
|
|
||||||
fi
|
|
||||||
|
|
||||||
watch kubectl get svc $INGRESSGATEWAY --namespace istio-system
|
|
||||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
|
||||||
xxxxxxx-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, 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 --output jsonpath="{.status.domain}"`
|
|
||||||
|
|
||||||
# Put the ingress IP into an environment variable.
|
|
||||||
export SERVICE_IP=`kubectl get svc $INGRESSGATEWAY --namespace istio-system --output jsonpath="{.status.loadBalancer.ingress[*].ip}"`
|
|
||||||
```
|
|
||||||
|
|
||||||
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]
|
|
||||||
```
|
|
||||||
|
|
||||||
## Cleaning up
|
|
||||||
|
|
||||||
To clean up the sample service:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# Clean up the serving resources
|
|
||||||
kubectl delete --filename docs/serving/samples/buildpack-app-dotnet/sample.yaml
|
|
||||||
# Clean up the build template
|
|
||||||
kubectl delete buildtemplate buildpack
|
|
||||||
```
|
|
|
@ -1,8 +0,0 @@
|
||||||
---
|
|
||||||
title: "Buildpack Sample App - .NET"
|
|
||||||
linkTitle: "Buildpack app - .NET"
|
|
||||||
weight: 1
|
|
||||||
type: "docs"
|
|
||||||
---
|
|
||||||
|
|
||||||
{{% readfile file="README.md" relative="true" markdown="true" %}}
|
|
|
@ -1,40 +0,0 @@
|
||||||
apiVersion: serving.knative.dev/v1alpha1
|
|
||||||
kind: Configuration
|
|
||||||
metadata:
|
|
||||||
name: buildpack-sample-app
|
|
||||||
namespace: default
|
|
||||||
spec:
|
|
||||||
build:
|
|
||||||
source:
|
|
||||||
git:
|
|
||||||
url: https://github.com/cloudfoundry-samples/dotnet-core-hello-world
|
|
||||||
revision: master
|
|
||||||
template:
|
|
||||||
name: buildpacks-cnb
|
|
||||||
arguments:
|
|
||||||
- name: IMAGE
|
|
||||||
value: DOCKER_REPO_OVERRIDE/buildpack-sample-app
|
|
||||||
# - name: CACHE
|
|
||||||
# value: buildpack-sample-app-cache
|
|
||||||
# volumes:
|
|
||||||
# - name: buildpack-sample-app-cache
|
|
||||||
# persistentVolumeClaim:
|
|
||||||
# claimName: buildpack-sample-app-cache
|
|
||||||
|
|
||||||
revisionTemplate:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
knative.dev/type: app
|
|
||||||
spec:
|
|
||||||
container:
|
|
||||||
image: DOCKER_REPO_OVERRIDE/buildpack-sample-app
|
|
||||||
---
|
|
||||||
apiVersion: serving.knative.dev/v1alpha1
|
|
||||||
kind: Route
|
|
||||||
metadata:
|
|
||||||
name: buildpack-sample-app
|
|
||||||
namespace: default
|
|
||||||
spec:
|
|
||||||
traffic:
|
|
||||||
- configurationName: buildpack-sample-app
|
|
||||||
percent: 100
|
|
|
@ -1,102 +0,0 @@
|
||||||
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](../../../install/README.md)
|
|
||||||
|
|
||||||
## Running
|
|
||||||
|
|
||||||
This sample uses the
|
|
||||||
[Buildpack build template](https://github.com/knative/build-templates/blob/master/buildpacks/cnb.yaml)
|
|
||||||
from the [build-templates](https://github.com/knative/build-templates/) repo.
|
|
||||||
|
|
||||||
Save a copy of `buildpack.yaml`, then install it:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
kubectl apply --filename https://raw.githubusercontent.com/knative/build-templates/master/buildpacks/cnb.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
Then you can deploy this to Knative Serving from the root directory via:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# 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
|
|
||||||
|
|
||||||
kubectl apply --filename sample.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
Once deployed, you will see that it first builds:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ kubectl get revision --output yaml
|
|
||||||
apiVersion: v1
|
|
||||||
items:
|
|
||||||
- apiVersion: serving.knative.dev/v1alpha1
|
|
||||||
kind: Revision
|
|
||||||
...
|
|
||||||
status:
|
|
||||||
conditions:
|
|
||||||
- reason: Building
|
|
||||||
status: "False"
|
|
||||||
type: BuildComplete
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
Once the `BuildComplete` status is `True`, resource creation begins.
|
|
||||||
|
|
||||||
To access this service using `curl`, we first need to determine its ingress
|
|
||||||
address:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# In Knative 0.2.x and prior versions, the `knative-ingressgateway` service was used instead of `istio-ingressgateway`.
|
|
||||||
INGRESSGATEWAY=knative-ingressgateway
|
|
||||||
|
|
||||||
# The use of `knative-ingressgateway` is deprecated in Knative v0.3.x.
|
|
||||||
# Use `istio-ingressgateway` instead, since `knative-ingressgateway`
|
|
||||||
# will be removed in Knative v0.4.
|
|
||||||
if kubectl get configmap config-istio -n knative-serving &> /dev/null; then
|
|
||||||
INGRESSGATEWAY=istio-ingressgateway
|
|
||||||
fi
|
|
||||||
|
|
||||||
watch kubectl get svc $INGRESSGATEWAY --namespace istio-system
|
|
||||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
|
||||||
xxxxxxx-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, 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 --output jsonpath="{.status.domain}"`
|
|
||||||
|
|
||||||
# Put the ingress IP into an environment variable.
|
|
||||||
$ export SERVICE_IP=`kubectl get svc $INGRESSGATEWAY --namespace istio-system --output jsonpath="{.status.loadBalancer.ingress[*].ip}"`
|
|
||||||
```
|
|
||||||
|
|
||||||
Now curl the service IP to make sure the deployment succeeded:
|
|
||||||
|
|
||||||
```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]
|
|
||||||
```
|
|
||||||
|
|
||||||
## Cleaning up
|
|
||||||
|
|
||||||
To clean up the sample service:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# Clean up the serving resources
|
|
||||||
kubectl delete --filename docs/serving/samples/buildpack-function-nodejs/sample.yaml
|
|
||||||
# Clean up the build template
|
|
||||||
kubectl delete buildtemplate buildpack
|
|
||||||
```
|
|
|
@ -1,8 +0,0 @@
|
||||||
---
|
|
||||||
title: "Buildpack Sample Function - Node.js"
|
|
||||||
linkTitle: "Buildpack function - Node.js"
|
|
||||||
weight: 1
|
|
||||||
type: "docs"
|
|
||||||
---
|
|
||||||
|
|
||||||
{{% readfile file="README.md" relative="true" markdown="true" %}}
|
|
|
@ -1,44 +0,0 @@
|
||||||
apiVersion: serving.knative.dev/v1alpha1
|
|
||||||
kind: Configuration
|
|
||||||
metadata:
|
|
||||||
name: buildpack-function
|
|
||||||
namespace: default
|
|
||||||
spec:
|
|
||||||
build:
|
|
||||||
source:
|
|
||||||
git:
|
|
||||||
url: https://github.com/projectriff-samples/node-square
|
|
||||||
revision: master
|
|
||||||
template:
|
|
||||||
name: buildpacks-cnb
|
|
||||||
arguments:
|
|
||||||
- name: IMAGE
|
|
||||||
value: DOCKER_REPO_OVERRIDE/buildpack-function
|
|
||||||
- name: BUILDPACK_ORDER
|
|
||||||
value: https://github.com/projectriff/node-function-invoker.git#buildpack
|
|
||||||
- name: SKIP_DETECT
|
|
||||||
value: "true"
|
|
||||||
# - name: CACHE
|
|
||||||
# value: buildpack-function-cache
|
|
||||||
# volumes:
|
|
||||||
# - name: buildpack-function-cache
|
|
||||||
# persistentVolumeClaim:
|
|
||||||
# claimName: buildpack-function-cache
|
|
||||||
|
|
||||||
revisionTemplate:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
knative.dev/type: function
|
|
||||||
spec:
|
|
||||||
container:
|
|
||||||
image: DOCKER_REPO_OVERRIDE/buildpack-function
|
|
||||||
---
|
|
||||||
apiVersion: serving.knative.dev/v1alpha1
|
|
||||||
kind: Route
|
|
||||||
metadata:
|
|
||||||
name: buildpack-function
|
|
||||||
namespace: default
|
|
||||||
spec:
|
|
||||||
traffic:
|
|
||||||
- configurationName: buildpack-function
|
|
||||||
percent: 100
|
|
|
@ -106,15 +106,14 @@ webhook.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ kubectl get ksvc gitwebhook \
|
$ kubectl get ksvc gitwebhook \
|
||||||
--output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
--output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
gitwebhook gitwebhook.default.example.com
|
gitwebhook http://gitwebhook.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Browse on GitHub to the repository where you want to create a webhook.
|
1. Browse on GitHub to the repository where you want to create a webhook.
|
||||||
1. Click **Settings**, then **Webhooks**, then **Add webhook**.
|
1. Click **Settings**, then **Webhooks**, then **Add webhook**.
|
||||||
1. Enter the **Payload URL** as `http://{DOMAIN}`, with the value of DOMAIN
|
1. Fill in **Payload URL** with the value of URL listed above.
|
||||||
listed above.
|
|
||||||
1. Set the **Content type** to `application/json`.
|
1. Set the **Content type** to `application/json`.
|
||||||
1. Enter the **Secret** value to be the same as the original base used for
|
1. Enter the **Secret** value to be the same as the original base used for
|
||||||
`webhookSecret` above (the original value, not the base64 encoded value).
|
`webhookSecret` above (the original value, not the base64 encoded value).
|
||||||
|
|
|
@ -37,9 +37,6 @@ kubectl apply --filename docs/serving/samples/grpc-ping-go/sample.yaml
|
||||||
1. Fetch the created ingress hostname and IP.
|
1. Fetch the created ingress hostname and IP.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Put the Host name into an environment variable.
|
|
||||||
export SERVICE_HOST=`kubectl get route grpc-ping --output jsonpath="{.status.domain}"`
|
|
||||||
|
|
||||||
# Put the ingress IP into an environment variable.
|
# Put the ingress IP into an environment variable.
|
||||||
export SERVICE_IP=`kubectl get svc istio-ingressgateway --namespace istio-system --output jsonpath="{.status.loadBalancer.ingress[*].ip}"`
|
export SERVICE_IP=`kubectl get svc istio-ingressgateway --namespace istio-system --output jsonpath="{.status.loadBalancer.ingress[*].ip}"`
|
||||||
```
|
```
|
||||||
|
@ -50,6 +47,6 @@ kubectl apply --filename docs/serving/samples/grpc-ping-go/sample.yaml
|
||||||
```shell
|
```shell
|
||||||
docker run -ti --entrypoint=/client docker.io/{username}/grpc-ping-go \
|
docker run -ti --entrypoint=/client docker.io/{username}/grpc-ping-go \
|
||||||
-server_addr="${SERVICE_IP}:80" \
|
-server_addr="${SERVICE_IP}:80" \
|
||||||
-server_host_override="${SERVICE_HOST}" \
|
-server_host_override="grpc-ping.default.example.com" \
|
||||||
-insecure
|
-insecure
|
||||||
```
|
```
|
||||||
|
|
|
@ -174,9 +174,9 @@ folder) you're ready to build and deploy the sample app.
|
||||||
1. To find the URL for your service, use
|
1. To find the URL for your service, use
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl get ksvc helloworld-csharp --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-csharp --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-csharp helloworld-csharp.default.example.com
|
helloworld-csharp http://helloworld-csharp.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now you can make a request to your app to see the result. Replace
|
1. Now you can make a request to your app to see the result. Replace
|
||||||
|
|
|
@ -170,14 +170,14 @@ folder) you're ready to build and deploy the sample app.
|
||||||
1. Run the following command to find the domain URL for your service:
|
1. Run the following command to find the domain URL for your service:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get ksvc helloworld-go --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-go --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
```
|
```
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-go helloworld-go.default.example.com
|
helloworld-go http://helloworld-go.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Test your app by sending it a request. Use the following `curl` command with
|
1. Test your app by sending it a request. Use the following `curl` command with
|
||||||
|
|
|
@ -152,21 +152,17 @@ folder) you're ready to build and deploy the sample app.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get ksvc helloworld-java \
|
kubectl get ksvc helloworld-java \
|
||||||
--output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
--output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
|
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-java helloworld-java.default.example.com
|
helloworld-java http://helloworld-java.default.example.com
|
||||||
|
|
||||||
# Or simply:
|
|
||||||
export DOMAIN_NAME=$(kubectl get ksvc helloworld-java \
|
|
||||||
--output jsonpath={.status.domain})
|
|
||||||
```
|
```
|
||||||
|
|
||||||
6. Now you can make a request to your app to see the result. Presuming, the IP
|
6. Now you can make a request to your app to see the result. Presuming, the IP
|
||||||
address you got in the step above is in the `${IP_ADDRESS}` env variable:
|
address you got in the step above is in the `${IP_ADDRESS}` env variable:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl -H "Host: ${DOMAIN_NAME}" http://${IP_ADDRESS}
|
curl -H "Host: helloworld-java.default.example.com" http://${IP_ADDRESS}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Removing the sample app deployment
|
## Removing the sample app deployment
|
||||||
|
|
|
@ -201,21 +201,17 @@ folder) you're ready to build and deploy the sample app.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get ksvc helloworld-java-spring \
|
kubectl get ksvc helloworld-java-spring \
|
||||||
--output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
--output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
|
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-java-spring helloworld-java-spring.default.example.com
|
helloworld-java-spring http://helloworld-java-spring.default.example.com
|
||||||
|
|
||||||
# Or simply:
|
|
||||||
export DOMAIN_NAME=$(kubectl get ksvc helloworld-java-spring \
|
|
||||||
--output jsonpath={.status.domain}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now you can make a request to your app to see the result. Presuming, the IP
|
1. Now you can make a request to your app to see the result. Presuming, the IP
|
||||||
address you got in the step above is in the `${IP_ADDRESS}` env variable:
|
address you got in the step above is in the `${IP_ADDRESS}` env variable:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl -H "Host: ${DOMAIN_NAME}" http://${IP_ADDRESS}
|
curl -H "Host: helloworld-java-spring.default.example.com" http://${IP_ADDRESS}
|
||||||
|
|
||||||
Hello Spring Boot Sample v1!
|
Hello Spring Boot Sample v1!
|
||||||
```
|
```
|
||||||
|
|
|
@ -212,10 +212,10 @@ folder) you're ready to build and deploy the sample app.
|
||||||
1. To find the URL for your service, use
|
1. To find the URL for your service, use
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get ksvc helloworld-kotlin --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-kotlin --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
|
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-kotlin helloworld-kotlin.default.example.com
|
helloworld-kotlin http://helloworld-kotlin.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now you can make a request to your app to see the result. Presuming, the IP
|
1. Now you can make a request to your app to see the result. Presuming, the IP
|
||||||
|
|
|
@ -197,9 +197,9 @@ folder) you're ready to build and deploy the sample app.
|
||||||
1. To find the URL for your service, use
|
1. To find the URL for your service, use
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl get ksvc helloworld-nodejs --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-nodejs --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-nodejs helloworld-nodejs.default.example.com
|
helloworld-nodejs http://helloworld-nodejs.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now you can make a request to your app to see the result. Replace
|
1. Now you can make a request to your app to see the result. Replace
|
||||||
|
|
|
@ -144,9 +144,9 @@ folder) you're ready to build and deploy the sample app.
|
||||||
1. To find the URL for your service, use
|
1. To find the URL for your service, use
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl get ksvc helloworld-php --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-php --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-php helloworld-php.default.example.com
|
helloworld-php http://helloworld-php.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now you can make a request to your app to see the result. Replace
|
1. Now you can make a request to your app to see the result. Replace
|
||||||
|
|
|
@ -159,9 +159,9 @@ folder) you're ready to build and deploy the sample app.
|
||||||
1. To find the URL for your service, use
|
1. To find the URL for your service, use
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl get ksvc helloworld-python --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-python --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-python helloworld-python.default.example.com
|
helloworld-python http://helloworld-python.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now you can make a request to your app to see the result. Replace
|
1. Now you can make a request to your app to see the result. Replace
|
||||||
|
|
|
@ -156,9 +156,9 @@ folder) you're ready to build and deploy the sample app.
|
||||||
1. To find the URL for your service, use
|
1. To find the URL for your service, use
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl get ksvc helloworld-ruby --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-ruby --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-ruby helloworld-ruby.default.example.com
|
helloworld-ruby http://helloworld-ruby.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now you can make a request to your app to see the result. Replace
|
1. Now you can make a request to your app to see the result. Replace
|
||||||
|
|
|
@ -136,11 +136,11 @@ Then find the service host:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get ksvc helloworld-scala \
|
kubectl get ksvc helloworld-scala \
|
||||||
--output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
--output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
|
|
||||||
# It will print something like this, the DOMAIN is what you're going to use as HTTP Host header:
|
# It will print something like this, the URL is what you're going to use as HTTP Host header:
|
||||||
# NAME DOMAIN
|
# NAME URL
|
||||||
# helloworld-scala helloworld-scala.default.example.com
|
# helloworld-scala http://helloworld-scala.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, to try your service, use the obtained address in the Host header:
|
Finally, to try your service, use the obtained address in the Host header:
|
||||||
|
|
|
@ -152,14 +152,14 @@ folder) you're ready to build and deploy the sample app.
|
||||||
1. Run the following command to find the domain URL for your service:
|
1. Run the following command to find the domain URL for your service:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get ksvc helloworld-shell --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-shell --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
```
|
```
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
helloworld-shell helloworld-shell.default.example.com
|
helloworld-shell http://helloworld-shell.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Test your app by sending it a request. Use the following `curl` command with
|
1. Test your app by sending it a request. Use the following `curl` command with
|
||||||
|
|
|
@ -140,16 +140,18 @@ export GATEWAY_IP=`kubectl get svc $INGRESSGATEWAY --namespace istio-system \
|
||||||
--output jsonpath="{.status.loadBalancer.ingress[*]['ip']}"`
|
--output jsonpath="{.status.loadBalancer.ingress[*]['ip']}"`
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Find the `Search` service route and export as an environment variable:
|
2. Find the `Search` service URL with:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
export SERVICE_HOST=`kubectl get route search-service --output jsonpath="{.status.domain}"`
|
# kubectl get route search-service --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
|
NAME URL
|
||||||
|
search-service http://search-service.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Make a curl request to the service:
|
3. Make a curl request to the service:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl http://${GATEWAY_IP} --header "Host:${SERVICE_HOST}"
|
curl http://${GATEWAY_IP} --header "Host:search-service.default.example.com"
|
||||||
```
|
```
|
||||||
|
|
||||||
You should see: `Search Service is called !`
|
You should see: `Search Service is called !`
|
||||||
|
@ -157,11 +159,7 @@ You should see: `Search Service is called !`
|
||||||
4. Similarly, you can also directly access "Login" service with:
|
4. Similarly, you can also directly access "Login" service with:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
export SERVICE_HOST=`kubectl get route login-service --output jsonpath="{.status.domain}"`
|
curl http://${GATEWAY_IP} --header "Host:login-service.default.example.com"
|
||||||
```
|
|
||||||
|
|
||||||
```shell
|
|
||||||
curl http://${GATEWAY_IP} --header "Host:${SERVICE_HOST}"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You should see: `Login Service is called !`
|
You should see: `Login Service is called !`
|
||||||
|
|
|
@ -187,11 +187,12 @@ variables in the following steps.
|
||||||
echo $INGRESS_IP
|
echo $INGRESS_IP
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Get the hostname of the service:
|
2. Get the URL of the service:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
export SERVICE_HOSTNAME=`kubectl get ksvc stock-service-example --output jsonpath="{.status.domain}"`
|
kubectl get ksvc stock-service-example --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
echo $SERVICE_HOSTNAME
|
NAME URL
|
||||||
|
stock-service-example http://stock-service-example.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Send requests to the service using `curl`:
|
3. Send requests to the service using `curl`:
|
||||||
|
@ -205,7 +206,7 @@ variables in the following steps.
|
||||||
the ingress gateway IP.
|
the ingress gateway IP.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl --header "Host:$SERVICE_HOSTNAME" http://${INGRESS_IP}
|
curl --header "Host:stock-service-example.default.example.com" http://${INGRESS_IP}
|
||||||
```
|
```
|
||||||
|
|
||||||
Response body: `Welcome to the stock app!`
|
Response body: `Welcome to the stock app!`
|
||||||
|
@ -213,7 +214,7 @@ variables in the following steps.
|
||||||
2. Send a request to the `/stock` endpoint:
|
2. Send a request to the `/stock` endpoint:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl --header "Host:$SERVICE_HOSTNAME" http://${INGRESS_IP}/stock
|
curl --header "Host:stock-service-example.default.example.com" http://${INGRESS_IP}/stock
|
||||||
```
|
```
|
||||||
|
|
||||||
Response body: `stock ticker not found!, require /stock/{ticker}`
|
Response body: `stock ticker not found!, require /stock/{ticker}`
|
||||||
|
@ -222,7 +223,7 @@ variables in the following steps.
|
||||||
"[stock symbol](https://www.marketwatch.com/tools/quotes/lookup.asp)":
|
"[stock symbol](https://www.marketwatch.com/tools/quotes/lookup.asp)":
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl --header "Host:$SERVICE_HOSTNAME" http://${INGRESS_IP}/stock/<SYMBOL>
|
curl --header "Host:stock-service-example.default.example.com" http://${INGRESS_IP}/stock/<SYMBOL>
|
||||||
```
|
```
|
||||||
|
|
||||||
where `<SYMBOL>` is your "stock symbol".
|
where `<SYMBOL>` is your "stock symbol".
|
||||||
|
@ -234,7 +235,7 @@ variables in the following steps.
|
||||||
Request:
|
Request:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl --header "Host:$SERVICE_HOSTNAME" http://${INGRESS_IP}/stock/FAKE
|
curl --header "Host:stock-service-example.default.example.com" http://${INGRESS_IP}/stock/FAKE
|
||||||
```
|
```
|
||||||
|
|
||||||
Response: `stock price for ticker FAKE is 0.00`
|
Response: `stock price for ticker FAKE is 0.00`
|
||||||
|
|
|
@ -256,14 +256,14 @@ folder) you're ready to build and deploy the sample app.
|
||||||
1. Run the following command to find the domain URL for your service:
|
1. Run the following command to find the domain URL for your service:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get ksvc secrets-go --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc secrets-go --output=custom-columns=NAME:.metadata.name,URL:.status.url
|
||||||
```
|
```
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
NAME DOMAIN
|
NAME URL
|
||||||
secrets-go secrets-go.default.example.com
|
secrets-go http://secrets-go.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Test your app by sending it a request. Use the following `curl` command with
|
1. Test your app by sending it a request. Use the following `curl` command with
|
||||||
|
|
|
@ -151,14 +151,12 @@ status:
|
||||||
...
|
...
|
||||||
status: "True"
|
status: "True"
|
||||||
type: Ready
|
type: Ready
|
||||||
domain: telemetrysample-route.default.example.com
|
url: http://telemetrysample-route.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Export the ingress hostname and IP as environment variables:
|
2. Export the ingress IP as an environment variable:
|
||||||
|
|
||||||
```
|
```
|
||||||
export SERVICE_HOST=`kubectl get route telemetrysample-route --output jsonpath="{.status.domain}"`
|
|
||||||
|
|
||||||
# In Knative 0.2.x and prior versions, the `knative-ingressgateway` service was used instead of `istio-ingressgateway`.
|
# In Knative 0.2.x and prior versions, the `knative-ingressgateway` service was used instead of `istio-ingressgateway`.
|
||||||
INGRESSGATEWAY=knative-ingressgateway
|
INGRESSGATEWAY=knative-ingressgateway
|
||||||
|
|
||||||
|
@ -175,14 +173,14 @@ export SERVICE_IP=`kubectl get svc $INGRESSGATEWAY --namespace istio-system --ou
|
||||||
3. Make a request to the service to see the `Hello World!` message:
|
3. Make a request to the service to see the `Hello World!` message:
|
||||||
|
|
||||||
```
|
```
|
||||||
curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}
|
curl --header "Host:telemetrysample-route.default.example.com" http://${SERVICE_IP}
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Make a request to the `/log` endpoint to generate logs to the `stdout` file
|
4. Make a request to the `/log` endpoint to generate logs to the `stdout` file
|
||||||
and generate files under `/var/log` in both `JSON` and plain text formats:
|
and generate files under `/var/log` in both `JSON` and plain text formats:
|
||||||
|
|
||||||
```
|
```
|
||||||
curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}/log
|
curl --header "Host:telemetrysample-route.default.example.com" http://${SERVICE_IP}/log
|
||||||
```
|
```
|
||||||
|
|
||||||
## Access Logs
|
## Access Logs
|
||||||
|
|
|
@ -1,229 +0,0 @@
|
||||||
This is a walk-through example that demonstrates deploying a dockerized
|
|
||||||
application that accesses external dependencies to Knative Serving. In this demo
|
|
||||||
we will use a sample `golang` application that takes a video URL as an input and
|
|
||||||
generates its thumbnail image using the `ffmpeg` framework.
|
|
||||||
|
|
||||||
## Before you begin
|
|
||||||
|
|
||||||
- [Install Knative Serving](../../../install/README.md)
|
|
||||||
|
|
||||||
If you want to test and run the app locally:
|
|
||||||
|
|
||||||
- [Install Go](https://golang.org/doc/install)
|
|
||||||
- [Download `ffmpeg`](https://www.ffmpeg.org/download.html)
|
|
||||||
|
|
||||||
## Sample code
|
|
||||||
|
|
||||||
In this demo we are going to use a simple `golang` REST app called
|
|
||||||
[rester-tester](https://github.com/mchmarny/rester-tester). It's important to
|
|
||||||
point out that this application doesn't use any special Knative Serving
|
|
||||||
components, nor does it have any Knative Serving SDK dependencies.
|
|
||||||
|
|
||||||
### Cloning the sample code
|
|
||||||
|
|
||||||
Let's start by cloning the public `rester-tester` repository:
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone git@github.com:mchmarny/rester-tester.git
|
|
||||||
cd rester-tester
|
|
||||||
```
|
|
||||||
|
|
||||||
The `rester-tester` application uses [godep](https://github.com/tools/godep) to
|
|
||||||
manage its own dependencies. Download `godep` and restore the app dependencies:
|
|
||||||
|
|
||||||
```
|
|
||||||
go get github.com/tools/godep
|
|
||||||
godep restore
|
|
||||||
```
|
|
||||||
|
|
||||||
### Run tests
|
|
||||||
|
|
||||||
To make sure the application is ready, run the integrated tests:
|
|
||||||
|
|
||||||
```
|
|
||||||
go test ./...
|
|
||||||
```
|
|
||||||
|
|
||||||
### Run the app
|
|
||||||
|
|
||||||
You can now run the `rester-tester` application locally in `go` or using Docker.
|
|
||||||
|
|
||||||
**Local**
|
|
||||||
|
|
||||||
To run the app:
|
|
||||||
|
|
||||||
```
|
|
||||||
go build
|
|
||||||
./rester-tester
|
|
||||||
```
|
|
||||||
|
|
||||||
**Docker**
|
|
||||||
|
|
||||||
When running the application locally using Docker, you do not need to install
|
|
||||||
`ffmpeg`; Docker will install it for you 'inside' of the Docker image.
|
|
||||||
|
|
||||||
To run the app:
|
|
||||||
|
|
||||||
```
|
|
||||||
docker build -t rester-tester:latest .
|
|
||||||
docker run -p 8080:8080 rester-tester:latest
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test
|
|
||||||
|
|
||||||
To test the thumbnailing service, use `curl` to submit the `src`, a video URL:
|
|
||||||
|
|
||||||
```
|
|
||||||
curl -X POST -H "Content-Type: application/json" http://localhost:8080/image \
|
|
||||||
-d '{"src":"https://www.youtube.com/watch?v=DjByja9ejTQ"}'
|
|
||||||
```
|
|
||||||
|
|
||||||
## Deploying the app to Knative
|
|
||||||
|
|
||||||
From this point, you can either deploy a prebuilt image of the app, or build the
|
|
||||||
app locally and then deploy it.
|
|
||||||
|
|
||||||
### Deploying a prebuilt image
|
|
||||||
|
|
||||||
You can deploy a prebuilt image of the `rester-tester` app to Knative Serving
|
|
||||||
using `kubectl` and the included `sample-prebuilt.yaml` file:
|
|
||||||
|
|
||||||
```
|
|
||||||
# From inside the thumbnailer-go directory
|
|
||||||
kubectl apply --filename sample-prebuilt.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Building and deploying a version of the app
|
|
||||||
|
|
||||||
If you want to build the image yourself, follow these instructions. This sample
|
|
||||||
uses the
|
|
||||||
[Kaniko build template](https://github.com/knative/build-templates/blob/master/kaniko/kaniko.yaml)
|
|
||||||
from the [build-templates](https://github.com/knative/build-templates/) repo.
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# Replace the token string with a suitable registry
|
|
||||||
REPO="gcr.io/<your-project-here>"
|
|
||||||
perl -pi -e "s@DOCKER_REPO_OVERRIDE@$REPO@g" sample.yaml
|
|
||||||
|
|
||||||
# Install the Kaniko build template used to build this sample (in the
|
|
||||||
# build-templates repo).
|
|
||||||
kubectl apply --filename https://raw.githubusercontent.com/knative/build-templates/master/kaniko/kaniko.yaml
|
|
||||||
|
|
||||||
# Create the Knative route and configuration for the application
|
|
||||||
kubectl apply --filename sample.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
Now, if you look at the `status` of the revision, you will see that a build is
|
|
||||||
in progress:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ kubectl get revisions --output yaml
|
|
||||||
apiVersion: v1
|
|
||||||
items:
|
|
||||||
- apiVersion: serving.knative.dev/v1alpha1
|
|
||||||
kind: Revision
|
|
||||||
...
|
|
||||||
status:
|
|
||||||
conditions:
|
|
||||||
- reason: Building
|
|
||||||
status: "False"
|
|
||||||
type: BuildComplete
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
Once `BuildComplete` has a `status: "True"`, the revision will be deployed.
|
|
||||||
|
|
||||||
## Using the app
|
|
||||||
|
|
||||||
To confirm that the app deployed, you can check for the Knative Serving service
|
|
||||||
using `kubectl`. First, is there an ingress service, and does it have an
|
|
||||||
`EXTERNAL-IP`:
|
|
||||||
|
|
||||||
```
|
|
||||||
# In Knative 0.2.x and prior versions, the `knative-ingressgateway` service was used instead of `istio-ingressgateway`.
|
|
||||||
INGRESSGATEWAY=knative-ingressgateway
|
|
||||||
|
|
||||||
# The use of `knative-ingressgateway` is deprecated in Knative v0.3.x.
|
|
||||||
# Use `istio-ingressgateway` instead, since `knative-ingressgateway`
|
|
||||||
# will be removed in Knative v0.4.
|
|
||||||
if kubectl get configmap config-istio -n knative-serving &> /dev/null; then
|
|
||||||
INGRESSGATEWAY=istio-ingressgateway
|
|
||||||
fi
|
|
||||||
|
|
||||||
kubectl get svc $INGRESSGATEWAY --namespace istio-system
|
|
||||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
|
||||||
xxxxxxx-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
|
|
||||||
```
|
|
||||||
|
|
||||||
> Note: It can take a few seconds for the service to show an `EXTERNAL-IP`.
|
|
||||||
|
|
||||||
The newly deployed app may take few seconds to initialize. You can check its
|
|
||||||
status by entering the following command:
|
|
||||||
|
|
||||||
```
|
|
||||||
kubectl --namespace default get pods
|
|
||||||
```
|
|
||||||
|
|
||||||
The Knative Serving ingress service will automatically be assigned an external
|
|
||||||
IP, so let's capture the IP and Host URL in variables so that we can use them in
|
|
||||||
`curl` commands:
|
|
||||||
|
|
||||||
```
|
|
||||||
# Put the Host URL into an environment variable.
|
|
||||||
export SERVICE_HOST=`kubectl get route thumb --output jsonpath="{.status.domain}"`
|
|
||||||
|
|
||||||
# In Knative 0.2.x and prior versions, the `knative-ingressgateway` service was used instead of `istio-ingressgateway`.
|
|
||||||
INGRESSGATEWAY=knative-ingressgateway
|
|
||||||
INGRESSGATEWAY_LABEL=knative
|
|
||||||
|
|
||||||
# The use of `knative-ingressgateway` is deprecated in Knative v0.3.x.
|
|
||||||
# Use `istio-ingressgateway` instead, since `knative-ingressgateway`
|
|
||||||
# will be removed in Knative v0.4.
|
|
||||||
if kubectl get configmap config-istio -n knative-serving &> /dev/null; then
|
|
||||||
INGRESSGATEWAY=istio-ingressgateway
|
|
||||||
INGRESSGATEWAY_LABEL=istio
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Put the ingress IP into an environment variable.
|
|
||||||
export SERVICE_IP=`kubectl get svc $INGRESSGATEWAY --namespace istio-system --output jsonpath="{.status.loadBalancer.ingress[*].ip}"`
|
|
||||||
```
|
|
||||||
|
|
||||||
If your cluster is running outside a cloud provider (for example on Minikube),
|
|
||||||
your services will never get an external IP address. In that case, use the istio
|
|
||||||
`hostIP` and `nodePort` as the service IP:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
export SERVICE_IP=$(kubectl get po --selector $INGRESSGATEWAY_LABEL=ingressgateway --namespace istio-system --output 'jsonpath={.items[0].status.hostIP}'):$(kubectl get svc $INGRESSGATEWAY --namespace istio-system --output 'jsonpath={.spec.ports[?(@.port==80)].nodePort}')
|
|
||||||
```
|
|
||||||
|
|
||||||
### Ping
|
|
||||||
|
|
||||||
Let's start with a simple `ping` to make sure the app is deployed:
|
|
||||||
|
|
||||||
```
|
|
||||||
curl -H "Content-Type: application/json" -H "Host: $SERVICE_HOST" \
|
|
||||||
http://$SERVICE_IP/ping
|
|
||||||
```
|
|
||||||
|
|
||||||
### Video Thumbnail
|
|
||||||
|
|
||||||
Now, supply the video URL and generate a video thumbnail:
|
|
||||||
|
|
||||||
```
|
|
||||||
curl -X POST -H "Content-Type: application/json" -H "Host: $SERVICE_HOST" \
|
|
||||||
http://$SERVICE_IP/image -d '{"src":"https://www.youtube.com/watch?v=DjByja9ejTQ"}'
|
|
||||||
```
|
|
||||||
|
|
||||||
You can then download the newly created thumbnail. Make sure to replace the
|
|
||||||
image file name with the one returned by the previous curl request:
|
|
||||||
|
|
||||||
```
|
|
||||||
curl -H "Host: $SERVICE_HOST" \
|
|
||||||
http://$SERVICE_IP/thumb/img_b43ffcc2-0c80-4862-8423-60ec1b4c4926.png > demo.png
|
|
||||||
```
|
|
||||||
|
|
||||||
## Final Thoughts
|
|
||||||
|
|
||||||
Although this demo uses an external application, the Knative Serving deployment
|
|
||||||
steps would be similar for any 'dockerized' app you may already have. Just copy
|
|
||||||
the `sample.yaml` and change a few variables.
|
|
|
@ -1,8 +0,0 @@
|
||||||
---
|
|
||||||
title: "Thumbnailer External Dependencies Demo - Go"
|
|
||||||
linkTitle: "Deploy, build, and serve - Go"
|
|
||||||
weight: 1
|
|
||||||
type: "docs"
|
|
||||||
---
|
|
||||||
|
|
||||||
{{% readfile file="README.md" relative="true" markdown="true" %}}
|
|
|
@ -1,40 +0,0 @@
|
||||||
# Copyright 2018 The Knative Authors
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
apiVersion: serving.knative.dev/v1alpha1
|
|
||||||
kind: Route
|
|
||||||
metadata:
|
|
||||||
name: thumb
|
|
||||||
namespace: default
|
|
||||||
spec:
|
|
||||||
traffic:
|
|
||||||
- configurationName: thumbtemplate
|
|
||||||
percent: 100
|
|
||||||
---
|
|
||||||
apiVersion: serving.knative.dev/v1alpha1
|
|
||||||
kind: Configuration
|
|
||||||
metadata:
|
|
||||||
name: thumbtemplate
|
|
||||||
namespace: default
|
|
||||||
spec:
|
|
||||||
revisionTemplate:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
knative.dev/type: app
|
|
||||||
spec:
|
|
||||||
container:
|
|
||||||
image: docker.io/mchmarny/rester-tester:latest
|
|
||||||
env:
|
|
||||||
- name: TARGET
|
|
||||||
value: thumb_v1
|
|
|
@ -1,50 +0,0 @@
|
||||||
# Copyright 2018 The Knative Authors
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
apiVersion: serving.knative.dev/v1alpha1
|
|
||||||
kind: Route
|
|
||||||
metadata:
|
|
||||||
name: thumb
|
|
||||||
namespace: default
|
|
||||||
spec:
|
|
||||||
traffic:
|
|
||||||
- configurationName: thumbtemplate
|
|
||||||
percent: 100
|
|
||||||
---
|
|
||||||
apiVersion: serving.knative.dev/v1alpha1
|
|
||||||
kind: Configuration
|
|
||||||
metadata:
|
|
||||||
name: thumbtemplate
|
|
||||||
namespace: default
|
|
||||||
spec:
|
|
||||||
build:
|
|
||||||
source:
|
|
||||||
git:
|
|
||||||
url: https://github.com/mchmarny/rester-tester
|
|
||||||
revision: master
|
|
||||||
template:
|
|
||||||
name: kaniko
|
|
||||||
arguments:
|
|
||||||
- name: IMAGE
|
|
||||||
value: DOCKER_REPO_OVERRIDE/rester-tester
|
|
||||||
revisionTemplate:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
knative.dev/type: app
|
|
||||||
spec:
|
|
||||||
container:
|
|
||||||
image: DOCKER_REPO_OVERRIDE/rester-tester
|
|
||||||
env:
|
|
||||||
- name: TARGET
|
|
||||||
value: thumb_v1
|
|
|
@ -83,11 +83,11 @@ You can also apply an updated domain configuration:
|
||||||
|
|
||||||
Deploy an app (for example,
|
Deploy an app (for example,
|
||||||
[`helloworld-go`](./samples/hello-world/helloworld-go/README.md)), to your
|
[`helloworld-go`](./samples/hello-world/helloworld-go/README.md)), to your
|
||||||
cluster as normal. You can check the customized domain in Knative Route
|
cluster as normal. You can retrieve the URL in Knative Route
|
||||||
"helloworld-go" with the following command:
|
"helloworld-go" with the following command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get route helloworld-go --output jsonpath="{.status.domain}"
|
kubectl get route helloworld-go --output jsonpath="{.status.url}"
|
||||||
```
|
```
|
||||||
|
|
||||||
You should see the full customized domain: `helloworld-go.default.mydomain.com`.
|
You should see the full customized domain: `helloworld-go.default.mydomain.com`.
|
||||||
|
@ -128,7 +128,7 @@ export GATEWAY_IP=`kubectl get svc $INGRESSGATEWAY --namespace istio-system --ou
|
||||||
|
|
||||||
# helloworld-go is the generated Knative Route of "helloworld-go" sample.
|
# helloworld-go is the generated Knative Route of "helloworld-go" sample.
|
||||||
# You need to replace it with your own Route in your project.
|
# You need to replace it with your own Route in your project.
|
||||||
export DOMAIN_NAME=`kubectl get route helloworld-go --output jsonpath="{.status.domain}"`
|
export DOMAIN_NAME=`kubectl get route helloworld-go --output jsonpath="{.status.url}" | cut -d'/' -f 3`
|
||||||
|
|
||||||
# Add the record of Gateway IP and domain name into file "/etc/hosts"
|
# Add the record of Gateway IP and domain name into file "/etc/hosts"
|
||||||
echo -e "$GATEWAY_IP\t$DOMAIN_NAME" | sudo tee -a /etc/hosts
|
echo -e "$GATEWAY_IP\t$DOMAIN_NAME" | sudo tee -a /etc/hosts
|
||||||
|
|
Loading…
Reference in New Issue