TASK: Add codeblocks to code examples
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
96357c9616
commit
b2ac3a2884
1 changed files with 161 additions and 156 deletions
|
@ -29,15 +29,17 @@ order is not guaranteed.
|
||||||
To setup a registry instance to send notifications to endpoints, one must add
|
To setup a registry instance to send notifications to endpoints, one must add
|
||||||
them to the configuration. A simple example follows:
|
them to the configuration. A simple example follows:
|
||||||
|
|
||||||
notifications:
|
```yaml
|
||||||
endpoints:
|
notifications:
|
||||||
- name: alistener
|
endpoints:
|
||||||
url: https://mylistener.example.com/event
|
- name: alistener
|
||||||
headers:
|
url: https://mylistener.example.com/event
|
||||||
Authorization: [Bearer <your token, if needed>]
|
headers:
|
||||||
timeout: 500ms
|
Authorization: [Bearer <your token, if needed>]
|
||||||
threshold: 5
|
timeout: 500ms
|
||||||
backoff: 1s
|
threshold: 5
|
||||||
|
backoff: 1s
|
||||||
|
```
|
||||||
|
|
||||||
The above would configure the registry with an endpoint to send events to
|
The above would configure the registry with an endpoint to send events to
|
||||||
`https://mylistener.example.com/event`, with the header "Authorization: Bearer
|
`https://mylistener.example.com/event`, with the header "Authorization: Bearer
|
||||||
|
@ -86,34 +88,34 @@ manifest:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"events": [
|
"events": [
|
||||||
{
|
{
|
||||||
"id": "320678d8-ca14-430f-8bb6-4ca139cd83f7",
|
"id": "320678d8-ca14-430f-8bb6-4ca139cd83f7",
|
||||||
"timestamp": "2016-03-09T14:44:26.402973972-08:00",
|
"timestamp": "2016-03-09T14:44:26.402973972-08:00",
|
||||||
"action": "pull",
|
"action": "pull",
|
||||||
"target": {
|
"target": {
|
||||||
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
|
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
|
||||||
"size": 708,
|
"size": 708,
|
||||||
"digest": "sha256:fea8895f450959fa676bcc1df0611ea93823a735a01205fd8622846041d0c7cf",
|
"digest": "sha256:fea8895f450959fa676bcc1df0611ea93823a735a01205fd8622846041d0c7cf",
|
||||||
"length": 708,
|
"length": 708,
|
||||||
"repository": "hello-world",
|
"repository": "hello-world",
|
||||||
"url": "http://192.168.100.227:5000/v2/hello-world/manifests/sha256:fea8895f450959fa676bcc1df0611ea93823a735a01205fd8622846041d0c7cf",
|
"url": "http://192.168.100.227:5000/v2/hello-world/manifests/sha256:fea8895f450959fa676bcc1df0611ea93823a735a01205fd8622846041d0c7cf",
|
||||||
"tag": "latest"
|
"tag": "latest"
|
||||||
},
|
},
|
||||||
"request": {
|
"request": {
|
||||||
"id": "6df24a34-0959-4923-81ca-14f09767db19",
|
"id": "6df24a34-0959-4923-81ca-14f09767db19",
|
||||||
"addr": "192.168.64.11:42961",
|
"addr": "192.168.64.11:42961",
|
||||||
"host": "192.168.100.227:5000",
|
"host": "192.168.100.227:5000",
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"useragent": "curl/7.38.0"
|
"useragent": "curl/7.38.0"
|
||||||
},
|
},
|
||||||
"actor": {},
|
"actor": {},
|
||||||
"source": {
|
"source": {
|
||||||
"addr": "xtal.local:5000",
|
"addr": "xtal.local:5000",
|
||||||
"instanceID": "a53db899-3b4b-4a62-a067-8dd013beaca4"
|
"instanceID": "a53db899-3b4b-4a62-a067-8dd013beaca4"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -123,10 +125,12 @@ contains a subset of the data contained in Get and Put events. Specifically,
|
||||||
only the digest and repository are sent.
|
only the digest and repository are sent.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"target": {
|
{
|
||||||
"digest": "sha256:d89e1bee20d9cb344674e213b581f14fbd8e70274ecf9d10c514bab78a307845",
|
"target": {
|
||||||
"repository": "library/test"
|
"digest": "sha256:d89e1bee20d9cb344674e213b581f14fbd8e70274ecf9d10c514bab78a307845",
|
||||||
},
|
"repository": "library/test"
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note**: As of version 2.1, the `length` field for event targets
|
> **Note**: As of version 2.1, the `length` field for event targets
|
||||||
|
@ -140,7 +144,7 @@ The envelope contains one or more events, with the following json structure:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"events": [ ... ],
|
"events": [ "..." ]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -155,90 +159,90 @@ request coming to an endpoint.
|
||||||
|
|
||||||
An example of a full event may look as follows:
|
An example of a full event may look as follows:
|
||||||
|
|
||||||
```json
|
```
|
||||||
GET /callback
|
GET /callback HTTP/1.1
|
||||||
Host: application/vnd.docker.distribution.events.v1+json
|
Host: application/vnd.docker.distribution.events.v1+json
|
||||||
Authorization: Bearer <your token, if needed>
|
Authorization: Bearer <your token, if needed>
|
||||||
Content-Type: application/vnd.docker.distribution.events.v1+json
|
Content-Type: application/vnd.docker.distribution.events.v1+json
|
||||||
|
|
||||||
{
|
{
|
||||||
"events": [
|
"events": [
|
||||||
{
|
{
|
||||||
"id": "asdf-asdf-asdf-asdf-0",
|
"id": "asdf-asdf-asdf-asdf-0",
|
||||||
"timestamp": "2006-01-02T15:04:05Z",
|
"timestamp": "2006-01-02T15:04:05Z",
|
||||||
"action": "push",
|
"action": "push",
|
||||||
"target": {
|
"target": {
|
||||||
"mediaType": "application/vnd.docker.distribution.manifest.v1+json",
|
"mediaType": "application/vnd.docker.distribution.manifest.v1+json",
|
||||||
"length": 1,
|
"length": 1,
|
||||||
"digest": "sha256:fea8895f450959fa676bcc1df0611ea93823a735a01205fd8622846041d0c7cf",
|
"digest": "sha256:fea8895f450959fa676bcc1df0611ea93823a735a01205fd8622846041d0c7cf",
|
||||||
"repository": "library/test",
|
"repository": "library/test",
|
||||||
"url": "https://example.com/v2/library/test/manifests/sha256:c3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5"
|
"url": "https://example.com/v2/library/test/manifests/sha256:c3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5"
|
||||||
},
|
|
||||||
"request": {
|
|
||||||
"id": "asdfasdf",
|
|
||||||
"addr": "client.local",
|
|
||||||
"host": "registrycluster.local",
|
|
||||||
"method": "PUT",
|
|
||||||
"useragent": "test/0.1"
|
|
||||||
},
|
|
||||||
"actor": {
|
|
||||||
"name": "test-actor"
|
|
||||||
},
|
|
||||||
"source": {
|
|
||||||
"addr": "hostname.local:port"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
"request": {
|
||||||
"id": "asdf-asdf-asdf-asdf-1",
|
"id": "asdfasdf",
|
||||||
"timestamp": "2006-01-02T15:04:05Z",
|
"addr": "client.local",
|
||||||
"action": "push",
|
"host": "registrycluster.local",
|
||||||
"target": {
|
"method": "PUT",
|
||||||
"mediaType": "application/vnd.docker.container.image.rootfs.diff+x-gtar",
|
"useragent": "test/0.1"
|
||||||
"length": 2,
|
|
||||||
"digest": "sha256:c3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5",
|
|
||||||
"repository": "library/test",
|
|
||||||
"url": "https://example.com/v2/library/test/blobs/sha256:c3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5"
|
|
||||||
},
|
|
||||||
"request": {
|
|
||||||
"id": "asdfasdf",
|
|
||||||
"addr": "client.local",
|
|
||||||
"host": "registrycluster.local",
|
|
||||||
"method": "PUT",
|
|
||||||
"useragent": "test/0.1"
|
|
||||||
},
|
|
||||||
"actor": {
|
|
||||||
"name": "test-actor"
|
|
||||||
},
|
|
||||||
"source": {
|
|
||||||
"addr": "hostname.local:port"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
"actor": {
|
||||||
"id": "asdf-asdf-asdf-asdf-2",
|
"name": "test-actor"
|
||||||
"timestamp": "2006-01-02T15:04:05Z",
|
},
|
||||||
"action": "push",
|
"source": {
|
||||||
"target": {
|
"addr": "hostname.local:port"
|
||||||
"mediaType": "application/vnd.docker.container.image.rootfs.diff+x-gtar",
|
|
||||||
"length": 3,
|
|
||||||
"digest": "sha256:c3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5",
|
|
||||||
"repository": "library/test",
|
|
||||||
"url": "https://example.com/v2/library/test/blobs/sha256:c3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5"
|
|
||||||
},
|
|
||||||
"request": {
|
|
||||||
"id": "asdfasdf",
|
|
||||||
"addr": "client.local",
|
|
||||||
"host": "registrycluster.local",
|
|
||||||
"method": "PUT",
|
|
||||||
"useragent": "test/0.1"
|
|
||||||
},
|
|
||||||
"actor": {
|
|
||||||
"name": "test-actor"
|
|
||||||
},
|
|
||||||
"source": {
|
|
||||||
"addr": "hostname.local:port"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
|
{
|
||||||
|
"id": "asdf-asdf-asdf-asdf-1",
|
||||||
|
"timestamp": "2006-01-02T15:04:05Z",
|
||||||
|
"action": "push",
|
||||||
|
"target": {
|
||||||
|
"mediaType": "application/vnd.docker.container.image.rootfs.diff+x-gtar",
|
||||||
|
"length": 2,
|
||||||
|
"digest": "sha256:c3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5",
|
||||||
|
"repository": "library/test",
|
||||||
|
"url": "https://example.com/v2/library/test/blobs/sha256:c3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5"
|
||||||
|
},
|
||||||
|
"request": {
|
||||||
|
"id": "asdfasdf",
|
||||||
|
"addr": "client.local",
|
||||||
|
"host": "registrycluster.local",
|
||||||
|
"method": "PUT",
|
||||||
|
"useragent": "test/0.1"
|
||||||
|
},
|
||||||
|
"actor": {
|
||||||
|
"name": "test-actor"
|
||||||
|
},
|
||||||
|
"source": {
|
||||||
|
"addr": "hostname.local:port"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "asdf-asdf-asdf-asdf-2",
|
||||||
|
"timestamp": "2006-01-02T15:04:05Z",
|
||||||
|
"action": "push",
|
||||||
|
"target": {
|
||||||
|
"mediaType": "application/vnd.docker.container.image.rootfs.diff+x-gtar",
|
||||||
|
"length": 3,
|
||||||
|
"digest": "sha256:c3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5",
|
||||||
|
"repository": "library/test",
|
||||||
|
"url": "https://example.com/v2/library/test/blobs/sha256:c3b3692957d439ac1928219a83fac91e7bf96c153725526874673ae1f2023f8d5"
|
||||||
|
},
|
||||||
|
"request": {
|
||||||
|
"id": "asdfasdf",
|
||||||
|
"addr": "client.local",
|
||||||
|
"host": "registrycluster.local",
|
||||||
|
"method": "PUT",
|
||||||
|
"useragent": "test/0.1"
|
||||||
|
},
|
||||||
|
"actor": {
|
||||||
|
"name": "test-actor"
|
||||||
|
},
|
||||||
|
"source": {
|
||||||
|
"addr": "hostname.local:port"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -263,49 +267,50 @@ The following provides an example of a few endpoints that have experienced
|
||||||
several failures and have since recovered:
|
several failures and have since recovered:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"notifications":{
|
{
|
||||||
"endpoints":[
|
"notifications": {
|
||||||
|
"endpoints": [
|
||||||
{
|
{
|
||||||
"name":"local-5003",
|
"name": "local-5003",
|
||||||
"url":"http://localhost:5003/callback",
|
"url": "http://localhost:5003/callback",
|
||||||
"Headers":{
|
"Headers": {
|
||||||
"Authorization":[
|
"Authorization": [
|
||||||
"Bearer \u003can example token\u003e"
|
"Bearer \u003can example token\u003e"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"Timeout":1000000000,
|
"Timeout": 1000000000,
|
||||||
"Threshold":10,
|
"Threshold": 10,
|
||||||
"Backoff":1000000000,
|
"Backoff": 1000000000,
|
||||||
"Metrics":{
|
"Metrics": {
|
||||||
"Pending":76,
|
"Pending": 76,
|
||||||
"Events":76,
|
"Events": 76,
|
||||||
"Successes":0,
|
"Successes": 0,
|
||||||
"Failures":0,
|
"Failures": 0,
|
||||||
"Errors":46,
|
"Errors": 46,
|
||||||
"Statuses":{
|
"Statuses": {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"local-8083",
|
"name": "local-8083",
|
||||||
"url":"http://localhost:8083/callback",
|
"url": "http://localhost:8083/callback",
|
||||||
"Headers":null,
|
"Headers": null,
|
||||||
"Timeout":1000000000,
|
"Timeout": 1000000000,
|
||||||
"Threshold":10,
|
"Threshold": 10,
|
||||||
"Backoff":1000000000,
|
"Backoff": 1000000000,
|
||||||
"Metrics":{
|
"Metrics": {
|
||||||
"Pending":0,
|
"Pending": 0,
|
||||||
"Events":76,
|
"Events": 76,
|
||||||
"Successes":76,
|
"Successes": 76,
|
||||||
"Failures":0,
|
"Failures": 0,
|
||||||
"Errors":28,
|
"Errors": 28,
|
||||||
"Statuses":{
|
"Statuses": {
|
||||||
"202 Accepted":76
|
"202 Accepted": 76
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue