Skip to content

feat: adding strictCooldownBehavior arg in cli - #7924

Open
rlanhellas wants to merge 13 commits into
kedacore:mainfrom
rlanhellas:issue-7204-new
Open

feat: adding strictCooldownBehavior arg in cli#7924
rlanhellas wants to merge 13 commits into
kedacore:mainfrom
rlanhellas:issue-7204-new

Conversation

@rlanhellas

@rlanhellas rlanhellas commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Provide a description of what has been changed

Checklist

  • When introducing a new scaler, I agree with the scaling governance policy
  • I have verified that my change is according to the deprecations & breaking changes policy
  • Tests have been added (if applicable)
  • Ensure make generate-scalers-schema has been run to update any outdated generated files
  • Changelog has been updated and is aligned with our changelog requirements, only when the change impacts end users
  • A PR is opened to update our Helm chart (repo) (if applicable, ie. when deployment manifests are modified)
  • A PR is opened to update the documentation on (repo) (if applicable)
  • Commits are signed with Developer Certificate of Origin (DCO - learn more)

Fixes #7204

Signed-off-by: Ronaldo Lanhellas <ronaldo.lanhellas@gmail.com>
@rlanhellas
rlanhellas requested a review from a team as a code owner July 21, 2026 00:47
@github-actions

Copy link
Copy Markdown

Thank you for your contribution! 🙏

Please understand that we will do our best to review your PR and give you feedback as soon as possible, but please bear with us if it takes a little longer as expected.

While you are waiting, make sure to:

  • Add an entry in our changelog in alphabetical order and link related issue
  • Update the documentation, if needed
  • Add unit & e2e tests for your changes
  • GitHub checks are passing
  • Is the DCO check failing? Here is how you can fix DCO issues

Once the initial tests are successful, a KEDA member will ensure that the e2e tests are run. Once the e2e tests have been successfully completed, the PR may be merged at a later date. Please be patient.

Learn more about our contribution guide.

@snyk-io

snyk-io Bot commented Jul 21, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@keda-automation
keda-automation requested a review from a team July 21, 2026 00:47
@rlanhellas rlanhellas changed the title feat: adding strictCooldownBehavior arg in cli adding strictCooldownBehavior arg in cli Jul 21, 2026
@rlanhellas rlanhellas changed the title adding strictCooldownBehavior arg in cli feat: adding strictCooldownBehavior arg in cli Jul 21, 2026
@wozniakjan

Copy link
Copy Markdown
Member

@rlanhellas ptal at the CI failures

@rlanhellas

Copy link
Copy Markdown
Contributor Author

@rlanhellas ptal at the CI failures

Alright, will take a look.

@rlanhellas

Copy link
Copy Markdown
Contributor Author

@wozniakjan , @rickbrouwer , please run the e2e tests.

@wozniakjan

wozniakjan commented Jul 28, 2026

Copy link
Copy Markdown
Member

/run-e2e
Update: You can check the progress here

