Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

Commit

Permalink
Eventstore optional field in CRD
Browse files Browse the repository at this point in the history
  • Loading branch information
tzununbekov committed Sep 4, 2021
1 parent b51adc6 commit 8674be5
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 2 deletions.
6 changes: 6 additions & 0 deletions config/300-function.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ spec:
responseMode:
description: 'Whether function responds with CE payload only or with full event.'
type: string
eventStore:
type: object
description: 'EventStore service connection string.'
properties:
uri:
type: string
ceOverrides:
type: object
description: "Defines overrides to control modifications of the event attributes."
Expand Down
2 changes: 1 addition & 1 deletion config/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ spec:
value: triggermesh.io/routing

- name: RUNTIME_KLR_PYTHON
value: gcr.io/triggermesh/knative-lambda-python37:v1.8.1
value: gcr.io/triggermesh/knative-lambda-python37:v1.9.1
- name: RUNTIME_KLR_NODE
value: gcr.io/triggermesh/knative-lambda-node10:v1.8.1
- name: RUNTIME_KLR_RUBY
Expand Down
17 changes: 17 additions & 0 deletions pkg/apis/function/v1alpha1/deepcopy_generated.go

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

8 changes: 8 additions & 0 deletions pkg/apis/function/v1alpha1/function_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,18 @@ type FunctionSpec struct {
Public bool `json:"public,omitempty"`
Code string `json:"code"`
ResponseMode string `json:"responseMode,omitempty"`
EventStore EventStoreConnection `json:"eventStore,omitempty"`
CloudEventOverrides *duckv1.CloudEventOverrides `json:"ceOverrides"`
Sink *duckv1.Destination `json:"sink"`
}

// EventStoreConnection contains the data to connect to
// an EventStore instance
type EventStoreConnection struct {
// URI is the gRPC location to the EventStore
URI string `json:"uri"`
}

// FunctionStatus communicates the observed state of the Function (from the controller).
type FunctionStatus struct {
duckv1.SourceStatus `json:",inline"`
Expand Down
5 changes: 4 additions & 1 deletion pkg/reconciler/function/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ import (
functionreconciler "github.com/triggermesh/function/pkg/client/generated/injection/reconciler/function/v1alpha1/function"
)

const runtimeEnvPrefix = "RUNTIME_"
const (
eventStoreEnv = "EVENTSTORE_URI"
runtimeEnvPrefix = "RUNTIME_"
)

// New creates a Reconciler and returns the result of NewImpl.
func NewController(
Expand Down
1 change: 1 addition & 0 deletions pkg/reconciler/function/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ func (r *Reconciler) reconcileKnService(ctx context.Context, f *functionv1alpha1
resources.KnSvcImage(image),
resources.KnSvcMountCm(cm.Name, filename),
resources.KnSvcEntrypoint(klrEntrypoint),
resources.KnSvcEnvVar(eventStoreEnv, f.Spec.EventStore.URI),
resources.KnSvcEnvVar("K_SINK", sink.String()),
resources.KnSvcEnvVar("_HANDLER", handler),
resources.KnSvcEnvVar("RESPONSE_FORMAT", "CLOUDEVENTS"),
Expand Down

0 comments on commit 8674be5

Please sign in to comment.