@soft-stech/keda
Version:
KEDA(Kubernetes Event-driven Autoscaling) models
435 lines (434 loc) • 17.9 kB
JavaScript
import { addSchema } from "@soft-stech/apimachinery/_schemas/IoK8sApimachineryPkgApisMetaV1ObjectMeta";
import { Model, setSchema, createTypeMetaGuard } from "@soft-stech/base";
import { register } from "@soft-stech/validate";
const schemaId = "keda.sh.v1alpha1.ScaledObject";
const schema = {
"type": "object",
"properties": {
"apiVersion": {
"type": "string",
"enum": [
"keda.sh/v1alpha1"
]
},
"kind": {
"type": "string",
"enum": [
"ScaledObject"
]
},
"metadata": {
"oneOf": [
{
"$ref": "io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta#"
},
{
"type": "null"
}
]
},
"spec": {
"properties": {
"advanced": {
"properties": {
"horizontalPodAutoscalerConfig": {
"properties": {
"behavior": {
"properties": {
"scaleDown": {
"properties": {
"policies": {
"items": {
"properties": {
"periodSeconds": {
"format": "int32",
"type": "integer"
},
"type": {
"type": "string"
},
"value": {
"format": "int32",
"type": "integer"
}
},
"required": [
"periodSeconds",
"type",
"value"
],
"type": "object"
},
"type": "array",
"nullable": true
},
"selectPolicy": {
"type": "string",
"nullable": true
},
"stabilizationWindowSeconds": {
"format": "int32",
"type": "integer",
"minimum": 0,
"maximum": 3600,
"nullable": true
}
},
"type": "object",
"nullable": true
},
"scaleUp": {
"properties": {
"policies": {
"items": {
"properties": {
"periodSeconds": {
"format": "int32",
"type": "integer"
},
"type": {
"type": "string"
},
"value": {
"format": "int32",
"type": "integer"
}
},
"required": [
"periodSeconds",
"type",
"value"
],
"type": "object"
},
"type": "array",
"nullable": true
},
"selectPolicy": {
"type": "string",
"nullable": true
},
"stabilizationWindowSeconds": {
"format": "int32",
"type": "integer",
"minimum": 0,
"maximum": 3600,
"nullable": true
}
},
"type": "object",
"nullable": true
}
},
"type": "object",
"nullable": true
},
"name": {
"type": "string",
"nullable": true
}
},
"type": "object",
"nullable": true
},
"restoreToOriginalReplicaCount": {
"type": "boolean",
"nullable": true
},
"scalingModifiers": {
"properties": {
"activationTarget": {
"type": "string",
"nullable": true
},
"formula": {
"type": "string",
"nullable": true
},
"metricType": {
"type": "string",
"nullable": true
},
"target": {
"type": "string",
"nullable": true
}
},
"type": "object",
"nullable": true
}
},
"type": "object",
"nullable": true
},
"cooldownPeriod": {
"format": "int32",
"type": "integer",
"nullable": true
},
"fallback": {
"properties": {
"failureThreshold": {
"format": "int32",
"type": "integer"
},
"replicas": {
"format": "int32",
"type": "integer"
}
},
"required": [
"failureThreshold",
"replicas"
],
"type": "object",
"nullable": true
},
"idleReplicaCount": {
"format": "int32",
"type": "integer",
"nullable": true
},
"initialCooldownPeriod": {
"format": "int32",
"type": "integer",
"nullable": true
},
"maxReplicaCount": {
"format": "int32",
"type": "integer",
"nullable": true
},
"minReplicaCount": {
"format": "int32",
"type": "integer",
"nullable": true
},
"pollingInterval": {
"format": "int32",
"type": "integer",
"nullable": true
},
"scaleTargetRef": {
"properties": {
"apiVersion": {
"type": "string",
"nullable": true
},
"envSourceContainerName": {
"type": "string",
"nullable": true
},
"kind": {
"type": "string",
"nullable": true
},
"name": {
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
},
"triggers": {
"items": {
"properties": {
"authenticationRef": {
"properties": {
"kind": {
"type": "string",
"nullable": true
},
"name": {
"type": "string"
}
},
"required": [
"name"
],
"type": "object",
"nullable": true
},
"metadata": {
"additionalProperties": {
"type": "string"
},
"type": "object",
"properties": {}
},
"metricType": {
"type": "string",
"nullable": true
},
"name": {
"type": "string",
"nullable": true
},
"type": {
"type": "string"
},
"useCachedMetrics": {
"type": "boolean",
"nullable": true
}
},
"required": [
"metadata",
"type"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"scaleTargetRef",
"triggers"
],
"type": "object"
},
"status": {
"properties": {
"compositeScalerName": {
"type": "string",
"nullable": true
},
"conditions": {
"items": {
"properties": {
"message": {
"type": "string",
"nullable": true
},
"reason": {
"type": "string",
"nullable": true
},
"status": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"status",
"type"
],
"type": "object"
},
"type": "array",
"nullable": true
},
"externalMetricNames": {
"items": {
"type": "string"
},
"type": "array",
"nullable": true
},
"health": {
"additionalProperties": {
"properties": {
"numberOfFailures": {
"format": "int32",
"type": "integer",
"nullable": true
},
"status": {
"type": "string",
"nullable": true
}
},
"type": "object"
},
"type": "object",
"properties": {},
"nullable": true
},
"hpaName": {
"type": "string",
"nullable": true
},
"lastActiveTime": {
"format": "date-time",
"type": "string",
"nullable": true
},
"originalReplicaCount": {
"format": "int32",
"type": "integer",
"nullable": true
},
"pausedReplicaCount": {
"format": "int32",
"type": "integer",
"nullable": true
},
"resourceMetricNames": {
"items": {
"type": "string"
},
"type": "array",
"nullable": true
},
"scaleTargetGVKR": {
"properties": {
"group": {
"type": "string"
},
"kind": {
"type": "string"
},
"resource": {
"type": "string"
},
"version": {
"type": "string"
}
},
"required": [
"group",
"kind",
"resource",
"version"
],
"type": "object",
"nullable": true
},
"scaleTargetKind": {
"type": "string",
"nullable": true
}
},
"type": "object",
"nullable": true
}
},
"required": [
"spec",
"apiVersion",
"kind"
]
};
/**
* ScaledObject is a specification for a ScaledObject resource
*/
export class ScaledObject extends Model {
constructor(data) {
super({
apiVersion: ScaledObject.apiVersion,
kind: ScaledObject.kind,
...data
});
}
}
ScaledObject.apiVersion = "keda.sh/v1alpha1";
ScaledObject.kind = "ScaledObject";
ScaledObject.is = createTypeMetaGuard(ScaledObject);
setSchema(ScaledObject, schemaId, () => {
addSchema();
register(schemaId, schema);
});