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: Support "Copper Argos" with Athenz authentication for pulsar #2881

Merged
merged 2 commits into from
Oct 30, 2023
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: 8 additions & 6 deletions eventsources/sources/pulsar/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,16 @@ func (el *EventListener) StartListening(ctx context.Context, dispatch func([]byt
clientOpt.Authentication = pulsar.NewAuthenticationToken(token)
}

if len(pulsarEventSource.AuthAthenzParams) > 0 && pulsarEventSource.AuthAthenzSecret != nil {
if len(pulsarEventSource.AuthAthenzParams) > 0 {
log.Info("setting athenz auth option...")
authAthenzFilePath, err := common.GetSecretVolumePath(pulsarEventSource.AuthAthenzSecret)
if err != nil {
log.Errorw("failed to get authAthenzSecret from the volume", zap.Error(err))
return err
if pulsarEventSource.AuthAthenzSecret != nil {
authAthenzFilePath, err := common.GetSecretVolumePath(pulsarEventSource.AuthAthenzSecret)
if err != nil {
log.Errorw("failed to get authAthenzSecret from the volume", zap.Error(err))
return err
}
pulsarEventSource.AuthAthenzParams["privateKey"] = "file://" + authAthenzFilePath
}
pulsarEventSource.AuthAthenzParams["privateKey"] = "file://" + authAthenzFilePath
clientOpt.Authentication = pulsar.NewAuthenticationAthenz(pulsarEventSource.AuthAthenzParams)
}

Expand Down
14 changes: 8 additions & 6 deletions sensors/triggers/pulsar/pulsar.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,16 @@ func NewPulsarTrigger(sensor *v1alpha1.Sensor, trigger *v1alpha1.Trigger, pulsar
clientOpt.Authentication = pulsar.NewAuthenticationToken(token)
}

if len(pulsarTrigger.AuthAthenzParams) > 0 && pulsarTrigger.AuthAthenzSecret != nil {
if len(pulsarTrigger.AuthAthenzParams) > 0 {
logger.Info("setting athenz auth option...")
authAthenzFilePath, err := common.GetSecretVolumePath(pulsarTrigger.AuthAthenzSecret)
if err != nil {
logger.Errorw("failed to get authAthenzSecret from the volume", zap.Error(err))
return nil, err
if pulsarTrigger.AuthAthenzSecret != nil {
authAthenzFilePath, err := common.GetSecretVolumePath(pulsarTrigger.AuthAthenzSecret)
if err != nil {
logger.Errorw("failed to get authAthenzSecret from the volume", zap.Error(err))
return nil, err
}
pulsarTrigger.AuthAthenzParams["privateKey"] = "file://" + authAthenzFilePath
}
pulsarTrigger.AuthAthenzParams["privateKey"] = "file://" + authAthenzFilePath
clientOpt.Authentication = pulsar.NewAuthenticationAthenz(pulsarTrigger.AuthAthenzParams)
}

Expand Down
Loading