@soft-stech/keda
Version:
KEDA(Kubernetes Event-driven Autoscaling) models
107 lines (106 loc) • 3.57 kB
JavaScript
import { z } from "zod";
import { iObjectMetaSchema } from "@soft-stech/apimachinery/apis/meta/v1/ObjectMeta.schema";
/**
* CloudEventSource defines how a KEDA event will be sent to event sink
*/
export const ICloudEventSourceSchema = 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: z.literal("eventing.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: z.literal("CloudEventSource"),
metadata: iObjectMetaSchema.optional(),
/**
* CloudEventSourceSpec defines the spec of CloudEventSource
*/
spec: z.object({
/**
* AuthenticationRef points to the TriggerAuthentication or ClusterTriggerAuthentication object that
* is used to authenticate the scaler with the environment
*/
authenticationRef: z
.object({
/**
* Kind of the resource being referred to. Defaults to TriggerAuthentication.
*/
kind: z.string().optional(),
name: z.string()
})
.optional(),
clusterName: z.string().optional(),
/**
* Destination defines the various ways to emit events
*/
destination: z.object({
azureEventGridTopic: z
.object({
endpoint: z.string()
})
.optional(),
http: z
.object({
uri: z.string()
})
.optional()
}),
/**
* EventSubscription defines filters for events
*/
eventSubscription: z
.object({
excludedEventTypes: z
.array(z.union([
z.literal("keda.scaledobject.ready.v1"),
z.literal("keda.scaledobject.failed.v1")
]))
.optional(),
includedEventTypes: z
.array(z.union([
z.literal("keda.scaledobject.ready.v1"),
z.literal("keda.scaledobject.failed.v1")
]))
.optional()
})
.optional()
}),
/**
* CloudEventSourceStatus defines the observed state of CloudEventSource
*/
status: z
.object({
/**
* Conditions an array representation to store multiple Conditions
*/
conditions: z
.array(z.object({
/**
* A human readable message indicating details about the transition.
*/
message: z.string().optional(),
/**
* The reason for the condition's last transition.
*/
reason: z.string().optional(),
/**
* Status of the condition, one of True, False, Unknown.
*/
status: z.string(),
/**
* Type of condition
*/
type: z.string()
}))
.optional()
})
.optional()
});