Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions helm-chart/eoapi-notifier/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,24 @@ config:
database: postgis
username: postgres
password: password

outputs:
- type: mqtt
config:
broker_host: mqtt-broker
broker_port: 1883

- type: cloudevents
config:
source: /eoapi/pgstac
event_type: org.eoapi.stac.item
destination:
ref:
apiVersion: messaging.knative.dev/v1
kind: Broker
name: my-channel-1
namespace: serverless

secrets:
postgresql:
create: true
Expand All @@ -47,3 +59,23 @@ resources:
cpu: 100m
memory: 128Mi
```

## KNative SinkBinding Support

The chart automatically creates KNative SinkBinding resources for CloudEvents outputs, resolving object references to URLs via the `K_SINK` environment variable.

### Configuration

```yaml
outputs:
- type: cloudevents
config:
source: /eoapi/pgstac
event_type: org.eoapi.stac.item
destination:
ref:
apiVersion: messaging.knative.dev/v1
kind: Broker
name: my-broker
namespace: default # optional
```
3 changes: 2 additions & 1 deletion helm-chart/eoapi-notifier/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@ Return the proper image pull policy
*/}}
{{- define "eoapi-notifier.imagePullPolicy" -}}
{{- .Values.image.pullPolicy | default "IfNotPresent" }}
{{- end }}
{{- end }}

5 changes: 5 additions & 0 deletions helm-chart/eoapi-notifier/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ data:
{{- range .Values.config.outputs}}
- type: {{.type}}
config:
{{- if eq .type "cloudevents"}}
{{- $config := omit .config "destination"}}
{{- toYaml $config | nindent 10}}
{{- else}}
{{- toYaml .config | nindent 10}}
{{- end}}
{{- end}}
24 changes: 24 additions & 0 deletions helm-chart/eoapi-notifier/templates/sinkbinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- range $index, $output := .Values.config.outputs }}
{{- if eq $output.type "cloudevents" }}
---
apiVersion: sources.knative.dev/v1
kind: SinkBinding
metadata:
name: {{ include "eoapi-notifier.fullname" $ }}-cloudevents-{{ $index }}
labels:
{{- include "eoapi-notifier.labels" $ | nindent 4 }}
spec:
subject:
apiVersion: apps/v1
kind: Deployment
name: {{ include "eoapi-notifier.fullname" $ }}
sink:
ref:
apiVersion: {{ $output.config.destination.ref.apiVersion }}
kind: {{ $output.config.destination.ref.kind }}
name: {{ $output.config.destination.ref.name }}
{{- if $output.config.destination.ref.namespace }}
namespace: {{ $output.config.destination.ref.namespace }}
{{- end }}
{{- end }}
{{- end }}
15 changes: 9 additions & 6 deletions helm-chart/eoapi-notifier/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ config:

- type: cloudevents
config:
# Will be overridden by K_SINK from KNative SinkBinding
endpoint: https://example.com/webhook
source: /eoapi/stac
event_type: org.eoapi.stac
source: /eoapi/pgstac
event_type: org.eoapi.stac.item
destination:
ref:
apiVersion: messaging.knative.dev/v1
kind: Broker
name: my-channel-1
namespace: serverless

# Secrets
secrets:
Expand Down Expand Up @@ -91,5 +95,4 @@ env: {}
# CLOUDEVENTS_SOURCE: /eoapi/stac/production
# CLOUDEVENTS_EVENT_TYPE: org.eoapi.stac.item
#
# KNative examples (typically set by SinkBinding):
# K_SINK: https://my-knative-service.default.svc.cluster.local
# KNative SinkBinding automatically sets K_SINK environment variable