passed tests: 198
Execution of tests/secret-providers/azure_keyvault_workload_identity/azure_keyvault_workload_identity_test.go, has passed after "one" attempts
Execution of tests/internals/global_custom_ca/global_custom_ca_test.go, has passed after "one" attempts
Execution of tests/internals/scaled_object_validation/scaled_object_validation_test.go, has passed after "two" attempts
Execution of tests/scalers/influxdb/influxdb_v2/influxdb_v2_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_blob/azure_blob_test.go, has passed after "one" attempts
Execution of tests/scalers/cron/cron_test.go, has passed after "one" attempts
Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_aad_wi/rabbitmq_queue_http_aad_wi_test.go, has passed after "one" attempts
Execution of tests/scalers/postgresql/azure_postgresql_flex_server_aad_wi/azure_postgresql_flex_server_aad_wi_test.go, has passed after "one" attempts
Execution of tests/secret-providers/gcp_secret_manager_workload_identity/gcp_secret_manager_workload_identity_test.go, has passed after "one" attempts
Execution of tests/internals/initial_delay_cooldownperiod/initial_delay_cooldownperiod_test.go, has passed after "one" attempts
Execution of tests/scalers/nsq/nsq_test.go, has passed after "one" attempts
Execution of tests/scalers/redis/redis_standalone_streams_lag/redis_standalone_streams_lag_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_sqs_queue_pod_identity_eks/aws_sqs_queue_pod_identity_eks_test.go, has passed after "one" attempts
Execution of tests/scalers/gcp/gcp_prometheus_workload_identity/gcp_prometheus_workload_identity_test.go, has passed after "one" attempts
Execution of tests/scalers/rabbitmq/rabbitmq_queue_amqp_vhost/rabbitmq_queue_amqp_vhost_test.go, has passed after "one" attempts
Execution of tests/internals/file_based_auth/file_based_auth_test.go, has passed after "one" attempts
Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_oauth2/rabbitmq_queue_http_oauth2_test.go, has passed after "one" attempts
Execution of tests/scalers/rabbitmq/rabbitmq_queue_amqp/rabbitmq_queue_amqp_test.go, has passed after "one" attempts
Execution of tests/internals/force_activation/force_activation_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_service_bus_topic_regex/azure_service_bus_topic_regex_test.go, has passed after "one" attempts
Execution of tests/secret-providers/trigger_auth_bound_service_account_token/trigger_auth_bound_service_account_token_test.go, has passed after "one" attempts
Execution of tests/internals/scaled_job_validation/scaled_job_validation_test.go, has passed after "one" attempts
Execution of tests/scalers/influxdb/influxdb_v3/influxdb_v3_test.go, has passed after "one" attempts
Execution of tests/scalers/artemis/artemis_test.go, has passed after "one" attempts
Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_vhost/rabbitmq_queue_http_vhost_test.go, has passed after "one" attempts
Execution of tests/internals/fallback/fallback_scaling_modifiers_test.go, has passed after "one" attempts
Execution of tests/scalers/external_push_scaler/external_push_scaler_test.go, has passed after "one" attempts
Execution of tests/scalers/solarwinds/solarwinds_test.go, has passed after "one" attempts
Execution of tests/internals/scaling_strategies/accurate_scaling_strategy/accurate_scaling_strategy_test.go, has passed after "one" attempts
Execution of tests/internals/replica_update_so/replica_update_so_test.go, has passed after "one" attempts
Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_dget/rabbitmq_queue_http_dget_test.go, has passed after "one" attempts
Execution of tests/scalers/clickhouse/clickhouse_test.go, has passed after "one" attempts
Execution of tests/internals/pause_scale_out/pause_scale_out_test.go, has passed after "one" attempts
Execution of tests/scalers/dynatrace_dql/dynatrace_dql_test.go, has passed after "one" attempts
Execution of tests/internals/polling_cooldown_so/polling_cooldown_so_test.go, has passed after "one" attempts
Execution of tests/scalers/kubernetes_resource/kubernetes_resource_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_cloudwatch/aws_cloudwatch_test.go, has passed after "one" attempts
Execution of tests/scalers/metrics_api/metrics_api_test.go, has passed after "one" attempts
Execution of tests/scalers/activemq/activemq_test.go, has passed after "one" attempts
Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_auth/rabbitmq_queue_http_auth_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_queue_aad_wi/azure_queue_aad_wi_test.go, has passed after "one" attempts
Execution of tests/scalers/github_runner/github_runner_test.go, has passed after "one" attempts
Execution of tests/internals/trigger_authentication_validation/trigger_authentication_validation_test.go, has passed after "one" attempts
Execution of tests/scalers/rabbitmq/rabbitmq_queue_http/rabbitmq_queue_http_test.go, has passed after "one" attempts
Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_eqct/rabbitmq_queue_http_eqct_test.go, has passed after "one" attempts
Execution of tests/scalers/kubernetes_workload/kubernetes_workload_test.go, has passed after "one" attempts
Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_regex_aad_wi/rabbitmq_queue_http_regex_aad_wi_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_cloudwatch_pod_identity_eks/aws_cloudwatch_pod_identity_eks_test.go, has passed after "one" attempts
Execution of tests/scalers/solr/solr_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_kinesis_stream/aws_kinesis_stream_test.go, has passed after "one" attempts
Execution of tests/scalers/redis/redis_cluster_streams_length/redis_cluster_streams_length_test.go, has passed after "one" attempts
Execution of tests/internals/min_replica_sj/min_replica_sj_test.go, has passed after "one" attempts
Execution of tests/scalers/dynatrace/dynatrace_test.go, has passed after "one" attempts
Execution of tests/secret-providers/azure_workload_identity_user_assigned/azure_workload_identity_user_assigned_test.go, has passed after "one" attempts
Execution of tests/internals/eventemitter/azureeventgridtopic/azureeventgridtopic_test.go, has passed after "one" attempts
Execution of tests/internals/cache_metrics/cache_metrics_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_dynamodb_streams_pod_identity_eks/aws_dynamodb_streams_pod_identity_eks_test.go, has passed after "one" attempts
Execution of tests/internals/pause_scale_in_restore/pause_scale_in_restore_test.go, has passed after "one" attempts
Execution of tests/internals/restore_original/restore_original_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_event_hub_aad_wi/azure_event_hub_aad_wi_test.go, has passed after "one" attempts
Execution of tests/scalers/redis/redis_cluster_lists/redis_cluster_lists_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_kinesis_stream_pod_identity/aws_kinesis_stream_pod_identity_test.go, has passed after "one" attempts
Execution of tests/internals/update_ta/update_ta_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_data_explorer_aad_wi/azure_data_explorer_aad_wi_test.go, has passed after "one" attempts
Execution of tests/internals/scaling_strategies/eager_scaling_strategy/eager_scaling_strategy_test.go, has passed after "one" attempts
Execution of tests/internals/replicaset_scale/replicaset_scale_test.go, has passed after "one" attempts
Execution of tests/scalers/postgresql/postgresql_high_available/postgresql_ha_test.go, has passed after "one" attempts
Execution of tests/scalers/gcp/gcp_storage_workload_identity/gcp_storage_workload_identity_test.go, has passed after "one" attempts
Execution of tests/scalers/mongodb/mongodb_test.go, has passed after "one" attempts
Execution of tests/scalers/newrelic/newrelic_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_managed_prometheus_pod_identity/aws_managed_prometheus_pod_identity_test.go, has passed after "one" attempts
Execution of tests/scalers/temporal/temporal_test.go, has passed after "one" attempts
Execution of tests/scalers/graphite/graphite_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_event_hub_blob_metadata_wi/azure_event_hub_blob_metadata_wi_test.go, has passed after "one" attempts
Execution of tests/scalers/external_scaler_so/external_scaler_so_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_dynamodb/aws_dynamodb_test.go, has passed after "one" attempts
Execution of tests/secret-providers/aws_identity_external_id/aws_identity_external_id_test.go, has passed after "one" attempts
Execution of tests/scalers/gcp/gcp_cloud_tasks/gcp_cloud_tasks_test.go, has passed after "one" attempts
Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_regex_vhost/rabbitmq_queue_http_regex_vhost_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_service_bus_topic/azure_service_bus_topic_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_log_analytics/azure_log_analytics_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_event_hub_blob_metadata/azure_event_hub_blob_metadata_test.go, has passed after "one" attempts
Execution of tests/scalers/redis/redis_sentinel_lists/redis_sentinel_lists_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_cloudwatch_ignore_null_values_false/aws_cloudwatch_ignore_null_values_false_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_managed_prometheus/aws_managed_prometheus_test.go, has passed after "one" attempts
Execution of tests/internals/subresource_scale/subresource_scale_test.go, has passed after "one" attempts
Execution of tests/scalers/selenium/selenium_test.go, has passed after "two" attempts
Execution of tests/internals/idle_replicas/idle_replicas_test.go, has passed after "one" attempts
Execution of tests/scalers/rabbitmq/rabbitmq_queue_amqp_auth/rabbitmq_queue_amqp_auth_test.go, has passed after "one" attempts
Execution of tests/scalers/ibmmq/ibmmq_test.go, has passed after "one" attempts
Execution of tests/scalers/solace/direct-messaging/solace_dm_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_service_bus_queue/azure_service_bus_queue_test.go, has passed after "one" attempts
Execution of tests/internals/trigger_update_so/trigger_update_so_test.go, has passed after "one" attempts
Execution of tests/scalers/redis/redis_standalone_lists/redis_standalone_lists_test.go, has passed after "one" attempts
Execution of tests/scalers/nats_jetstream/nats_jetstream_cluster/nats_jetstream_cluster_test.go, has passed after "one" attempts
Execution of tests/scalers/opensearch/opensearch_test.go, has passed after "one" attempts
Execution of tests/scalers/splunk_observability/splunk_observability_test.go, has passed after "one" attempts
Execution of tests/scalers/gcp/gcp_stackdriver/gcp_stackdriver_test.go, has passed after "one" attempts
Execution of tests/scalers/datadog/datadog_api/datadog_api_test.go, has passed after "one" attempts
Execution of tests/scalers/pulsar/pulsar_partitioned_topic/pulsar_partitioned_topic_test.go, has passed after "one" attempts
Execution of tests/scalers/redis/redis_sentinel_streams_pending_entries/redis_sentinel_streams_pending_entries_test.go, has passed after "one" attempts
Execution of tests/internals/status_update/status_update_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_pipelines/azure_pipelines_test.go, has passed after "one" attempts
Execution of tests/internals/cloudevent_source/cloudevent_source_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_cloudwatch_cross_account/aws_cloudwatch_cross_account_test.go, has passed after "one" attempts
Execution of tests/internals/custom_hpa_name/custom_hpa_name_test.go, has passed after "one" attempts
Execution of tests/scalers/redis/redis_standalone_streams_pending_entries/redis_standalone_streams_test_pending_entries_test.go, has passed after "one" attempts
Execution of tests/scalers/elasticsearch/elasticsearch_test.go, has passed after "one" attempts
Execution of tests/internals/events/events_test.go, has passed after "one" attempts
Execution of tests/scalers/couchdb/couchdb_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_event_hub_go_sdk/azure_event_hub_go_sdk_test.go, has passed after "one" attempts
Execution of tests/internals/pause_scaledobject/pause_scaledobject_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_blob_aad_wi/azure_blob_aad_wi_test.go, has passed after "one" attempts
Execution of tests/scalers/mysql/mysql_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_dynamodb_streams_pod_identity/aws_dynamodb_streams_pod_identity_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_queue/azure_queue_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_cloudwatch_metric_stat/aws_cloudwatch_metric_stat_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_event_hub_dapr/azure_event_hub_dapr_test.go, has passed after "one" attempts
Execution of tests/internals/value_metric_type/value_metric_type_test.go, has passed after "one" attempts
Execution of tests/secret-providers/aws_identity_assume_role/aws_identity_assume_role_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_kinesis_stream_pod_identity_eks/aws_kinesis_stream_pod_identity_eks_test.go, has passed after "one" attempts
Execution of tests/scalers/forgejo_runner/forgejo_runner_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_service_bus_queue_aad_wi/azure_service_bus_queue_aad_wi_test.go, has passed after "one" attempts
Execution of tests/scalers/redis/redis_sentinel_streams_length/redis_sentinel_streams_length_test.go, has passed after "one" attempts
Execution of tests/scalers/etcd/etcd_cluster_auth/etcd_cluster_auth_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_pipelines_aad_wi/azure_pipelines_aad_wi_test.go, has passed after "two" attempts
Execution of tests/scalers/aws/aws_cloudwatch_min_metric_value/aws_cloudwatch_min_metric_value_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_cloudwatch_expression/aws_cloudwatch_expression_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_service_bus_queue_regex/azure_service_bus_queue_regex_test.go, has passed after "one" attempts
Execution of tests/scalers/mssql/mssql_test.go, has passed after "one" attempts
Execution of tests/scalers/gcp/gcp_stackdriver_workload_identity/gcp_stackdriver_workload_identity_test.go, has passed after "two" attempts
Execution of tests/scalers/external_push_scaler_old_proto/external_push_scaler_old_proto_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_monitor_aad_wi/azure_monitor_aad_wi_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_event_hub_dapr_wi/azure_event_hub_dapr_wi_test.go, has passed after "one" attempts
Execution of tests/scalers/sumologic/sumologic_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_data_explorer/azure_data_explorer_test.go, has passed after "one" attempts
Execution of tests/scalers/redis/redis_sentinel_streams_lag/redis_sentinel_streams_lag_test.go, has passed after "one" attempts
Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_regex/rabbitmq_queue_http_regex_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_application_insights/azure_application_insights_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_dynamodb_pod_identity/aws_dynamodb_pod_identity_test.go, has passed after "one" attempts
Execution of tests/scalers/etcd/etcd_cluster/etcd_cluster_test.go, has passed after "one" attempts
Execution of tests/secret-providers/azure_keyvault/azure_keyvault_test.go, has passed after "one" attempts
Execution of tests/scalers/beanstalkd/beanstalkd_test.go, has passed after "one" attempts
Execution of tests/scalers/openstack_swift/openstack_swift_test.go, has passed after "one" attempts
Execution of tests/scalers/gcp/gcp_cloud_tasks_workload_identity/gcp_cloud_tasks_workload_identity_test.go, has passed after "one" attempts
Execution of tests/scalers/loki/loki_test.go, has passed after "one" attempts
Execution of tests/secret-providers/gcp_secret_manager/gcp_secret_manager_test.go, has passed after "one" attempts
Execution of tests/scalers/gcp/gcp_pubsub_workload_identity/gcp_pubsub_workload_identity_test.go, has passed after "one" attempts
Execution of tests/scalers/splunk/splunk_test.go, has passed after "one" attempts
Execution of tests/internals/scaled_job_conditions/scaled_job_conditions_test.go, has passed after "one" attempts
Execution of tests/scalers/mssql/azure_mssql_aad_wi/azure_mssql_aad_wi_test.go, has passed after "one" attempts
Execution of tests/internals/pause_scale_in/pause_scale_in_test.go, has passed after "one" attempts
Execution of tests/scalers/arangodb/arangodb_test.go, has passed after "one" attempts
Execution of tests/internals/pause_scaledjob/pause_scaledjob_test.go, has passed after "one" attempts
Execution of tests/scalers/elastic_forecast/elastic_forecast_test.go, has passed after "one" attempts
Execution of tests/secret-providers/trigger_auth_secret/trigger_auth_secret_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_log_analytics_aad_wi/azure_log_analytics_aad_wi_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_sqs_queue/aws_sqs_queue_test.go, has passed after "one" attempts
Execution of tests/scalers/redis/redis_cluster_streams_lag/redis_cluster_streams_lag_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_service_bus_topic_aad_wi/azure_service_bus_topic_aad_wi_test.go, has passed after "one" attempts
Execution of tests/scalers/predictkube/predictkube_test.go, has passed after "one" attempts
Execution of tests/scalers/external_scaler_sj/external_scaler_sj_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_sqs_queue_pod_identity/aws_sqs_queue_pod_identity_test.go, has passed after "one" attempts
Execution of tests/secret-providers/aws_secretmanager/aws_secretmanager_test.go, has passed after "one" attempts
Execution of tests/scalers/nats_jetstream/nats_jetstream_standalone/nats_jetstream_standalone_test.go, has passed after "one" attempts
Execution of tests/internals/fallback/deployments/fallback_test.go, has passed after "one" attempts
Execution of tests/scalers/gcp/gcp_pubsub_topic/gcp_pubsub_topic_test.go, has passed after "one" attempts
Execution of tests/scalers/apache_kafka/apache_kafka_test.go, has passed after "one" attempts
Execution of tests/scalers/prometheus/prometheus_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_application_insights_aad_wi/azure_application_insights_aad_wi_test.go, has passed after "one" attempts
Execution of tests/scalers/redis/redis_cluster_streams_pending_entries/redis_cluster_streams_pending_entries_test.go, has passed after "one" attempts
Execution of tests/scalers/postgresql/postgresql_standalone/postgresql_test.go, has passed after "one" attempts
Execution of tests/secret-providers/hashicorp_vault/hashicorp_vault_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_managed_prometheus/azure_managed_prometheus_aad_workload_identity/azure_managed_prometheus_aad_workload_identity_test.go, has passed after "one" attempts
Execution of tests/secret-providers/aws_secretmanager_pod_identity/aws_secretmanager_pod_identity_test.go, has passed after "one" attempts
Execution of tests/scalers/rabbitmq/rabbitmq_queue_http_dpratio/rabbitmq_queue_http_dpratio_test.go, has passed after "one" attempts
Execution of tests/scalers/redis/redis_standalone_streams_length/redis_standalone_streams_length_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_cloudwatch_pod_identity/aws_cloudwatch_pod_identity_test.go, has passed after "one" attempts
Execution of tests/scalers/pulsar/pulsar_non_partitioned_topic/pulsar_non_partitioned_topic_test.go, has passed after "one" attempts
Execution of tests/scalers/memory/memory_test.go, has passed after "two" attempts
Execution of tests/scalers/aws/aws_dynamodb_pod_identity_eks/aws_dynamodb_pod_identity_eks_test.go, has passed after "one" attempts
Execution of tests/scalers/cassandra/cassandra_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_pipelines_adv/azure_pipelines_adv_test.go, has passed after "one" attempts
Execution of tests/scalers/aws/aws_dynamodb_streams/aws_dynamodb_streams_test.go, has passed after "one" attempts
Execution of tests/scalers/cpu/cpu_test.go, has passed after "one" attempts
Execution of tests/scalers/solace/solace_test.go, has passed after "one" attempts
Execution of tests/internals/scaling_modifiers/scaling_modifiers_test.go, has passed after "one" attempts
Execution of tests/scalers/gcp/gcp_storage/gcp_storage_test.go, has passed after "one" attempts
Execution of tests/scalers/azure/azure_monitor/azure_monitor_test.go, has passed after "one" attempts
Execution of tests/internals/pause_scaledobject_explicitly/pause_scaledobject_explicitly_test.go, has passed after "one" attempts
Execution of tests/scalers/gcp/gcp_pubsub/gcp_pubsub_test.go, has passed after "one" attempts
Execution of tests/internals/fallback/rollouts/fallback_test.go, has passed after "one" attempts
Execution of tests/scalers/kafka/kafka_test.go, has passed after "one" attempts
Execution of tests/sequential/broken_scaledobject_tolerancy/broken_scaledobject_tolerancy_test.go, has passed after "one" attempts
Execution of tests/sequential/opentelemetry_metrics/opentelemetry_metrics_test.go, has passed after "one" attempts
Execution of tests/sequential/prometheus_metrics/prometheus_metrics_test.go, has passed after "one" attempts
Execution of tests/sequential/datadog_dca/datadog_dca_test.go, has passed after "one" attempts
Execution of tests/sequential/disruption/disruption_test.go, has passed after "one" attempts
failed tests: 0

