Adding GitHub Sample for move from eventing.#339
Conversation
|
/retest Grant for LGTM: Evan for Approval: |
|
related to knative/eventing#343 |
|
/test pull-knative-docs-integration-tests |
|
READY! PTAL. |
|
Is this intended to be exactly the same content as knative/eventing#343? |
Yes, but this branch is now slightly ahead in the samples code. |
|
istio... /test pull-knative-docs-integration-tests |
|
Taking a look from the docs perspective today |
| `(looks pretty legit)` to the PR title. | ||
|
|
||
| ## Prerequisites | ||
|
|
There was a problem hiding this comment.
Below the "Prerequisites" heading, add: "You will need:"
| if you need to create one. | ||
| - [Docker](https://www.docker.com/) installed and running on your local machine, | ||
| and a Docker Hub account configured (you'll use it for a container registry). | ||
| - The Kubernetes cluster also has Knative eventing core installed. You can |
There was a problem hiding this comment.
Suggestion: "The Kubernetes cluster also has Knative eventing core installed." --> "Knative eventing core installed on your Kubernetes cluster."
| ## Configuring Knative | ||
|
|
||
| To use this sample, you'll need to install the `stub` ClusterBus and the | ||
| `github` EventSource. |
There was a problem hiding this comment.
"EventSource." --> "EventSource:"
| `github` EventSource. | ||
|
|
||
| ```shell | ||
| kubectl apply -f https://storage.googleapis.com/knative-releases/eventing/latest/release-clusterbus-stub.yaml |
There was a problem hiding this comment.
Might add comments here; IE:
# Installs ClusterBus
# Installs EventSource
There was a problem hiding this comment.
(This parallels the k8sevents doc.)
| @@ -0,0 +1,162 @@ | |||
| # GitHub Flow | |||
There was a problem hiding this comment.
"Github Flow" --> "Creating a GitHub Flow Using Knative Eventing", or similar.
There was a problem hiding this comment.
How about "Reacting to GitHub Events"
| kubectl apply -f eventing/samples/github-events/auth.yaml | ||
| ``` | ||
|
|
||
| ## Build and deploy the sample |
There was a problem hiding this comment.
"Build and deploy the sample" --> "Building and deploying the sample"
There was a problem hiding this comment.
k8sevents has the same issue.
Do we have a standard template for these somewhere?
|
|
||
| ## Understanding what happened | ||
|
|
||
| <!--TODO: |
There was a problem hiding this comment.
Can this be fleshed out now? I feel like there's a good start in the introduction, and it would add a lot to the sample.
There was a problem hiding this comment.
+1 -- much of this should be able to be copied from the k8sevents source, with some additional detail on how the Feed for github has a provisioning step which both calls the GitHub API and creates an underlying service (receive adapter). The rest of the text should be able to be shared with the k8sevent doc.
There was a problem hiding this comment.
Requesting this update be a follow-up PR
There was a problem hiding this comment.
I don't love leaving a blank section in the guide, though. If you're set on not adding anything here for the moment, I'd move the heading inside the TODO so the rendered version of the file doesn't look like it has a blank section. @n3wscott
|
|
||
| 1. Use Docker to build the sample code into a container. To build and push with | ||
| Docker Hub, run these commands replacing `{username}` with your Docker Hub | ||
| username. Run the following from the _root_ of the `knative/docs` repo: |
There was a problem hiding this comment.
"run these commands replacing {username} with your Docker Hub username" -->
"run the following commands, replacing {username} with your Docker Hub username"
| [assign a static IP address](https://github.com/knative/docs/blob/master/serving/gke-assigning-static-ip-address.md) | ||
| instructions. | ||
|
|
||
| ## Configuring Knative |
There was a problem hiding this comment.
"Configuring Knative" doesn't really seem to describe what's going on here. Too generic.
Maybe "Installing ClusterBus and EventSource"? "Installing Eventing dependencies"? "Configuring Knative for Eventing"?
There was a problem hiding this comment.
FWIW, this matches the k8sevents sample, so we should probably update both at the same time.
There was a problem hiding this comment.
ok it will be a followup.
evankanderson
left a comment
There was a problem hiding this comment.
I'm reviewing this in favor of knative/eventing#343, and will close that when this is submitted.
| FROM golang AS builder | ||
|
|
||
| WORKDIR /go/src/github.com/knative/docs/ | ||
| ADD . /go/src/github.com/knative/docs/ |
There was a problem hiding this comment.
It looks like you don't need to use dep, so this is much cleaner than what I had to do in the k8sevents commit (see f00e99d and d1b685a for the dep changes). Prior to needing dep, I used the following, which is even simpler than what you have here, and works from the sample directory:
FROM golang AS builder
ADD . /go/src/k8s-events
# Build the event processing function command inside the container.
# (You may fetch or manage dependencies here,
# either manually or with a tool like "godep".)
RUN go get k8s.io/api/core/v1 github.com/knative/eventing/pkg/event
RUN go install k8s-events
FROM gcr.io/distroless/base
COPY --from=builder /go/src/github.com/knative/docs/k8s-events /sample
...
There was a problem hiding this comment.
I copied the k8s event docker file and changed the path of the runable. I was able to get this to work testing the README script just fine.
| `Channel`, and the `Subscription`. | ||
|
|
||
| In response to a pull request event, the sample app _legit_ Service will add | ||
| `(looks pretty legit)` to the PR title. |
There was a problem hiding this comment.
I'd put this first -- this is actually what the interesting part of the sample is.
| - A domain name that allows GitHub to call into the cluster: Follow the | ||
| [configure a custom domain](https://github.com/knative/docs/blob/master/serving/using-a-custom-domain.md) and | ||
| [assign a static IP address](https://github.com/knative/docs/blob/master/serving/gke-assigning-static-ip-address.md) | ||
| instructions. |
There was a problem hiding this comment.
Is this the order the instructions should be followed in (custom domain first, then static IP)?
There was a problem hiding this comment.
It makes more sense to get a static ip and then use that for the domain... flipped them.
| ``` | ||
| - A domain name that allows GitHub to call into the cluster: Follow the | ||
| [configure a custom domain](https://github.com/knative/docs/blob/master/serving/using-a-custom-domain.md) and | ||
| [assign a static IP address](https://github.com/knative/docs/blob/master/serving/gke-assigning-static-ip-address.md) |
| [assign a static IP address](https://github.com/knative/docs/blob/master/serving/gke-assigning-static-ip-address.md) | ||
| instructions. | ||
|
|
||
| ## Configuring Knative |
There was a problem hiding this comment.
FWIW, this matches the k8sevents sample, so we should probably update both at the same time.
|
|
||
| ## Cleaning up | ||
|
|
||
| To clean up the function, `Flow`, auth, and secret: |
There was a problem hiding this comment.
Do we need to clean up auth.yaml? I think it's needed to make the github source able to operate at all.
There was a problem hiding this comment.
Yes but I need help because I have not looked into what rbac arguments should look like
| namespace: default | ||
| roleRef: | ||
| kind: ClusterRole | ||
| name: cluster-admin |
There was a problem hiding this comment.
Can we avoid making this cluster-admin? Something like the following definition (instead of ClusterRoleBinding) should be sufficient IIUC:
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: create-knative-service
namespace: default
rules:
- apiGroups: ["serving.knative.dev"]
resources: ["services"]
verbs: ["get", "list", "watch", "create", "update", "delete", "patch"]
---
# This enables the feed-sa to deploy the receive adapter.
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: feed-sa-deploy
namespace: default
subjects:
- kind: ServiceAccount
name: feed-sa
namespace: default
roleRef:
kind: Role
name: create-knative-service
apiGroup: rbac.authorization.k8s.ioThere was a problem hiding this comment.
awesome. 👍 thanks!!
| serviceAccountName: feed-sa | ||
| trigger: | ||
| eventType: dev.knative.github.pullrequest | ||
| resource: n3wscott/kopond |
There was a problem hiding this comment.
You probably want to update 5 to have the user change this resource before creating the Flow.
| key: githubCredentials | ||
| action: | ||
| target: | ||
| kind: Route |
|
|
||
| // Set up the auth for being able to talk to Github. It's | ||
| // odd that you have to also pass context around for the | ||
| // calls even after giving it to client. But, whatever. |
There was a problem hiding this comment.
It is Ville's rant. hahahah
|
/test pull-knative-docs-integration-tests |
|
PTAL? |
|
/lgtm |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: n3wscott, samodell The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Moving GitHub eventing sample from
knative/eventingtoknative/docs.