UNPKG

@soft-stech/keda

Version:
327 lines (326 loc) 13.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IScaledObjectSchema = void 0; // Generated by ts-to-zod const zod_1 = require("zod"); const ObjectMeta_schema_1 = require("@soft-stech/apimachinery/apis/meta/v1/ObjectMeta.schema"); /** * ScaledObject is a specification for a ScaledObject resource */ exports.IScaledObjectSchema = zod_1.z.object({ /** * APIVersion defines the versioned schema of this representation of an object. * Servers should convert recognized schemas to the latest internal value, and * may reject unrecognized values. * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources */ apiVersion: zod_1.z.literal("keda.sh/v1alpha1"), /** * Kind is a string value representing the REST resource this object represents. * Servers may infer this from the endpoint the client submits requests to. * Cannot be updated. * In CamelCase. * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds */ kind: zod_1.z.literal("ScaledObject"), metadata: ObjectMeta_schema_1.iObjectMetaSchema.optional(), /** * ScaledObjectSpec is the spec for a ScaledObject resource */ spec: zod_1.z.object({ /** * AdvancedConfig specifies advance scaling options */ advanced: zod_1.z .object({ /** * HorizontalPodAutoscalerConfig specifies horizontal scale config */ horizontalPodAutoscalerConfig: zod_1.z .object({ /** * HorizontalPodAutoscalerBehavior configures the scaling behavior of the target * in both Up and Down directions (scaleUp and scaleDown fields respectively). */ behavior: zod_1.z .object({ /** * scaleDown is scaling policy for scaling Down. * If not set, the default value is to allow to scale down to minReplicas pods, with a * 300 second stabilization window (i.e., the highest recommendation for * the last 300sec is used). */ scaleDown: zod_1.z .object({ /** * policies is a list of potential scaling polices which can be used during scaling. * At least one policy must be specified, otherwise the HPAScalingRules will be discarded as invalid */ policies: zod_1.z .array(zod_1.z.object({ /** * periodSeconds specifies the window of time for which the policy should hold true. * PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min). * @format int32 */ periodSeconds: zod_1.z.int32(), /** * type is used to specify the scaling policy. */ type: zod_1.z.string(), /** * value contains the amount of change which is permitted by the policy. * It must be greater than zero * @format int32 */ value: zod_1.z.int32() })) .optional(), /** * selectPolicy is used to specify which policy should be used. * If not set, the default value Max is used. */ selectPolicy: zod_1.z.string().optional(), /** * stabilizationWindowSeconds is the number of seconds for which past recommendations should be * considered while scaling up or scaling down. * StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour). * If not set, use the default values: * - For scale up: 0 (i.e. no stabilization is done). * - For scale down: 300 (i.e. the stabilization window is 300 seconds long). * @maximum 3600 * @format int32 */ stabilizationWindowSeconds: zod_1.z.int32().max(3600).optional() }) .optional(), /** * scaleUp is scaling policy for scaling Up. * If not set, the default value is the higher of: * \* increase no more than 4 pods per 60 seconds * \* double the number of pods per 60 seconds * No stabilization is used. */ scaleUp: zod_1.z .object({ /** * policies is a list of potential scaling polices which can be used during scaling. * At least one policy must be specified, otherwise the HPAScalingRules will be discarded as invalid */ policies: zod_1.z .array(zod_1.z.object({ /** * periodSeconds specifies the window of time for which the policy should hold true. * PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min). * @format int32 */ periodSeconds: zod_1.z.int32(), /** * type is used to specify the scaling policy. */ type: zod_1.z.string(), /** * value contains the amount of change which is permitted by the policy. * It must be greater than zero * @format int32 */ value: zod_1.z.int32() })) .optional(), /** * selectPolicy is used to specify which policy should be used. * If not set, the default value Max is used. */ selectPolicy: zod_1.z.string().optional(), /** * stabilizationWindowSeconds is the number of seconds for which past recommendations should be * considered while scaling up or scaling down. * StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour). * If not set, use the default values: * - For scale up: 0 (i.e. no stabilization is done). * - For scale down: 300 (i.e. the stabilization window is 300 seconds long). * @maximum 3600 * @format int32 */ stabilizationWindowSeconds: zod_1.z.int32().max(3600).optional() }) .optional() }) .optional(), name: zod_1.z.string().optional() }) .optional(), restoreToOriginalReplicaCount: zod_1.z.boolean().optional(), /** * ScalingModifiers describes advanced scaling logic options like formula */ scalingModifiers: zod_1.z .object({ activationTarget: zod_1.z.string().optional(), formula: zod_1.z.string().optional(), /** * MetricTargetType specifies the type of metric being targeted, and should be either * "Value", "AverageValue", or "Utilization" */ metricType: zod_1.z.string().optional(), target: zod_1.z.string().optional() }) .optional() }) .optional(), /** * * @format int32 */ cooldownPeriod: zod_1.z.int32().optional(), /** * Fallback is the spec for fallback options */ fallback: zod_1.z .object({ /** * * @format int32 */ failureThreshold: zod_1.z.int32(), /** * * @format int32 */ replicas: zod_1.z.int32() }) .optional(), /** * * @format int32 */ idleReplicaCount: zod_1.z.int32().optional(), /** * * @format int32 */ initialCooldownPeriod: zod_1.z.int32().optional(), /** * * @format int32 */ maxReplicaCount: zod_1.z.int32().optional(), /** * * @format int32 */ minReplicaCount: zod_1.z.int32().optional(), /** * * @format int32 */ pollingInterval: zod_1.z.int32().optional(), /** * ScaleTarget holds the reference to the scale target Object */ scaleTargetRef: zod_1.z.object({ apiVersion: zod_1.z.string().optional(), envSourceContainerName: zod_1.z.string().optional(), kind: zod_1.z.string().optional(), name: zod_1.z.string() }), triggers: zod_1.z.array(zod_1.z.object({ /** * AuthenticationRef points to the TriggerAuthentication or ClusterTriggerAuthentication object that * is used to authenticate the scaler with the environment */ authenticationRef: zod_1.z .object({ /** * Kind of the resource being referred to. Defaults to TriggerAuthentication. */ kind: zod_1.z.string().optional(), name: zod_1.z.string() }) .optional(), metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()), /** * MetricTargetType specifies the type of metric being targeted, and should be either * "Value", "AverageValue", or "Utilization" */ metricType: zod_1.z.string().optional(), name: zod_1.z.string().optional(), type: zod_1.z.string(), useCachedMetrics: zod_1.z.boolean().optional() })) }), /** * ScaledObjectStatus is the status for a ScaledObject resource */ status: zod_1.z .object({ compositeScalerName: zod_1.z.string().optional(), /** * Conditions an array representation to store multiple Conditions */ conditions: zod_1.z .array(zod_1.z.object({ /** * A human readable message indicating details about the transition. */ message: zod_1.z.string().optional(), /** * The reason for the condition's last transition. */ reason: zod_1.z.string().optional(), /** * Status of the condition, one of True, False, Unknown. */ status: zod_1.z.string(), /** * Type of condition */ type: zod_1.z.string() })) .optional(), externalMetricNames: zod_1.z.array(zod_1.z.string()).optional(), health: zod_1.z .record(zod_1.z.string(), zod_1.z.object({ /** * * @format int32 */ numberOfFailures: zod_1.z.int32().optional(), /** * HealthStatusType is an indication of whether the health status is happy or failing */ status: zod_1.z.string().optional() })) .optional(), hpaName: zod_1.z.string().optional(), /** * * @format date-time */ lastActiveTime: zod_1.z.iso.datetime().optional().nullable(), /** * * @format int32 */ originalReplicaCount: zod_1.z.int32().optional(), /** * * @format int32 */ pausedReplicaCount: zod_1.z.int32().optional(), resourceMetricNames: zod_1.z.array(zod_1.z.string()).optional(), /** * GroupVersionKindResource provides unified structure for schema.GroupVersionKind and Resource */ scaleTargetGVKR: zod_1.z .object({ group: zod_1.z.string(), kind: zod_1.z.string(), resource: zod_1.z.string(), version: zod_1.z.string() }) .optional(), scaleTargetKind: zod_1.z.string().optional() }) .optional() });