Skip to content

Commit

Permalink
feat: allow skip scaled object creation with config
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Sep 22, 2023
1 parent b39aceb commit 78923b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions operator/controllers/http/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions operator/controllers/http/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 78923b0

Please sign in to comment.