mirror of
https://github.com/renovatebot/renovate.git
synced 2024-12-22 13:38:32 +00:00
a18790c1e4
Co-authored-by: Michael Kriese <michael.kriese@visualon.de> Co-authored-by: Rhys Arkins <rhys@arkins.net>
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import { z } from 'zod';
|
|
import { LooseArray } from '../../../util/schema-utils';
|
|
|
|
export const KubernetesResource = z.object({
|
|
apiVersion: z.string(),
|
|
});
|
|
|
|
export const ApplicationKustomize = z.object({
|
|
images: LooseArray(z.string()).optional(),
|
|
});
|
|
export const ApplicationSource = z.object({
|
|
chart: z.string().optional(),
|
|
repoURL: z.string(),
|
|
targetRevision: z.string(),
|
|
kustomize: ApplicationKustomize.optional(),
|
|
});
|
|
export type ApplicationSource = z.infer<typeof ApplicationSource>;
|
|
|
|
export const ApplicationSpec = z.object({
|
|
source: ApplicationSource.optional(),
|
|
sources: LooseArray(ApplicationSource).optional(),
|
|
});
|
|
export type ApplicationSpec = z.infer<typeof ApplicationSpec>;
|
|
|
|
export const Application = KubernetesResource.extend({
|
|
kind: z.literal('Application'),
|
|
spec: ApplicationSpec,
|
|
});
|
|
|
|
export const ApplicationSet = KubernetesResource.extend({
|
|
kind: z.literal('ApplicationSet'),
|
|
spec: z.object({
|
|
template: z.object({
|
|
spec: ApplicationSpec,
|
|
}),
|
|
}),
|
|
});
|
|
|
|
export const ApplicationDefinition = Application.or(ApplicationSet);
|
|
export type ApplicationDefinition = z.infer<typeof ApplicationDefinition>;
|