diff --git a/eventsources/sources/pulsar/start.go b/eventsources/sources/pulsar/start.go index 18a2fcc94b..e1307a999d 100644 --- a/eventsources/sources/pulsar/start.go +++ b/eventsources/sources/pulsar/start.go @@ -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) } diff --git a/sensors/triggers/pulsar/pulsar.go b/sensors/triggers/pulsar/pulsar.go index 2e5f0eca08..6b0956760c 100644 --- a/sensors/triggers/pulsar/pulsar.go +++ b/sensors/triggers/pulsar/pulsar.go @@ -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) }