diff --git a/operator/controllers/http/app.go b/operator/controllers/http/app.go index 89ea1345c..aa40564b1 100644 --- a/operator/controllers/http/app.go +++ b/operator/controllers/http/app.go @@ -41,6 +41,17 @@ func (r *HTTPScaledObjectReconciler) createOrUpdateApplicationResources( "Identified HTTPScaledObject creation signal"), ) + // in some user scenario, we want to integrate http scaler with other + // scalers. when SkipScaledObjectCreation is set to true, + // reconciler will skip the KEDA core ScaledObjects creation. + // you can create your own so, and add http scaler as one of your triggers. + if baseConfig.SkipScaledObjectCreation { + logger.Info( + "Skip scaled objects creation with flag SkipScaledObjectCreation=true", + "HTTPScaledObject", httpso.Name) + return nil + } + // create the KEDA core ScaledObjects (not the HTTP one) for // the app deployment and the interceptor deployment. // this needs to be submitted so that KEDA will scale both the app and diff --git a/operator/controllers/http/config/config.go b/operator/controllers/http/config/config.go index 2eac129b6..8b127a6fb 100644 --- a/operator/controllers/http/config/config.go +++ b/operator/controllers/http/config/config.go @@ -29,6 +29,9 @@ type Base struct { // The namespace the operator should watch. Leave blank to // tell the operator to watch all namespaces. WatchNamespace string `envconfig:"WATCH_NAMESPACE" default:""` + // Set to true when you want to create scaled object by your self + // operator will skip the so creation. default false + SkipScaledObjectCreation bool `envconfig:"SKIP_SCALED_OBJECT_CREATION" default:"false"` } func NewBaseFromEnv() (*Base, error) {