Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding support for token authentication in Pulsar EventSource #1359

Merged
merged 1 commit into from
Sep 24, 2021
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
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.