@soft-stech/fleet
Version:
152 lines (151 loc) • 5.95 kB
JavaScript
import { z } from "zod";
import { iObjectMetaSchema } from "@soft-stech/apimachinery/apis/meta/v1/ObjectMeta.schema";
export const IImageScanSchema = 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("fleet.cattle.io/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("ImageScan"),
"metadata": iObjectMetaSchema.optional(),
/**
* API is taken from https://github.com/fluxcd/image-reflector-controller
*/
"spec": z.object({
/**
* GitRepo reference name
*/
"gitrepoName": z.string().optional(),
/**
* Image is the name of the image repository
*/
"image": z.string().optional(),
/**
* Interval is the length of time to wait between
* scans of the image repository.
*/
"interval": z.string().optional(),
/**
* Policy gives the particulars of the policy to be followed in
* selecting the most recent image
*/
"policy": z.object({
/**
* Alphabetical set of rules to use for alphabetical ordering of the tags.
*/
"alphabetical": z.object({
/**
* Order specifies the sorting order of the tags. Given the letters of the
* alphabet as tags, ascending order would select Z, and descending order
* would select A.
*/
"order": z.string().optional()
}).optional(),
/**
* SemVer gives a semantic version range to check against the tags
* available.
*/
"semver": z.object({
/**
* Range gives a semver range for the image tag; the highest
* version within the range that's a tag yields the latest image.
*/
"range": z.string().optional()
}).optional()
}).optional(),
/**
* SecretRef can be given the name of a secret containing
* credentials to use for the image registry. The secret should be
* created with `kubectl create secret docker-registry`, or the
* equivalent.
*/
"secretRef": z.object({
/**
* Name of the referent.
* This field is effectively required, but due to backwards compatibility is
* allowed to be empty. Instances of this type with an empty value here are
* almost certainly wrong.
* TODO: Add other useful fields. apiVersion, kind, uid?
* More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
* TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
*/
"name": z.string().optional()
}).optional(),
/**
* This flag tells the controller to suspend subsequent image scans.
* It does not apply to already started scans. Defaults to false.
*/
"suspend": z.boolean().optional(),
/**
* TagName is the tag ref that needs to be put in manifest to replace fields
*/
"tagName": z.string().optional()
}).optional(),
"status": z.object({
/**
* CanonicalName is the name of the image repository with all the
* implied bits made explicit; e.g., `docker.io/library/alpine`
* rather than `alpine`.
*/
"canonicalImageName": z.string().optional(),
"conditions": z.array(z.object({
/**
* Last time the condition transitioned from one status to another.
*/
"lastTransitionTime": z.string().optional(),
/**
* The last time this condition was updated.
*/
"lastUpdateTime": z.string().optional(),
/**
* Human-readable message indicating details about last 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 cluster condition.
*/
"type": z.string()
})).optional(),
/**
* LastScanTime is the last time image was scanned
* @format date-time
*/
"lastScanTime": z.string().datetime().optional().nullable(),
/**
* LatestDigest is the digest of latest tag
*/
"latestDigest": z.string().optional(),
/**
* LatestImage gives the first in the list of images scanned by
* the image repository, when filtered and ordered according to
* the policy.
*/
"latestImage": z.string().optional(),
/**
* Latest tag is the latest tag filtered by the policy
*/
"latestTag": z.string().optional(),
/**
*
* @format int64
*/
"observedGeneration": z.number().optional()
}).optional()
});