UNPKG

@soft-stech/autoscaler

Version:
316 lines (315 loc) 13.9 kB
import { addSchema } from "@soft-stech/apimachinery/_schemas/IoK8sApimachineryPkgApisMetaV1ObjectMeta"; import { Model, setSchema, createTypeMetaGuard } from "@soft-stech/base"; import { register } from "@soft-stech/validate"; const schemaId = "autoscaling.k8s.io.v1.VerticalPodAutoscaler"; const schema = { "type": "object", "properties": { "apiVersion": { "type": "string", "enum": [ "autoscaling.k8s.io/v1" ] }, "kind": { "type": "string", "enum": [ "VerticalPodAutoscaler" ] }, "metadata": { "oneOf": [ { "$ref": "io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta#" }, { "type": "null" } ] }, "spec": { "properties": { "recommenders": { "items": { "properties": { "name": { "type": "string" } }, "required": [ "name" ], "type": "object" }, "type": "array", "nullable": true }, "resourcePolicy": { "properties": { "containerPolicies": { "items": { "properties": { "containerName": { "type": "string", "nullable": true }, "controlledResources": { "items": { "type": "string" }, "type": "array", "nullable": true }, "controlledValues": { "enum": [ "RequestsAndLimits", "RequestsOnly" ], "type": "string", "nullable": true }, "maxAllowed": { "additionalProperties": { "anyOf": [ { "type": "integer" }, { "type": "string" } ], "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" }, "type": "object", "properties": {}, "nullable": true }, "minAllowed": { "additionalProperties": { "anyOf": [ { "type": "integer" }, { "type": "string" } ], "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" }, "type": "object", "properties": {}, "nullable": true }, "mode": { "enum": [ "Auto", "Off" ], "type": "string", "nullable": true } }, "type": "object" }, "type": "array", "nullable": true } }, "type": "object", "nullable": true }, "targetRef": { "properties": { "apiVersion": { "type": "string", "nullable": true }, "kind": { "type": "string" }, "name": { "type": "string" } }, "required": [ "kind", "name" ], "type": "object" }, "updatePolicy": { "properties": { "minReplicas": { "format": "int32", "type": "integer", "nullable": true }, "updateMode": { "enum": [ "Off", "Initial", "Recreate", "Auto" ], "type": "string", "nullable": true } }, "type": "object", "nullable": true } }, "required": [ "targetRef" ], "type": "object" }, "status": { "properties": { "conditions": { "items": { "properties": { "lastTransitionTime": { "format": "date-time", "type": "string", "nullable": true }, "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 }, "recommendation": { "properties": { "containerRecommendations": { "items": { "properties": { "containerName": { "type": "string", "nullable": true }, "lowerBound": { "additionalProperties": { "anyOf": [ { "type": "integer" }, { "type": "string" } ], "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" }, "type": "object", "properties": {}, "nullable": true }, "target": { "additionalProperties": { "anyOf": [ { "type": "integer" }, { "type": "string" } ], "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" }, "type": "object", "properties": {} }, "uncappedTarget": { "additionalProperties": { "anyOf": [ { "type": "integer" }, { "type": "string" } ], "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" }, "type": "object", "properties": {}, "nullable": true }, "upperBound": { "additionalProperties": { "anyOf": [ { "type": "integer" }, { "type": "string" } ], "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" }, "type": "object", "properties": {}, "nullable": true } }, "required": [ "target" ], "type": "object" }, "type": "array", "nullable": true } }, "type": "object", "nullable": true } }, "type": "object", "nullable": true } }, "required": [ "spec", "apiVersion", "kind" ] }; /** * VerticalPodAutoscaler is the configuration for a vertical pod autoscaler, which automatically manages pod resources based on historical and real time resource utilization. */ export class VerticalPodAutoscaler extends Model { constructor(data) { super({ apiVersion: VerticalPodAutoscaler.apiVersion, kind: VerticalPodAutoscaler.kind, ...data }); } } VerticalPodAutoscaler.apiVersion = "autoscaling.k8s.io/v1"; VerticalPodAutoscaler.kind = "VerticalPodAutoscaler"; VerticalPodAutoscaler.is = createTypeMetaGuard(VerticalPodAutoscaler); setSchema(VerticalPodAutoscaler, schemaId, () => { addSchema(); register(schemaId, schema); });