Skip to content

Commit e3d2e81

Browse files
authored
chore: Update skipscaledobjectcreation annotation to align with KEDA annotations (#1008)
* chore: Update skip-scaledobject-creation to align with KEDA annotations Signed-off-by: Jorge Turrado <[email protected]> * use magic string during test to prevent not detected chained changes Signed-off-by: Jorge Turrado <[email protected]> --------- Signed-off-by: Jorge Turrado <[email protected]>
1 parent 7feda00 commit e3d2e81

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

docs/ref/v0.8.0/http_scaled_object.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ kind: HTTPScaledObject
99
apiVersion: http.keda.sh/v1alpha1
1010
metadata:
1111
name: xkcd
12+
annotations:
13+
httpscaledobject.keda.sh/skip-scaledobject-creation: "false"
1214
spec:
1315
hosts:
1416
- myhost.com
@@ -33,7 +35,12 @@ spec:
3335
targetValue: 100
3436
```
3537
36-
This document is a narrated reference guide for the `HTTPScaledObject`, and we'll focus on the `spec` field.
38+
This document is a narrated reference guide for the `HTTPScaledObject`.
39+
40+
## `httpscaledobject.keda.sh/skip-scaledobject-creation` annotation
41+
42+
This annotation will disable the ScaledObject generation and management but keeping the routing and metrics available. This is done removing the current ScaledObject if it has been already created, allowing to use user managed ScaledObjects pointing the add-on scaler directly (supporting all the ScaledObject configurations and multiple triggers). You can read more about this [here](./../../walkthrough.md#integrating-http-add-on-scaler-with-other-keda-scalers)
43+
3744

3845
## `hosts`
3946

docs/walkthrough.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ curl -H "Host: myhost.com" localhost:8080/path1
9191

9292
### Integrating HTTP Add-On Scaler with other KEDA scalers
9393

94-
For scenerios where you want to integrate HTTP Add-On scaler with other keda scalers, you can set the `SkipScaledObjectCreation` annotation to true on your `HTTPScaledObject`. The reconciler will then skip the KEDA core ScaledObject creation which will allow you to create your own `ScaledObject` and add HTTP scaler as one of your triggers.
94+
For scenerios where you want to integrate HTTP Add-On scaler with other keda scalers, you can set the `"httpscaledobject.keda.sh/skip-scaledobject-creation"` annotation to true on your `HTTPScaledObject`. The reconciler will then skip the KEDA core ScaledObject creation which will allow you to create your own `ScaledObject` and add HTTP scaler as one of your triggers.
9595

9696
> 💡 Ensure that your ScaledObject is created with a different name than the `HTTPScaledObject` to ensure your ScaledObject is not removed by the reconciler.
9797
@@ -101,7 +101,7 @@ If you don't know how to set the external scaler in the ScaledObject, you can de
101101

102102
```console
103103
annotations:
104-
skipScaledObjectCreation: false
104+
httpscaledobject.keda.sh/skip-scaledobject-creation: "false"
105105
```
106106

107107
2. Take copy of the current generated external-push trigger spec on the generated ScaledObject.
@@ -116,11 +116,11 @@ For example:
116116
scalerAddress: keda-http-add-on-external-scaler.keda:9090
117117
```
118118

119-
3. Apply the `skipScaledObjectCreation` annotation with `true` and apply the change. This will remove the originally created `ScaledObject` allowing you to create your own.
119+
3. Apply the `"httpscaledobject.keda.sh/skip-scaledobject-creation"` annotation with `true` and apply the change. This will remove the originally created `ScaledObject` allowing you to create your own.
120120

121121
```console
122122
annotations:
123-
skipScaledObjectCreation: true
123+
httpscaledobject.keda.sh/skip-scaledobject-creation: "true"
124124
```
125125

126126
4. Add the `external-push` trigger taken from step 2 to your own ScaledObject and apply this.

operator/controllers/http/app.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ import (
1414
"github.com/kedacore/http-add-on/operator/controllers/http/config"
1515
)
1616

17+
var (
18+
SkipScaledObjectCreationAnnotation = "httpscaledobject.keda.sh/skip-scaledobject-creation"
19+
)
20+
1721
func (r *HTTPScaledObjectReconciler) createOrUpdateApplicationResources(
1822
ctx context.Context,
1923
logger logr.Logger,
@@ -45,12 +49,12 @@ func (r *HTTPScaledObjectReconciler) createOrUpdateApplicationResources(
4549
)
4650

4751
// We want to integrate http scaler with other
48-
// scalers. when SkipScaledObjectCreation is set to true,
52+
// scalers. when "httpscaledobject.keda.sh/skip-scaledobject-creation" is set to true,
4953
// reconciler will skip the KEDA core ScaledObjects creation or delete scaledObject if it already exists.
5054
// you can then create your own SO, and add http scaler as one of your triggers.
51-
if httpso.Annotations["skipScaledObjectCreation"] == "true" {
55+
if httpso.Annotations[SkipScaledObjectCreationAnnotation] == "true" {
5256
logger.Info(
53-
"Skip scaled objects creation with flag SkipScaledObjectCreation=true",
57+
"Skip scaled objects creation with flag 'httpscaledobject.keda.sh/skip-scaledobject-creation'=true",
5458
"HTTPScaledObject", httpso.Name)
5559
err := r.deleteScaledObject(ctx, cl, logger, httpso)
5660
if err != nil {

operator/controllers/http/suite_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func newCommonTestInfraWithSkipScaledObjectCreation(namespace, appName string) *
147147
Namespace: namespace,
148148
Name: appName,
149149
Annotations: map[string]string{
150-
"skipScaledObjectCreation": "true",
150+
"httpscaledobject.keda.sh/skip-scaledobject-creation": "true",
151151
},
152152
},
153153
Spec: httpv1alpha1.HTTPScaledObjectSpec{

tests/checks/scaling_phase_deployment_with_skip_so_creation/scaling_phase_deployment_with_skip_so_creation_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ metadata:
124124
name: {{.HTTPScaledObjectName}}
125125
namespace: {{.TestNamespace}}
126126
annotations:
127-
skipScaledObjectCreation: "true"
127+
httpscaledobject.keda.sh/skip-scaledobject-creation: "true"
128128
spec:
129129
hosts:
130130
- {{.Host}}

0 commit comments

Comments
 (0)