Skip to content

Commit

Permalink
remove deprecated trigger name in Pulsar scaler
Browse files Browse the repository at this point in the history
Signed-off-by: Kun Woo Yoo <[email protected]>
  • Loading branch information
kunwooy committed Aug 20, 2024
1 parent 36cc226 commit aae45a4
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions pkg/scalers/pulsar_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ type pulsarMetadata struct {
}

const (
msgBacklogMetricName = "msgBacklog"
pulsarMetricType = "External"
defaultMsgBacklogThreshold = 10
enable = "enable"
Expand Down Expand Up @@ -182,23 +181,13 @@ func parsePulsarMetadata(config *scalersconfig.ScalerConfig, logger logr.Logger)

meta.msgBacklogThreshold = defaultMsgBacklogThreshold

// FIXME: msgBacklog support DEPRECATED to be removed in v2.14
fmt.Println(config.TriggerMetadata)
if val, ok := config.TriggerMetadata[msgBacklogMetricName]; ok {
logger.V(1).Info("\"msgBacklog\" is deprecated and will be removed in v2.14, please use \"msgBacklogThreshold\" instead")
if val, ok := config.TriggerMetadata["msgBacklogThreshold"]; ok {
t, err := strconv.ParseInt(val, 10, 64)
if err != nil {
return meta, fmt.Errorf("error parsing %s: %w", msgBacklogMetricName, err)
}
meta.msgBacklogThreshold = t
} else if val, ok := config.TriggerMetadata["msgBacklogThreshold"]; ok {
t, err := strconv.ParseInt(val, 10, 64)
if err != nil {
return meta, fmt.Errorf("error parsing %s: %w", msgBacklogMetricName, err)
return meta, fmt.Errorf("error parsing %s: %w", "msgBacklogThreshold", err)
}
meta.msgBacklogThreshold = t
}
// END FIXME

// For backwards compatibility, we need to map "tls: enable" to
if tls, ok := config.TriggerMetadata["tls"]; ok {
Expand All @@ -212,7 +201,7 @@ func parsePulsarMetadata(config *scalersconfig.ScalerConfig, logger logr.Logger)
}
auth, err := authentication.GetAuthConfigs(config.TriggerMetadata, config.AuthParams)
if err != nil {
return meta, fmt.Errorf("error parsing %s: %w", msgBacklogMetricName, err)
return meta, fmt.Errorf("error parsing %s: %w", "msgBacklogThreshold", err)
}

if auth != nil && auth.EnableOAuth {
Expand Down

0 comments on commit aae45a4

Please sign in to comment.