Skip to content

Commit 78923b0

Browse files
unknownunknown
unknown
authored and
unknown
committed
feat: allow skip scaled object creation with config
1 parent b39aceb commit 78923b0

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

operator/controllers/http/app.go

+11
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ func (r *HTTPScaledObjectReconciler) createOrUpdateApplicationResources(
4141
"Identified HTTPScaledObject creation signal"),
4242
)
4343

44+
// in some user scenario, we want to integrate http scaler with other
45+
// scalers. when SkipScaledObjectCreation is set to true,
46+
// reconciler will skip the KEDA core ScaledObjects creation.
47+
// you can create your own so, and add http scaler as one of your triggers.
48+
if baseConfig.SkipScaledObjectCreation {
49+
logger.Info(
50+
"Skip scaled objects creation with flag SkipScaledObjectCreation=true",
51+
"HTTPScaledObject", httpso.Name)
52+
return nil
53+
}
54+
4455
// create the KEDA core ScaledObjects (not the HTTP one) for
4556
// the app deployment and the interceptor deployment.
4657
// this needs to be submitted so that KEDA will scale both the app and

operator/controllers/http/config/config.go

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ type Base struct {
2929
// The namespace the operator should watch. Leave blank to
3030
// tell the operator to watch all namespaces.
3131
WatchNamespace string `envconfig:"WATCH_NAMESPACE" default:""`
32+
// Set to true when you want to create scaled object by your self
33+
// operator will skip the so creation. default false
34+
SkipScaledObjectCreation bool `envconfig:"SKIP_SCALED_OBJECT_CREATION" default:"false"`
3235
}
3336

3437
func NewBaseFromEnv() (*Base, error) {

0 commit comments

Comments
 (0)