Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into detestable
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Anderson committed Apr 29, 2020
2 parents 597d661 + 652da86 commit 34d2cd6
Show file tree
Hide file tree
Showing 29 changed files with 8,222 additions and 9,750 deletions.
19 changes: 2 additions & 17 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions community/meetup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Welcome to the Knative Community Meetup page!

The virtual event is designed for end users, a space for our community to meet, get to know each other, and learn about uses and applications of Knative.

Catch up with past community meetups on our [YouTube channel](https://www.youtube.com/playlist?list=PLQjzPfIiEQLLyCyLBKLlwDLfE_A-P7nyg).

Here we will list all the information related to past and future events.

Stay tuned for new events by subscribing to our [calendar](https://calendar.google.com/calendar/embed?src=google.com_18un4fuh6rokqf8hmfftm5oqq4%40group.calendar.google.com) ([iCal export file](https://calendar.google.com/calendar/ical/[email protected]/public/basic.ics)) and following us on [Twitter](https://twitter.com/KnativeProject).

---

### 2020-04-16 – Knative Community Meetup #1
Video: https://www.youtube.com/watch?v=k0QJEyV4U-4

Agenda:
- Welcome! (5’)
- Announce recording of meeting.
- Update from the Steering Committee (5’)
- TOC election announcement (Brenda Chan)
- Working groups updates (15’-20’)
- Eventing (Aleksander Slominski and Davy Odom)
- Networking (Nghia Tran)
- Operation (Vincent Hou)
- Client (Roland Huss)
- [Demo - "Tracking the Bitcoin ledger" - by Johana Saladas (IBM) (30’)](https://www.youtube.com/watch?v=sGi_LuAaaT0)
- Demo discussion / conversation (15’-20’)
- Close (5’)
- Take the [survey](https://docs.google.com/forms/d/e/1FAIpQLSebw2IOjmnStiUhPpnndpjyuBUoziZOw9PK9fnJeFBQX0QxWw/viewform)! (it’s good karma)

The demo for this first community meetup is "Tracking the Bitcoin ledger", designed and carried out by @josiemundi, software engineer at IBM. Thank you for volunteering, Johana!

Here are the resources from the demo:
- https://github.com/josiemundi/knative-eventing-blockchain-demo
- https://github.com/josiemundi/knative-bitcoin-websocket-eventsource
8 changes: 8 additions & 0 deletions community/meetup/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: "Knative Community Meetup"
linkTitle: "Community Meetup"
weight: 30
type: "docs"
---

{{% readfile file="README.md" %}}
14 changes: 10 additions & 4 deletions docs/eventing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ event sources. Sources manage registration and delivery of events from external
systems using Kubernetes
[Custom Resources](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/).
Learn more about Eventing development in the
[Eventing work group](https://github.com/knative/community/tree/master/WORKING-GROUPS.md#eventing).
[Eventing work group](https://github.com/knative/community/blob/master/working-groups/WORKING-GROUPS.md#eventing).

## Installation

Expand Down Expand Up @@ -144,9 +144,7 @@ In addition to the sources explained below, there are
[other sources](./sources/README.md) that you can install.
If you need a Source not covered by the ones mentioned below nor by the other
[available implementations](./sources/README.md), there is a
[tutorial on writing your own Source with kubebuilder](./samples/writing-a-source/README.md) as
well as an
[extended tutorial on writing a Source with Receive Adapter](./samples/writing-receive-adapter-source).
[tutorial on writing a Source with a Receive Adapter](./samples/writing-receive-adapter-source).

If your code needs to send events as part of its business logic and doesn't fit
the model of a Source, consider
Expand Down Expand Up @@ -198,6 +196,14 @@ The GitHubSource fires a new event for selected

See the [GitHub Source](samples/github-source) example for more details.

#### GitLabSource

The GitLabSource creates a webhooks for specified
[event types](https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#events),
listens for incoming events and passes them to a consumer.

See the [GitLab Source](samples/gitlab-source) example for more details.

#### AwsSqsSource

The AwsSqsSource fires a new event each time an event is published on an
Expand Down
8 changes: 4 additions & 4 deletions docs/eventing/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ Your event consumers receive the events sent by event producers. In this step, y
spec:
containers:
- name: event-display
# Source code: https://github.com/knative/eventing-contrib/blob/release-0.6/cmd/event_display/main.go
image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display@sha256:37ace92b63fc516ad4c8331b6b3b2d84e4ab2d8ba898e387c0b6f68f0e3081c4
# Source code: https://github.com/knative/eventing-contrib/tree/master/cmd/event_display
image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
---
Expand Down Expand Up @@ -195,8 +195,8 @@ Your event consumers receive the events sent by event producers. In this step, y
spec:
containers:
- name: event-display
# Source code: https://github.com/knative/eventing-contrib/blob/release-0.6/cmd/event_display/main.go
image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display@sha256:37ace92b63fc516ad4c8331b6b3b2d84e4ab2d8ba898e387c0b6f68f0e3081c4
# Source code: https://github.com/knative/eventing-contrib/tree/master/cmd/event_display
image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
---
Expand Down
201 changes: 201 additions & 0 deletions docs/eventing/samples/gitlab-source/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
---
title: "GitLab source"
linkTitle: "GitLab source"
weight: 30
type: "docs"
---

GitLab Source example shows how to wire GitLab events for consumption by a
Knative Service.

## Gitlab source deployment

### Prerequisites

You will need:

1. An internet-accessible Kubernetes cluster with Knative Serving installed.
Follow the [installation instructions](../../../install/README.md) if you
need to create one.
1. Ensure Knative Serving is
[configured with a domain name](../../../serving/using-a-custom-domain.md)
that allows GitLab to call into the cluster.
1. If you're using GKE, you'll also want to
[assign a static IP address](../../../serving/gke-assigning-static-ip-address.md).
1. Install [Knative Eventing](../../../eventing).

### Install GitLab Event Source

GitLab Event source lives in the [knative/eventing-contrib](https://github.com/knative/eventing-contrib). Head to the releases page, find the latest release with `gitlab.yaml`
artifact and replace the `<RELEASE>` with version tag:

```shell
kubectl apply -f https://github.com/knative/eventing-contrib/releases/download/<RELEASE>/gitlab.yaml
```

Check that the manager is running:

```shell
kubectl -n knative-sources get pods --selector control-plane=gitlab-controller-manager
```

With the controller running you can now move on to a user persona and setup a
GitLab webhook as well as a function that will consume GitLab events.

## Using the GitLab Event Source

You are now ready to use the Event Source and trigger functions based on GitLab
projects events.

We will:

- Create a Knative service which will receive the events. To keep things simple
this service will simply dump the events to `stdout`, this is the so-called:
_event_display_
- Create a GitLab access token and a random secret token used to secure the
webhooks
- Create the event source by posting a GitLab source object manifest to
Kubernetes

### Create a Knative Service

The `event-display.yaml` file shown below defines the basic service which will
receive events from the GitLab source.

```yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: gitlab-event-display
spec:
template:
spec:
containers:
- image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display
```
Create the service:
```shell
kubectl -n default apply -f event-display.yaml
```

### Create GitLab Tokens

1. Create a
[personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)
which the GitLab source will use to register webhooks with the GitLab API.
The token must have an "api" access scope in order to create repository
webhooks. Also decide on a secret token that your source will use to
authenticate the incoming webhooks from GitLab.

1. Update a secret values in `secret.yaml` defined below:

`accessToken` is the personal access token created in step 1 and
`secretToken` is any token of your choosing.

Hint: you can generate a random _secretToken_ with:

```shell
head -c 8 /dev/urandom | base64
```

`secret.yaml`:

```yaml
apiVersion: v1
kind: Secret
metadata:
name: gitlabsecret
type: Opaque
stringData:
accessToken: <personal_access_token_value>
secretToken: <random_string>
```
1. Create the secret using `kubectl`.

```shell
kubectl -n default apply -f secret.yaml
```

### Create Event Source for GitLab Events

1. In order to receive GitLab events, you have to create a concrete Event Source
for a specific namespace. Replace the `projectUrl` value in the
`gitlabsource.yaml` file with your GitLab project URL, for example
`https://gitlab.com/knative-examples/functions`.

`gitlabsource.yaml`:

```yaml
apiVersion: sources.knative.dev/v1alpha1
kind: GitLabSource
metadata:
name: gitlabsource-sample
spec:
eventTypes:
- push_events
- issues_events
projectUrl: <project url>
accessToken:
secretKeyRef:
name: gitlabsecret
key: accessToken
secretToken:
secretKeyRef:
name: gitlabsecret
key: secretToken
sink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: gitlab-event-display
```

1. Apply the yaml file using `kubectl`:

```shell
kubectl -n default apply -f gitlabsource.yaml
```

### Verify

Verify that GitLab webhook was created by looking at the list of webhooks under
**Settings >> Integrations** in your GitLab project. A hook should be listed
that points to your Knative cluster.

Create a push event and check the logs of the Pod backing the
`gitlab-event-display` knative service. You will see the event:

```
☁️ cloudevents.Event
Validation: valid
Context Attributes,
specversion: 0.3
type: dev.knative.sources.gitlabsource.Push Hook
source: https://gitlab.com/<user>/<project>
id: f83c080f-c2af-48ff-8d8b-fd5b21c5938e
time: 2020-03-12T11:08:41.414572482Z
datacontenttype: application/json
Data,
{
<Event payload>
}
```

### Cleanup

You can remove the GitLab webhook by deleting the GitLab source:

```shell
kubectl --namespace default delete --filename gitlabsource.yaml
```

Similarly, you can remove the Service and Secret via:

```shell
kubectl --namespace default delete --filename event-display.yaml
kubectl --namespace default delete --filename secret.yaml
```
3 changes: 2 additions & 1 deletion docs/eventing/samples/helloworld/helloworld-go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ mesh via the Broker and can be delivered to other services using a Trigger
spec:
containers:
- name: helloworld-go
image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display
# Source code: https://github.com/knative/eventing-contrib/tree/master/cmd/event_display
image: gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
---
# Service that exposes event-display app.
# This will be the subscriber for the Trigger
Expand Down
6 changes: 4 additions & 2 deletions docs/eventing/samples/kafka/source/event-source.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ metadata:
name: kafka-source
spec:
consumerGroup: KAFKA_CONSUMER_GROUP_NAME
bootstrapServers: KAFKA_BOOTSTRAP_SERVERS
topics: KAFKA_TOPICS
bootstrapServers:
- KAFKA_BOOTSTRAP_SERVERS
topics:
- KAFKA_TOPICS
net:
sasl:
enable: KAFKA_SASL_ENABLE
Expand Down
Loading

0 comments on commit 34d2cd6

Please sign in to comment.