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

Cassandra_Scaler improvement - Fixed port error #4151

Closed
wants to merge 4 commits into from
Closed
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Here is an overview of all new **experimental** features:
- **CPU Memory Scaler** Store forgotten logger ([#4022](https://github.com/kedacore/keda/issues/4022))
**Kafka Scaler**: Support 0 in activationLagThreshold configuration ([#4137](https://github.com/kedacore/keda/issues/4137))
- **Prometheus Metrics**: Expose Prometheus Metrics also when getting ScaledObject state ([#4075](https://github.com/kedacore/keda/issues/4075))
- **Cassandra Scaler:** Fixed the assignment of port information ([4110])(https://github.com/kedacore/keda/issues/4110)


### Deprecations
Expand Down
12 changes: 8 additions & 4 deletions pkg/scalers/cassandra_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,15 @@ func parseCassandraMetadata(config *ScalerConfig) (*CassandraMetadata, error) {
}

if val, ok := config.TriggerMetadata["clusterIPAddress"]; ok {
switch p := meta.port; {
case p > 0:
meta.clusterIPAddress = net.JoinHostPort(val, fmt.Sprintf("%d", meta.port))
case strings.Contains(val, ":"):
splitval := strings.Split(val, ":")
port := splitval[len(splitval)-1]
_, err := strconv.Atoi(port)

switch {
case err == nil:
meta.clusterIPAddress = val
case meta.port > 0:
meta.clusterIPAddress = net.JoinHostPort(val, fmt.Sprintf("%d", meta.port))
default:
return nil, fmt.Errorf("no port given")
}
Expand Down