@wozniakjan wozniakjan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few discussion points below, also can you please add a changelog entry?

// +optional
TriggersActivity map[string]TriggerActivityStatus `json:"triggersActivity,omitempty"`
// +optional
HpaMinReplicaSinceTime *metav1.Time `json:"hpaMinReplicaSinceTime,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed for ScaledJobs? They don't use HPA so there is also no .spec.advanced.horizontalPodAutoscalerConfig in them

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is the interface ScalableObject , both ScaledJob and ScaledObject need to implement it, so I do need to implement SetStatusHPAMinReplicaSinceTime(*metav1.Time) method. Or I create a new interface that will change many points in the code, or I implement an empty SetStatusHPAMinReplicaSinceTime(*metav1.Time) for ScaledJob.

Comment thread cmd/operator/main.go
os.Exit(1)
}

scaledHandlerForScaledJob := scaling.NewScaleHandler(mgr.GetClient(), scaleClient, mgr.GetScheme(), globalHTTPTimeout, mgr.GetEventRecorder("scale-handler"), authClientSet, strictCooldownBehavior)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can probably be also removed from SJs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scale_handler.go is used for both ScaledJob and ScaledObject. I can create a different NewScaleHandler without this bool arg, set to false by default, so just ScaledObject might call the new one with bool arg.

}

// Apply HPA min replica since time
current.SetStatusHPAMinReplicaSinceTime(result.HPAMinReplicaSinceTime)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because result from scale executor has this set only when scaledObject.Status.HpaMinReplicaSinceTime == nil, and hard sets this to nil other times, it seems to flap with timestamp and nil each polling interval

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be fixed with your suggestions:

if currentReplicas <= *hpaMinReplicas && scaledObject.Status.HpaMinReplicaSinceTime != nil {
    result.HPAMinReplicaSinceTime = scaledObject.Status.HpaMinReplicaSinceTime
}

So, the flow must be:

First time Current Replicas <= HPA min Replicas

1- Current POD replicas <= HPA Min Replicas, and HPAMinReplicaSinceTime is nil, we set it to the current time.
2- We add it to the result to be updated on scale_handler.

Next pass, nothing changes

1- Current POD replicas keep <= HPA MinReplicas, but now HPAMinReplicaSinceTime is NOT nil.
2- We just set the current HPAMinReplicaSinceTime to the result (your suggestion in other PR comments).

Next pass, current replicas greater than HPA min replicas.

1- Current POD Replicas > HPA min replicas, we set HPAMinReplicaSinceTime to nil.
2- Set the result value to nil too.

result.HPAMinReplicaSinceTime = &metav1.Time{Time: time.Now()}
} else if currentReplicas > *hpaMinReplicas && scaledObject.Status.HpaMinReplicaSinceTime != nil {
result.HPAMinReplicaSinceTime = nil
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may need one extra case to carry the value forward

if currentReplicas <= *hpaMinReplicas && scaledObject.Status.HpaMinReplicaSinceTime != nil {
    result.HPAMinReplicaSinceTime = scaledObject.Status.HpaMinReplicaSinceTime
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense; just added.

@keda-automation
keda-automation requested a review from a team July 28, 2026 14:58
Signed-off-by: Ronaldo Lanhellas <ronaldo.lanhellas@gmail.com>
Signed-off-by: Ronaldo Lanhellas <ronaldo.lanhellas@gmail.com>
Signed-off-by: Ronaldo Lanhellas <ronaldo.lanhellas@gmail.com>
@rlanhellas

Copy link
Copy Markdown
Contributor Author

@wozniakjan please review again my comments when you have a chance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Honour HPA Scale-Down Policy When Scaling Down to Zero Replicas

2 participants