Skip to content

Commit

Permalink
feat: Adding support for token authentication in Pulsar EventSource (#…
Browse files Browse the repository at this point in the history
…1359)

Signed-off-by: Arnar Gauti Ingason <[email protected]>
  • Loading branch information
arnarg authored Sep 24, 2021
1 parent 10321c7 commit 42fe43e
Show file tree
Hide file tree
Showing 9 changed files with 475 additions and 363 deletions.
14 changes: 14 additions & 0 deletions api/event-source.html

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

13 changes: 13 additions & 0 deletions api/event-source.md

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

4 changes: 4 additions & 0 deletions api/openapi-spec/swagger.json

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

9 changes: 9 additions & 0 deletions eventsources/sources/pulsar/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ func (el *EventListener) StartListening(ctx context.Context, dispatch func([]byt
TLSValidateHostname: pulsarEventSource.TLSValidateHostname,
}

if pulsarEventSource.AuthTokenSecret != nil {
token, err := common.GetSecretFromVolume(pulsarEventSource.AuthTokenSecret)
if err != nil {
log.Errorw("failed to get AuthTokenSecret from the volume", "error", err)
return err
}
clientOpt.Authentication = pulsar.NewAuthenticationToken(token)
}

if pulsarEventSource.TLS != nil {
log.Info("setting tls auth option...")
var clientCertPath, clientKeyPath string
Expand Down
780 changes: 417 additions & 363 deletions pkg/apis/eventsource/v1alpha1/generated.pb.go

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pkg/apis/eventsource/v1alpha1/generated.proto

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

6 changes: 6 additions & 0 deletions pkg/apis/eventsource/v1alpha1/openapi_generated.go

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

3 changes: 3 additions & 0 deletions pkg/apis/eventsource/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,9 @@ type PulsarEventSource struct {
// Metadata holds the user defined metadata which will passed along the event payload.
// +optional
Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,10,rep,name=metadata"`
// Authentication token for the pulsar client.
// +optional
AuthTokenSecret *corev1.SecretKeySelector `json:"authTokenSecret,omitempty" protobuf:"bytes,11,opt,name=authTokenSecret"`
}

// GenericEventSource refers to a generic event source. It can be used to implement a custom event source.
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/eventsource/v1alpha1/zz_generated.deepcopy.go

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

0 comments on commit 42fe43e

Please sign in to comment.