@soft-stech/autoscaler
Version:
Kubernetes Autoscaler models
88 lines (87 loc) • 2.68 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 = "autoscaling.k8s.io.v1beta1.VerticalPodAutoscaler";
const schema = {
"type": "object",
"properties": {
"spec": {
"type": "object",
"required": [],
"properties": {
"targetRef": {
"type": "object",
"properties": {},
"nullable": true
},
"updatePolicy": {
"type": "object",
"properties": {
"updateMode": {
"type": "string",
"nullable": true
}
},
"nullable": true
},
"resourcePolicy": {
"type": "object",
"properties": {
"containerPolicies": {
"type": "array",
"items": {
"type": "object",
"properties": {}
},
"nullable": true
}
},
"nullable": true
}
},
"nullable": true
},
"apiVersion": {
"type": "string",
"enum": [
"autoscaling.k8s.io/v1beta1"
]
},
"kind": {
"type": "string",
"enum": [
"VerticalPodAutoscaler"
]
},
"metadata": {
"oneOf": [
{
"$ref": "io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta#"
},
{
"type": "null"
}
]
}
},
"required": [
"apiVersion",
"kind"
]
};
export class VerticalPodAutoscaler extends Model {
constructor(data) {
super({
apiVersion: VerticalPodAutoscaler.apiVersion,
kind: VerticalPodAutoscaler.kind,
...data
});
}
}
VerticalPodAutoscaler.apiVersion = "autoscaling.k8s.io/v1beta1";
VerticalPodAutoscaler.kind = "VerticalPodAutoscaler";
VerticalPodAutoscaler.is = createTypeMetaGuard(VerticalPodAutoscaler);
setSchema(VerticalPodAutoscaler, schemaId, () => {
addSchema();
register(schemaId, schema);
});