Skip to content

Commit

Permalink
feat: storage grid auto registration (#694)
Browse files Browse the repository at this point in the history
* fix: gateway and sensor service name

* feat: added auto notification registration for storagegrid

* feat: adding auto registration for storage grid

* feat: auto notification configuration for storagegrid

* chore: remove defunct test

* chore: fix package name

* chore: remove optional namespace
  • Loading branch information
VaibhavPage committed Jun 11, 2020
1 parent 8b06b20 commit 2a4d6cd
Show file tree
Hide file tree
Showing 15 changed files with 503 additions and 71 deletions.
59 changes: 59 additions & 0 deletions api/event-source.html
Original file line number Diff line number Diff line change
Expand Up @@ -2488,6 +2488,65 @@ <h3 id="argoproj.io/v1alpha1.StorageGridEventSource">StorageGridEventSource
<p>Filter on object key which caused the notification.</p>
</td>
</tr>
<tr>
<td>
<code>topicArn</code></br>
<em>
string
</em>
</td>
<td>
<p>TopicArn</p>
</td>
</tr>
<tr>
<td>
<code>bucket</code></br>
<em>
string
</em>
</td>
<td>
<p>Name of the bucket to register notifications for.</p>
</td>
</tr>
<tr>
<td>
<code>region</code></br>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>S3 region.
Defaults to us-east-1</p>
</td>
</tr>
<tr>
<td>
<code>authToken</code></br>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.13/#secretkeyselector-v1-core">
Kubernetes core/v1.SecretKeySelector
</a>
</em>
</td>
<td>
<p>Auth token for storagegrid api</p>
</td>
</tr>
<tr>
<td>
<code>apiURL</code></br>
<em>
string
</em>
</td>
<td>
<p>ApiURL is the url of the storagegrid api.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="argoproj.io/v1alpha1.StorageGridFilter">StorageGridFilter
Expand Down
104 changes: 104 additions & 0 deletions api/event-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -4904,6 +4904,110 @@ Filter on object key which caused the notification.

</tr>

<tr>

<td>

<code>topicArn</code></br> <em> string </em>

</td>

<td>

<p>

TopicArn

</p>

</td>

</tr>

<tr>

<td>

<code>bucket</code></br> <em> string </em>

</td>

<td>

<p>

Name of the bucket to register notifications for.

</p>

</td>

</tr>

<tr>

<td>

<code>region</code></br> <em> string </em>

</td>

<td>

<em>(Optional)</em>

<p>

S3 region. Defaults to us-east-1

</p>

</td>

</tr>

<tr>

<td>

<code>authToken</code></br> <em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.13/#secretkeyselector-v1-core">
Kubernetes core/v1.SecretKeySelector </a> </em>

</td>

<td>

<p>

Auth token for storagegrid api

</p>

</td>

</tr>

<tr>

<td>

<code>apiURL</code></br> <em> string </em>

</td>

<td>

<p>

ApiURL is the url of the storagegrid api.

</p>

</td>

</tr>

</tbody>

</table>
Expand Down
36 changes: 15 additions & 21 deletions examples/event-sources/storage-grid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ kind: EventSource
metadata:
name: storage-grid-event-source
spec:
type: storage-grid
type: storagegrid
storageGrid:
example-insecure:
example:
# hook contains configuration for the HTTP server running in the gateway.
# StorageGrid will send events to following port and endpoint
webhook:
Expand All @@ -15,24 +15,18 @@ spec:
method: POST
# endpoint to listen events on
endpoint: "/"
# url for StorageGrid to send notifications to. Make sure that this URL is reachable from StorageGrid
url: gateway-url
# List of supported events can be derived from AWS S3 events https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#supported-notification-event-types
# Remove S3 prefix from event type to make it a StorageGrid event.
events:
- ObjectCreated:Put

# example-secure:
# webhook:
# # port to run HTTP server on
# port: "8090"
# # HTTP request method to allow. In this case, only POST requests are accepted
# method: POST
# # endpoint to listen events on
# endpoint: "/"
# # path to file that is mounted in gateway pod which contains certs
# serverCertPath: "some path in pod"
# # path to file that is mounted in gateway pod which contains private key
# serverKeyPath: "some path in pod"
# # for events object PUT, POST, COPY and object removal
# events:
# - ObjectCreated:*
# - ObjectRemoved:Delete
- s3:ObjectCreated:*
# More info available at https://docs.netapp.com/sgws-110/index.jsp?topic=%2Fcom.netapp.doc.sg-tenant-admin%2FGUID-7D83D20B-F061-40ED-8C7C-F3395047B8C5.html
topicArn: topic arn
# Name of the bucket to listen notifications for
bucket: name of the bucket
# This is the URL of your StorageGrid API Portal
apiURL: storagegrid api url
# Auth Token to authenticate against StorageGrid API
authToken:
name: name of k8s secret that holds storagegrid auth token
key: key within secret that holds the token value
4 changes: 2 additions & 2 deletions examples/gateways/storage-grid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Gateway
metadata:
name: storage-grid
spec:
type: storage-grid
type: storagegrid
eventSourceRef:
name: storage-grid-event-source
template:
Expand All @@ -14,4 +14,4 @@ spec:
targetPort: 8080
subscribers:
http:
- "http://storage-grid-watcher-sensor.argo-events.svc:9300/"
- "http://storage-grid-sensor.argo-events.svc:9300/"
2 changes: 1 addition & 1 deletion examples/sensors/storage-grid.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
name: storage-grid-watcher
name: storage-grid
spec:
template:
serviceAccountName: argo-events-sa
Expand Down
2 changes: 1 addition & 1 deletion gateways/server/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func getEventingServer(eventType apicommon.EventSourceType, restConfig *rest.Con
case apicommon.SlackEvent:
return &slack.EventListener{Logger: log, K8sClient: clientset, Namespace: namespace}, nil
case apicommon.StorageGridEvent:
return &storagegrid.EventListener{Logger: log}, nil
return &storagegrid.EventListener{Logger: log, K8sClient: clientset, Namespace: namespace}, nil
case apicommon.StripeEvent:
return &stripe.EventListener{Logger: log, K8sClient: clientset, Namespace: namespace}, nil
case apicommon.WebhookEvent:
Expand Down
Loading

0 comments on commit 2a4d6cd

Please sign in to comment.