From 7ce5f402dd56352cfa5039d0f9f9dbe8928e0e63 Mon Sep 17 00:00:00 2001 From: balasoiu-adobe-com Date: Mon, 3 Nov 2025 14:03:19 +0100 Subject: [PATCH 1/3] SKYOPS-121706: Add schema for Keda ScaledObject --- README.md | 1 + build.sh | 1 + test/keda/scaledobject.bats | 22 ++++++++++++++++++++++ test/keda/scaledobject/invalid.yaml | 14 ++++++++++++++ test/keda/scaledobject/strict.yaml | 17 +++++++++++++++++ test/keda/scaledobject/valid.yaml | 16 ++++++++++++++++ 6 files changed, 71 insertions(+) create mode 100644 test/keda/scaledobject.bats create mode 100644 test/keda/scaledobject/invalid.yaml create mode 100644 test/keda/scaledobject/strict.yaml create mode 100644 test/keda/scaledobject/valid.yaml diff --git a/README.md b/README.md index 23780b9..8c3afb3 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ CRD's currently supported: - contour (adobe fork) - helm-operator - istio +- keda - prometheus-operator - ack dynamodb- and elasticache controllers - elasticsearch opertator diff --git a/build.sh b/build.sh index c52f07d..aa73955 100755 --- a/build.sh +++ b/build.sh @@ -87,3 +87,4 @@ crd_to_json_schema eck-operator https://raw.githubusercontent.com/elastic/cloud- crd_to_json_schema vault-secrets-operator https://raw.githubusercontent.com/ricoberger/vault-secrets-operator/master/charts/vault-secrets-operator/crds/ricoberger.de_vaultsecrets.yaml crd_to_json_schema vpa https://raw.githubusercontent.com/kubernetes/autoscaler/master/vertical-pod-autoscaler/deploy/vpa-v1-crd-gen.yaml crd_to_json_schema external-secrets-operator https://raw.githubusercontent.com/external-secrets/external-secrets/main/deploy/crds/bundle.yaml +crd_to_json_schema keda https://raw.githubusercontent.com/kedacore/keda/main/config/crd/bases/keda.sh_scaledobjects.yaml diff --git a/test/keda/scaledobject.bats b/test/keda/scaledobject.bats new file mode 100644 index 0000000..9945e8e --- /dev/null +++ b/test/keda/scaledobject.bats @@ -0,0 +1,22 @@ +#!/usr/bin/env bats + +load ../test_helper + +@test "valid ScaledObject" { + run kubeval "${FIXTURES}/valid.yaml" + [[ $status -eq 0 ]] + [[ $output = "PASS - ${FIXTURES}/valid.yaml contains a valid ScaledObject (test)" ]] +} + +@test "invalid ScaledObject" { + run kubeval "${FIXTURES}/invalid.yaml" + [[ $status -eq 1 ]] + [[ $output = "WARN - ${FIXTURES}/invalid.yaml contains an invalid ScaledObject (test) - scaleTargetRef: scaleTargetRef is required" ]] +} + +@test "invalid ScaledObject in strict mode" { + run kubeval --strict "${FIXTURES}/strict.yaml" + [[ $status -eq 1 ]] + [[ $output = "WARN - ${FIXTURES}/strict.yaml contains an invalid ScaledObject (test) - unknownProperty: Additional property unknownProperty is not allowed" ]] +} + diff --git a/test/keda/scaledobject/invalid.yaml b/test/keda/scaledobject/invalid.yaml new file mode 100644 index 0000000..edd3a01 --- /dev/null +++ b/test/keda/scaledobject/invalid.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + name: test + namespace: default +spec: + minReplicaCount: 1 + maxReplicaCount: 10 + triggers: + - type: cpu + metadata: + type: Utilization + value: "80" diff --git a/test/keda/scaledobject/strict.yaml b/test/keda/scaledobject/strict.yaml new file mode 100644 index 0000000..74f1532 --- /dev/null +++ b/test/keda/scaledobject/strict.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + name: test + namespace: default +spec: + scaleTargetRef: + name: test-deployment + minReplicaCount: 1 + maxReplicaCount: 10 + triggers: + - type: cpu + metadata: + type: Utilization + value: "80" + unknownProperty: invalid diff --git a/test/keda/scaledobject/valid.yaml b/test/keda/scaledobject/valid.yaml new file mode 100644 index 0000000..04a7ba1 --- /dev/null +++ b/test/keda/scaledobject/valid.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + name: test + namespace: default +spec: + scaleTargetRef: + name: test-deployment + minReplicaCount: 1 + maxReplicaCount: 10 + triggers: + - type: cpu + metadata: + type: Utilization + value: "80" From 253ff938bf7a3d4fc5ea61b81f3c19165182db96 Mon Sep 17 00:00:00 2001 From: balasoiu-adobe-com Date: Mon, 3 Nov 2025 15:14:33 +0100 Subject: [PATCH 2/3] Add schemas for ScaledObject --- .../scaledobject-keda-v1alpha1.json | 439 ++++++++++++++++++ .../scaledobject-keda-v1alpha1.json | 430 +++++++++++++++++ 2 files changed, 869 insertions(+) create mode 100644 master-standalone-strict/scaledobject-keda-v1alpha1.json create mode 100644 master-standalone/scaledobject-keda-v1alpha1.json diff --git a/master-standalone-strict/scaledobject-keda-v1alpha1.json b/master-standalone-strict/scaledobject-keda-v1alpha1.json new file mode 100644 index 0000000..63199b1 --- /dev/null +++ b/master-standalone-strict/scaledobject-keda-v1alpha1.json @@ -0,0 +1,439 @@ +{ + "description": "ScaledObject is a specification for a ScaledObject resource", + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "type": "object" + }, + "spec": { + "description": "ScaledObjectSpec is the spec for a ScaledObject resource", + "properties": { + "advanced": { + "description": "AdvancedConfig specifies advance scaling options", + "properties": { + "horizontalPodAutoscalerConfig": { + "description": "HorizontalPodAutoscalerConfig specifies horizontal scale config", + "properties": { + "behavior": { + "description": "HorizontalPodAutoscalerBehavior configures the scaling behavior of the target\nin both Up and Down directions (scaleUp and scaleDown fields respectively).", + "properties": { + "scaleDown": { + "description": "scaleDown is scaling policy for scaling Down.\nIf not set, the default value is to allow to scale down to minReplicas pods, with a\n300 second stabilization window (i.e., the highest recommendation for\nthe last 300sec is used).", + "properties": { + "policies": { + "description": "policies is a list of potential scaling polices which can be used during scaling.\nIf not set, use the default values:\n- For scale up: allow doubling the number of pods, or an absolute change of 4 pods in a 15s window.\n- For scale down: allow all pods to be removed in a 15s window.", + "items": { + "description": "HPAScalingPolicy is a single policy which must hold true for a specified past interval.", + "properties": { + "periodSeconds": { + "description": "periodSeconds specifies the window of time for which the policy should hold true.\nPeriodSeconds must be greater than zero and less than or equal to 1800 (30 min).", + "format": "int32", + "type": "integer" + }, + "type": { + "description": "type is used to specify the scaling policy.", + "type": "string" + }, + "value": { + "description": "value contains the amount of change which is permitted by the policy.\nIt must be greater than zero", + "format": "int32", + "type": "integer" + } + }, + "required": [ + "periodSeconds", + "type", + "value" + ], + "type": "object" + }, + "type": "array", + "x-kubernetes-list-type": "atomic" + }, + "selectPolicy": { + "description": "selectPolicy is used to specify which policy should be used.\nIf not set, the default value Max is used.", + "type": "string" + }, + "stabilizationWindowSeconds": { + "description": "stabilizationWindowSeconds is the number of seconds for which past recommendations should be\nconsidered while scaling up or scaling down.\nStabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour).\nIf not set, use the default values:\n- For scale up: 0 (i.e. no stabilization is done).\n- For scale down: 300 (i.e. the stabilization window is 300 seconds long).", + "format": "int32", + "type": "integer" + }, + "tolerance": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "description": "tolerance is the tolerance on the ratio between the current and desired\nmetric value under which no updates are made to the desired number of\nreplicas (e.g. 0.01 for 1%). Must be greater than or equal to zero. If not\nset, the default cluster-wide tolerance is applied (by default 10%).\n\nFor example, if autoscaling is configured with a memory consumption target of 100Mi,\nand scale-down and scale-up tolerances of 5% and 1% respectively, scaling will be\ntriggered when the actual consumption falls below 95Mi or exceeds 101Mi.\n\nThis is an alpha field and requires enabling the HPAConfigurableTolerance\nfeature gate.", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + } + }, + "type": "object", + "additionalProperties": false + }, + "scaleUp": { + "description": "scaleUp is scaling policy for scaling Up.\nIf not set, the default value is the higher of:\n * increase no more than 4 pods per 60 seconds\n * double the number of pods per 60 seconds\nNo stabilization is used.", + "properties": { + "policies": { + "description": "policies is a list of potential scaling polices which can be used during scaling.\nIf not set, use the default values:\n- For scale up: allow doubling the number of pods, or an absolute change of 4 pods in a 15s window.\n- For scale down: allow all pods to be removed in a 15s window.", + "items": { + "description": "HPAScalingPolicy is a single policy which must hold true for a specified past interval.", + "properties": { + "periodSeconds": { + "description": "periodSeconds specifies the window of time for which the policy should hold true.\nPeriodSeconds must be greater than zero and less than or equal to 1800 (30 min).", + "format": "int32", + "type": "integer" + }, + "type": { + "description": "type is used to specify the scaling policy.", + "type": "string" + }, + "value": { + "description": "value contains the amount of change which is permitted by the policy.\nIt must be greater than zero", + "format": "int32", + "type": "integer" + } + }, + "required": [ + "periodSeconds", + "type", + "value" + ], + "type": "object" + }, + "type": "array", + "x-kubernetes-list-type": "atomic" + }, + "selectPolicy": { + "description": "selectPolicy is used to specify which policy should be used.\nIf not set, the default value Max is used.", + "type": "string" + }, + "stabilizationWindowSeconds": { + "description": "stabilizationWindowSeconds is the number of seconds for which past recommendations should be\nconsidered while scaling up or scaling down.\nStabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour).\nIf not set, use the default values:\n- For scale up: 0 (i.e. no stabilization is done).\n- For scale down: 300 (i.e. the stabilization window is 300 seconds long).", + "format": "int32", + "type": "integer" + }, + "tolerance": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "description": "tolerance is the tolerance on the ratio between the current and desired\nmetric value under which no updates are made to the desired number of\nreplicas (e.g. 0.01 for 1%). Must be greater than or equal to zero. If not\nset, the default cluster-wide tolerance is applied (by default 10%).\n\nFor example, if autoscaling is configured with a memory consumption target of 100Mi,\nand scale-down and scale-up tolerances of 5% and 1% respectively, scaling will be\ntriggered when the actual consumption falls below 95Mi or exceeds 101Mi.\n\nThis is an alpha field and requires enabling the HPAConfigurableTolerance\nfeature gate.", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + } + }, + "type": "object", + "additionalProperties": false + } + }, + "type": "object", + "additionalProperties": false + }, + "name": { + "type": "string" + } + }, + "type": "object", + "additionalProperties": false + }, + "restoreToOriginalReplicaCount": { + "type": "boolean" + }, + "scalingModifiers": { + "description": "ScalingModifiers describes advanced scaling logic options like formula", + "properties": { + "activationTarget": { + "type": "string" + }, + "formula": { + "type": "string" + }, + "metricType": { + "description": "MetricTargetType specifies the type of metric being targeted, and should be either\n\"Value\", \"AverageValue\", or \"Utilization\"", + "enum": [ + "AverageValue", + "Value" + ], + "type": "string" + }, + "target": { + "type": "string" + } + }, + "type": "object", + "additionalProperties": false + } + }, + "type": "object", + "additionalProperties": false + }, + "cooldownPeriod": { + "format": "int32", + "type": "integer" + }, + "fallback": { + "description": "Fallback is the spec for fallback options", + "properties": { + "behavior": { + "default": "static", + "enum": [ + "static", + "currentReplicas", + "currentReplicasIfHigher", + "currentReplicasIfLower" + ], + "type": "string" + }, + "failureThreshold": { + "format": "int32", + "type": "integer" + }, + "replicas": { + "format": "int32", + "type": "integer" + } + }, + "required": [ + "failureThreshold", + "replicas" + ], + "type": "object", + "additionalProperties": false + }, + "idleReplicaCount": { + "format": "int32", + "type": "integer" + }, + "initialCooldownPeriod": { + "format": "int32", + "type": "integer" + }, + "maxReplicaCount": { + "format": "int32", + "type": "integer" + }, + "minReplicaCount": { + "format": "int32", + "type": "integer" + }, + "pollingInterval": { + "format": "int32", + "type": "integer" + }, + "scaleTargetRef": { + "description": "ScaleTarget holds the reference to the scale target Object", + "properties": { + "apiVersion": { + "type": "string" + }, + "envSourceContainerName": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "name" + ], + "type": "object", + "additionalProperties": false + }, + "triggers": { + "items": { + "description": "ScaleTriggers reference the scaler that will be used", + "properties": { + "authenticationRef": { + "description": "AuthenticationRef points to the TriggerAuthentication or ClusterTriggerAuthentication object that\nis used to authenticate the scaler with the environment", + "properties": { + "kind": { + "description": "Kind of the resource being referred to. Defaults to TriggerAuthentication.", + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "name" + ], + "type": "object" + }, + "metadata": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "metricType": { + "description": "MetricTargetType specifies the type of metric being targeted, and should be either\n\"Value\", \"AverageValue\", or \"Utilization\"", + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "useCachedMetrics": { + "type": "boolean" + } + }, + "required": [ + "metadata", + "type" + ], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "scaleTargetRef", + "triggers" + ], + "type": "object", + "additionalProperties": false + }, + "status": { + "description": "ScaledObjectStatus is the status for a ScaledObject resource", + "properties": { + "authenticationsTypes": { + "type": "string" + }, + "compositeScalerName": { + "type": "string" + }, + "conditions": { + "description": "Conditions an array representation to store multiple Conditions", + "items": { + "description": "Condition to store the condition state", + "properties": { + "message": { + "description": "A human readable message indicating details about the transition.", + "type": "string" + }, + "reason": { + "description": "The reason for the condition's last transition.", + "type": "string" + }, + "status": { + "description": "Status of the condition, one of True, False, Unknown.", + "type": "string" + }, + "type": { + "description": "Type of condition", + "type": "string" + } + }, + "required": [ + "status", + "type" + ], + "type": "object" + }, + "type": "array" + }, + "externalMetricNames": { + "items": { + "type": "string" + }, + "type": "array" + }, + "health": { + "additionalProperties": { + "description": "HealthStatus is the status for a ScaledObject's health", + "properties": { + "numberOfFailures": { + "format": "int32", + "type": "integer" + }, + "status": { + "description": "HealthStatusType is an indication of whether the health status is happy or failing", + "type": "string" + } + }, + "type": "object" + }, + "type": "object" + }, + "hpaName": { + "type": "string" + }, + "lastActiveTime": { + "format": "date-time", + "type": "string" + }, + "originalReplicaCount": { + "format": "int32", + "type": "integer" + }, + "pausedReplicaCount": { + "format": "int32", + "type": "integer" + }, + "resourceMetricNames": { + "items": { + "type": "string" + }, + "type": "array" + }, + "scaleTargetGVKR": { + "description": "GroupVersionKindResource provides unified structure for schema.GroupVersionKind and Resource", + "properties": { + "group": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "resource": { + "type": "string" + }, + "version": { + "type": "string" + } + }, + "required": [ + "group", + "kind", + "resource", + "version" + ], + "type": "object" + }, + "scaleTargetKind": { + "type": "string" + }, + "triggersTypes": { + "type": "string" + } + }, + "type": "object" + } + }, + "required": [ + "spec" + ], + "type": "object" +} diff --git a/master-standalone/scaledobject-keda-v1alpha1.json b/master-standalone/scaledobject-keda-v1alpha1.json new file mode 100644 index 0000000..322c42a --- /dev/null +++ b/master-standalone/scaledobject-keda-v1alpha1.json @@ -0,0 +1,430 @@ +{ + "description": "ScaledObject is a specification for a ScaledObject resource", + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "type": "object" + }, + "spec": { + "description": "ScaledObjectSpec is the spec for a ScaledObject resource", + "properties": { + "advanced": { + "description": "AdvancedConfig specifies advance scaling options", + "properties": { + "horizontalPodAutoscalerConfig": { + "description": "HorizontalPodAutoscalerConfig specifies horizontal scale config", + "properties": { + "behavior": { + "description": "HorizontalPodAutoscalerBehavior configures the scaling behavior of the target\nin both Up and Down directions (scaleUp and scaleDown fields respectively).", + "properties": { + "scaleDown": { + "description": "scaleDown is scaling policy for scaling Down.\nIf not set, the default value is to allow to scale down to minReplicas pods, with a\n300 second stabilization window (i.e., the highest recommendation for\nthe last 300sec is used).", + "properties": { + "policies": { + "description": "policies is a list of potential scaling polices which can be used during scaling.\nIf not set, use the default values:\n- For scale up: allow doubling the number of pods, or an absolute change of 4 pods in a 15s window.\n- For scale down: allow all pods to be removed in a 15s window.", + "items": { + "description": "HPAScalingPolicy is a single policy which must hold true for a specified past interval.", + "properties": { + "periodSeconds": { + "description": "periodSeconds specifies the window of time for which the policy should hold true.\nPeriodSeconds must be greater than zero and less than or equal to 1800 (30 min).", + "format": "int32", + "type": "integer" + }, + "type": { + "description": "type is used to specify the scaling policy.", + "type": "string" + }, + "value": { + "description": "value contains the amount of change which is permitted by the policy.\nIt must be greater than zero", + "format": "int32", + "type": "integer" + } + }, + "required": [ + "periodSeconds", + "type", + "value" + ], + "type": "object" + }, + "type": "array", + "x-kubernetes-list-type": "atomic" + }, + "selectPolicy": { + "description": "selectPolicy is used to specify which policy should be used.\nIf not set, the default value Max is used.", + "type": "string" + }, + "stabilizationWindowSeconds": { + "description": "stabilizationWindowSeconds is the number of seconds for which past recommendations should be\nconsidered while scaling up or scaling down.\nStabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour).\nIf not set, use the default values:\n- For scale up: 0 (i.e. no stabilization is done).\n- For scale down: 300 (i.e. the stabilization window is 300 seconds long).", + "format": "int32", + "type": "integer" + }, + "tolerance": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "description": "tolerance is the tolerance on the ratio between the current and desired\nmetric value under which no updates are made to the desired number of\nreplicas (e.g. 0.01 for 1%). Must be greater than or equal to zero. If not\nset, the default cluster-wide tolerance is applied (by default 10%).\n\nFor example, if autoscaling is configured with a memory consumption target of 100Mi,\nand scale-down and scale-up tolerances of 5% and 1% respectively, scaling will be\ntriggered when the actual consumption falls below 95Mi or exceeds 101Mi.\n\nThis is an alpha field and requires enabling the HPAConfigurableTolerance\nfeature gate.", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + } + }, + "type": "object" + }, + "scaleUp": { + "description": "scaleUp is scaling policy for scaling Up.\nIf not set, the default value is the higher of:\n * increase no more than 4 pods per 60 seconds\n * double the number of pods per 60 seconds\nNo stabilization is used.", + "properties": { + "policies": { + "description": "policies is a list of potential scaling polices which can be used during scaling.\nIf not set, use the default values:\n- For scale up: allow doubling the number of pods, or an absolute change of 4 pods in a 15s window.\n- For scale down: allow all pods to be removed in a 15s window.", + "items": { + "description": "HPAScalingPolicy is a single policy which must hold true for a specified past interval.", + "properties": { + "periodSeconds": { + "description": "periodSeconds specifies the window of time for which the policy should hold true.\nPeriodSeconds must be greater than zero and less than or equal to 1800 (30 min).", + "format": "int32", + "type": "integer" + }, + "type": { + "description": "type is used to specify the scaling policy.", + "type": "string" + }, + "value": { + "description": "value contains the amount of change which is permitted by the policy.\nIt must be greater than zero", + "format": "int32", + "type": "integer" + } + }, + "required": [ + "periodSeconds", + "type", + "value" + ], + "type": "object" + }, + "type": "array", + "x-kubernetes-list-type": "atomic" + }, + "selectPolicy": { + "description": "selectPolicy is used to specify which policy should be used.\nIf not set, the default value Max is used.", + "type": "string" + }, + "stabilizationWindowSeconds": { + "description": "stabilizationWindowSeconds is the number of seconds for which past recommendations should be\nconsidered while scaling up or scaling down.\nStabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour).\nIf not set, use the default values:\n- For scale up: 0 (i.e. no stabilization is done).\n- For scale down: 300 (i.e. the stabilization window is 300 seconds long).", + "format": "int32", + "type": "integer" + }, + "tolerance": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "description": "tolerance is the tolerance on the ratio between the current and desired\nmetric value under which no updates are made to the desired number of\nreplicas (e.g. 0.01 for 1%). Must be greater than or equal to zero. If not\nset, the default cluster-wide tolerance is applied (by default 10%).\n\nFor example, if autoscaling is configured with a memory consumption target of 100Mi,\nand scale-down and scale-up tolerances of 5% and 1% respectively, scaling will be\ntriggered when the actual consumption falls below 95Mi or exceeds 101Mi.\n\nThis is an alpha field and requires enabling the HPAConfigurableTolerance\nfeature gate.", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + } + }, + "type": "object" + } + }, + "type": "object" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + "restoreToOriginalReplicaCount": { + "type": "boolean" + }, + "scalingModifiers": { + "description": "ScalingModifiers describes advanced scaling logic options like formula", + "properties": { + "activationTarget": { + "type": "string" + }, + "formula": { + "type": "string" + }, + "metricType": { + "description": "MetricTargetType specifies the type of metric being targeted, and should be either\n\"Value\", \"AverageValue\", or \"Utilization\"", + "enum": [ + "AverageValue", + "Value" + ], + "type": "string" + }, + "target": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "cooldownPeriod": { + "format": "int32", + "type": "integer" + }, + "fallback": { + "description": "Fallback is the spec for fallback options", + "properties": { + "behavior": { + "default": "static", + "enum": [ + "static", + "currentReplicas", + "currentReplicasIfHigher", + "currentReplicasIfLower" + ], + "type": "string" + }, + "failureThreshold": { + "format": "int32", + "type": "integer" + }, + "replicas": { + "format": "int32", + "type": "integer" + } + }, + "required": [ + "failureThreshold", + "replicas" + ], + "type": "object" + }, + "idleReplicaCount": { + "format": "int32", + "type": "integer" + }, + "initialCooldownPeriod": { + "format": "int32", + "type": "integer" + }, + "maxReplicaCount": { + "format": "int32", + "type": "integer" + }, + "minReplicaCount": { + "format": "int32", + "type": "integer" + }, + "pollingInterval": { + "format": "int32", + "type": "integer" + }, + "scaleTargetRef": { + "description": "ScaleTarget holds the reference to the scale target Object", + "properties": { + "apiVersion": { + "type": "string" + }, + "envSourceContainerName": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "name" + ], + "type": "object" + }, + "triggers": { + "items": { + "description": "ScaleTriggers reference the scaler that will be used", + "properties": { + "authenticationRef": { + "description": "AuthenticationRef points to the TriggerAuthentication or ClusterTriggerAuthentication object that\nis used to authenticate the scaler with the environment", + "properties": { + "kind": { + "description": "Kind of the resource being referred to. Defaults to TriggerAuthentication.", + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "name" + ], + "type": "object" + }, + "metadata": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "metricType": { + "description": "MetricTargetType specifies the type of metric being targeted, and should be either\n\"Value\", \"AverageValue\", or \"Utilization\"", + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "useCachedMetrics": { + "type": "boolean" + } + }, + "required": [ + "metadata", + "type" + ], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "scaleTargetRef", + "triggers" + ], + "type": "object" + }, + "status": { + "description": "ScaledObjectStatus is the status for a ScaledObject resource", + "properties": { + "authenticationsTypes": { + "type": "string" + }, + "compositeScalerName": { + "type": "string" + }, + "conditions": { + "description": "Conditions an array representation to store multiple Conditions", + "items": { + "description": "Condition to store the condition state", + "properties": { + "message": { + "description": "A human readable message indicating details about the transition.", + "type": "string" + }, + "reason": { + "description": "The reason for the condition's last transition.", + "type": "string" + }, + "status": { + "description": "Status of the condition, one of True, False, Unknown.", + "type": "string" + }, + "type": { + "description": "Type of condition", + "type": "string" + } + }, + "required": [ + "status", + "type" + ], + "type": "object" + }, + "type": "array" + }, + "externalMetricNames": { + "items": { + "type": "string" + }, + "type": "array" + }, + "health": { + "additionalProperties": { + "description": "HealthStatus is the status for a ScaledObject's health", + "properties": { + "numberOfFailures": { + "format": "int32", + "type": "integer" + }, + "status": { + "description": "HealthStatusType is an indication of whether the health status is happy or failing", + "type": "string" + } + }, + "type": "object" + }, + "type": "object" + }, + "hpaName": { + "type": "string" + }, + "lastActiveTime": { + "format": "date-time", + "type": "string" + }, + "originalReplicaCount": { + "format": "int32", + "type": "integer" + }, + "pausedReplicaCount": { + "format": "int32", + "type": "integer" + }, + "resourceMetricNames": { + "items": { + "type": "string" + }, + "type": "array" + }, + "scaleTargetGVKR": { + "description": "GroupVersionKindResource provides unified structure for schema.GroupVersionKind and Resource", + "properties": { + "group": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "resource": { + "type": "string" + }, + "version": { + "type": "string" + } + }, + "required": [ + "group", + "kind", + "resource", + "version" + ], + "type": "object" + }, + "scaleTargetKind": { + "type": "string" + }, + "triggersTypes": { + "type": "string" + } + }, + "type": "object" + } + }, + "required": [ + "spec" + ], + "type": "object" +} From ecd8f70589ef87f14a072f8492c21e21e1ac9817 Mon Sep 17 00:00:00 2001 From: balasoiu-adobe-com Date: Mon, 3 Nov 2025 15:18:35 +0100 Subject: [PATCH 3/3] fix tests --- test/keda/scaledobject/invalid.yaml | 1 - test/keda/scaledobject/strict.yaml | 1 - test/keda/scaledobject/valid.yaml | 1 - 3 files changed, 3 deletions(-) diff --git a/test/keda/scaledobject/invalid.yaml b/test/keda/scaledobject/invalid.yaml index edd3a01..a989d73 100644 --- a/test/keda/scaledobject/invalid.yaml +++ b/test/keda/scaledobject/invalid.yaml @@ -3,7 +3,6 @@ apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: test - namespace: default spec: minReplicaCount: 1 maxReplicaCount: 10 diff --git a/test/keda/scaledobject/strict.yaml b/test/keda/scaledobject/strict.yaml index 74f1532..924425e 100644 --- a/test/keda/scaledobject/strict.yaml +++ b/test/keda/scaledobject/strict.yaml @@ -3,7 +3,6 @@ apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: test - namespace: default spec: scaleTargetRef: name: test-deployment diff --git a/test/keda/scaledobject/valid.yaml b/test/keda/scaledobject/valid.yaml index 04a7ba1..3b8e969 100644 --- a/test/keda/scaledobject/valid.yaml +++ b/test/keda/scaledobject/valid.yaml @@ -3,7 +3,6 @@ apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: test - namespace: default spec: scaleTargetRef: name: test-deployment