UNPKG

@soft-stech/fleet

Version:
610 lines (609 loc) 25.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IGitRepoSchema = void 0; // Generated by ts-to-zod const zod_1 = require("zod"); const ObjectMeta_schema_1 = require("@soft-stech/apimachinery/apis/meta/v1/ObjectMeta.schema"); /** * GitRepo describes a git repository that is watched by Fleet. * The resource contains the necessary information to deploy the repo, or parts * of it, to target clusters. */ exports.IGitRepoSchema = zod_1.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: zod_1.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: zod_1.z.literal("GitRepo"), metadata: ObjectMeta_schema_1.iObjectMetaSchema.optional(), spec: zod_1.z .object({ /** * Branch The git branch to follow. */ branch: zod_1.z.string().optional(), /** * CABundle is a PEM encoded CA bundle which will be used to validate the repo's certificate. * @format byte */ caBundle: zod_1.z.string().optional(), /** * ClientSecretName is the name of the client secret to be used to connect to the repo * It is expected the secret be of type "kubernetes.io/basic-auth" or "kubernetes.io/ssh-auth". */ clientSecretName: zod_1.z.string().optional(), /** * CorrectDrift specifies how drift correction should work. */ correctDrift: zod_1.z .object({ /** * Enabled correct drift if true. */ enabled: zod_1.z.boolean().optional(), /** * Force helm rollback with --force option will be used if true. This will try to recreate all resources in the release. */ force: zod_1.z.boolean().optional(), /** * KeepFailHistory keeps track of failed rollbacks in the helm history. */ keepFailHistory: zod_1.z.boolean().optional() }) .optional(), /** * DeleteNamespace specifies if the namespace created must be deleted after deleting the GitRepo. */ deleteNamespace: zod_1.z.boolean().optional(), /** * Disables git polling. When enabled only webhooks will be used. */ disablePolling: zod_1.z.boolean().optional(), /** * Increment this number to force a redeployment of contents from Git. */ forceSyncGeneration: zod_1.z.number().optional(), /** * HelmRepoURLRegex Helm credentials will be used if the helm repo matches this regex * Credentials will always be used if this is empty or not provided. */ helmRepoURLRegex: zod_1.z.string().optional(), /** * HelmSecretName contains the auth secret for a private Helm repository. */ helmSecretName: zod_1.z.string().optional(), /** * HelmSecretNameForPaths contains the auth secret for private Helm repository for each path. */ helmSecretNameForPaths: zod_1.z.string().optional(), /** * Commit specifies how to commit to the git repo when a new image is scanned and written back to git repo. */ imageScanCommit: zod_1.z .object({ /** * AuthorEmail gives the email to provide when making a commit */ authorEmail: zod_1.z.string().optional(), /** * AuthorName gives the name to provide when making a commit */ authorName: zod_1.z.string().optional(), /** * MessageTemplate provides a template for the commit message, * into which will be interpolated the details of the change made. */ messageTemplate: zod_1.z.string().optional() }) .optional(), /** * ImageScanInterval is the interval of syncing scanned images and writing back to git repo. */ imageScanInterval: zod_1.z.string().optional(), /** * InsecureSkipTLSverify will use insecure HTTPS to clone the repo. */ insecureSkipTLSVerify: zod_1.z.boolean().optional(), /** * KeepResources specifies if the resources created must be kept after deleting the GitRepo. */ keepResources: zod_1.z.boolean().optional(), /** * OCIRegistry specifies the OCI registry related parameters */ ociRegistry: zod_1.z .object({ /** * AuthSecretName contains the auth secret where the OCI regristry credentials are stored. */ authSecretName: zod_1.z.string().optional(), /** * BasicHTTP uses HTTP connections to the OCI registry when enabled. */ basicHTTP: zod_1.z.boolean().optional(), /** * InsecureSkipTLS allows connections to OCI registry without certs when enabled. */ insecureSkipTLS: zod_1.z.boolean().optional(), /** * Reference of the OCI Registry */ reference: zod_1.z.string().optional() }) .optional(), /** * Paths is the directories relative to the git repo root that contain resources to be applied. * Path globbing is supported, for example ["charts/\*"] will match all folders as a subdirectory of charts/ * If empty, "/" is the default. */ paths: zod_1.z.array(zod_1.z.string()).optional(), /** * Paused, when true, causes changes in Git not to be propagated down to the clusters but instead to mark * resources as OutOfSync. */ paused: zod_1.z.boolean().optional(), /** * PollingInterval is how often to check git for new updates. */ pollingInterval: zod_1.z.string().optional(), /** * Repo is a URL to a git repo to clone and index. */ repo: zod_1.z.string().optional(), /** * Revision A specific commit or tag to operate on. */ revision: zod_1.z.string().optional(), /** * ServiceAccount used in the downstream cluster for deployment. */ serviceAccount: zod_1.z.string().optional(), /** * Ensure that all resources are created in this namespace * Any cluster scoped resource will be rejected if this is set * Additionally this namespace will be created on demand. */ targetNamespace: zod_1.z.string().optional(), /** * Targets is a list of targets this repo will deploy to. */ targets: zod_1.z .array(zod_1.z.object({ /** * ClusterGroup is the name of a cluster group in the same namespace as the clusters. */ clusterGroup: zod_1.z.string().optional(), /** * ClusterGroupSelector is a label selector to select cluster groups. */ clusterGroupSelector: zod_1.z .object({ /** * matchExpressions is a list of label selector requirements. The requirements are ANDed. */ matchExpressions: zod_1.z .array(zod_1.z.object({ /** * key is the label key that the selector applies to. */ key: zod_1.z.string(), /** * operator represents a key's relationship to a set of values. * Valid operators are In, NotIn, Exists and DoesNotExist. */ operator: zod_1.z.string(), /** * values is an array of string values. If the operator is In or NotIn, * the values array must be non-empty. If the operator is Exists or DoesNotExist, * the values array must be empty. This array is replaced during a strategic * merge patch. */ values: zod_1.z.array(zod_1.z.string()).optional() })) .optional(), /** * matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels * map is equivalent to an element of matchExpressions, whose key field is "key", the * operator is "In", and the values array contains only "value". The requirements are ANDed. */ matchLabels: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional() }) .optional(), /** * ClusterName is the name of a cluster. */ clusterName: zod_1.z.string().optional(), /** * ClusterSelector is a label selector to select clusters. */ clusterSelector: zod_1.z .object({ /** * matchExpressions is a list of label selector requirements. The requirements are ANDed. */ matchExpressions: zod_1.z .array(zod_1.z.object({ /** * key is the label key that the selector applies to. */ key: zod_1.z.string(), /** * operator represents a key's relationship to a set of values. * Valid operators are In, NotIn, Exists and DoesNotExist. */ operator: zod_1.z.string(), /** * values is an array of string values. If the operator is In or NotIn, * the values array must be non-empty. If the operator is Exists or DoesNotExist, * the values array must be empty. This array is replaced during a strategic * merge patch. */ values: zod_1.z.array(zod_1.z.string()).optional() })) .optional(), /** * matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels * map is equivalent to an element of matchExpressions, whose key field is "key", the * operator is "In", and the values array contains only "value". The requirements are ANDed. */ matchLabels: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional() }) .optional(), /** * Name is the name of this target. */ name: zod_1.z.string().optional() })) .optional() }) .optional(), status: zod_1.z .object({ /** * Commit is the Git commit hash from the last git job run. */ commit: zod_1.z.string().optional(), /** * Conditions is a list of Wrangler conditions that describe the state * of the GitRepo. */ conditions: zod_1.z .array(zod_1.z.object({ /** * Last time the condition transitioned from one status to another. */ lastTransitionTime: zod_1.z.string().optional(), /** * The last time this condition was updated. */ lastUpdateTime: zod_1.z.string().optional(), /** * Human-readable message indicating details about last transition */ message: zod_1.z.string().optional(), /** * The reason for the condition's last transition. */ reason: zod_1.z.string().optional(), /** * Status of the condition, one of True, False, Unknown. */ status: zod_1.z.string(), /** * Type of cluster condition. */ type: zod_1.z.string() })) .optional(), /** * DesiredReadyClusters is the number of clusters that should be ready for bundles of this GitRepo. */ desiredReadyClusters: zod_1.z.number().optional(), /** * Display contains a human readable summary of the status. */ display: zod_1.z .object({ /** * Error is true if a message is present. */ error: zod_1.z.boolean().optional(), /** * Message contains the relevant message from the deployment conditions. */ message: zod_1.z.string().optional(), /** * ReadyBundleDeployments is a string in the form "%d/%d", that describes the * number of ready bundledeployments over the total number of bundledeployments. */ readyBundleDeployments: zod_1.z.string().optional(), /** * State is the state of the GitRepo, e.g. "GitUpdating" or the maximal * BundleState according to StateRank. */ state: zod_1.z.string().optional() }) .optional(), /** * GitJobStatus is the status of the last Git job run, e.g. "Current" if there was no error. */ gitJobStatus: zod_1.z.string().optional(), /** * LastPollingTime is the last time the polling check was triggered * @format date-time */ lastPollingTriggered: zod_1.z.iso.datetime().optional().nullable(), /** * LastSyncedImageScanTime is the time of the last image scan. * @format date-time */ lastSyncedImageScanTime: zod_1.z.iso.datetime().optional().nullable(), /** * ObservedGeneration is the current generation of the resource in the cluster. It is copied from k8s * metadata.Generation. The value is incremented for all changes, except for changes to .metadata or .status. */ observedGeneration: zod_1.z.number().optional(), /** * ReadyClusters is the lowest number of clusters that are ready over * all the bundles of this GitRepo. */ readyClusters: zod_1.z.number().optional(), /** * ResourceCounts contains the number of resources in each state over all bundles. */ resourceCounts: zod_1.z .object({ /** * DesiredReady is the number of resources that should be ready. */ desiredReady: zod_1.z.number().optional(), /** * Missing is the number of missing resources. */ missing: zod_1.z.number().optional(), /** * Modified is the number of resources that have been modified. */ modified: zod_1.z.number().optional(), /** * NotReady is the number of not ready resources. Resources are not * ready if they do not match any other state. */ notReady: zod_1.z.number().optional(), /** * Orphaned is the number of orphaned resources. */ orphaned: zod_1.z.number().optional(), /** * Ready is the number of ready resources. */ ready: zod_1.z.number().optional(), /** * Unknown is the number of resources in an unknown state. */ unknown: zod_1.z.number().optional(), /** * WaitApplied is the number of resources that are waiting to be applied. */ waitApplied: zod_1.z.number().optional() }) .optional(), /** * ResourceErrors is a sorted list of errors from the resources. */ resourceErrors: zod_1.z.array(zod_1.z.string()).optional(), /** * Resources contains metadata about the resources of each bundle. */ resources: zod_1.z .array(zod_1.z.object({ /** * APIVersion is the API version of the resource. */ apiVersion: zod_1.z.string().optional(), /** * Error is true if any Error in the PerClusterState is true. */ error: zod_1.z.boolean().optional(), /** * ID is the name of the resource, e.g. "namespace1/my-config" or "backingimagemanagers.storage.io". */ id: zod_1.z.string().optional(), /** * IncompleteState is true if a bundle summary has 10 or more non-ready * resources or a non-ready resource has more 10 or more non-ready or * modified states. */ incompleteState: zod_1.z.boolean().optional(), /** * Kind is the k8s kind of the resource. */ kind: zod_1.z.string().optional(), /** * Message is the first message from the PerClusterStates. */ message: zod_1.z.string().optional(), /** * Name of the resource. */ name: zod_1.z.string().optional(), /** * Namespace of the resource. */ namespace: zod_1.z.string().optional(), /** * PerClusterState is a list of states for each cluster. Derived from the summaries non-ready resources. */ perClusterState: zod_1.z .array(zod_1.z.object({ /** * ClusterID is the id of the cluster. */ clusterId: zod_1.z.string().optional(), /** * Error is true if the resource is in an error state, copied from the bundle's summary for non-ready resources. */ error: zod_1.z.boolean().optional(), /** * Message combines the messages from the bundle's summary. Messages are joined with the delimiter ';'. */ message: zod_1.z.string().optional(), /** * Patch for modified resources. */ patch: zod_1.z.object({}).optional(), /** * State is the state of the resource. */ state: zod_1.z.string().optional(), /** * Transitioning is true if the resource is in a transitioning state, * copied from the bundle's summary for non-ready resources. */ transitioning: zod_1.z.boolean().optional() })) .optional(), /** * State is the state of the resource, e.g. "Unknown", "WaitApplied", "ErrApplied" or "Ready". */ state: zod_1.z.string().optional(), /** * Transitioning is true if any Transitioning in the PerClusterState is true. */ transitioning: zod_1.z.boolean().optional(), /** * Type is the type of the resource, e.g. "apiextensions.k8s.io.customresourcedefinition" or "configmap". */ type: zod_1.z.string().optional() })) .optional(), /** * Summary contains the number of bundle deployments in each state and a list of non-ready resources. */ summary: zod_1.z .object({ /** * DesiredReady is the number of bundle deployments that should be * ready. */ desiredReady: zod_1.z.number().optional(), /** * ErrApplied is the number of bundle deployments that have been synced * from the Fleet controller and the downstream cluster, but with some * errors when deploying the bundle. */ errApplied: zod_1.z.number().optional(), /** * Modified is the number of bundle deployments that have been deployed * and for which all resources are ready, but where some changes from the * Git repository have not yet been synced. */ modified: zod_1.z.number().optional(), /** * NonReadyClusters is a list of states, which is filled for a bundle * that is not ready. */ nonReadyResources: zod_1.z .array(zod_1.z.object({ /** * State is the state of the resource, like e.g. "NotReady" or "ErrApplied". */ bundleState: zod_1.z.string().optional(), /** * Message contains information why the bundle is not ready. */ message: zod_1.z.string().optional(), /** * ModifiedStatus lists the state for each modified resource. */ modifiedStatus: zod_1.z .array(zod_1.z.object({ apiVersion: zod_1.z.string().optional(), delete: zod_1.z.boolean().optional(), kind: zod_1.z.string().optional(), missing: zod_1.z.boolean().optional(), name: zod_1.z.string().optional(), namespace: zod_1.z.string().optional(), patch: zod_1.z.string().optional() })) .optional(), /** * Name is the name of the resource. */ name: zod_1.z.string().optional(), /** * NonReadyStatus lists the state for each non-ready resource. */ nonReadyStatus: zod_1.z .array(zod_1.z.object({ apiVersion: zod_1.z.string().optional(), kind: zod_1.z.string().optional(), name: zod_1.z.string().optional(), namespace: zod_1.z.string().optional(), summary: zod_1.z .object({ error: zod_1.z.boolean().optional(), message: zod_1.z.array(zod_1.z.string()).optional(), state: zod_1.z.string().optional(), transitioning: zod_1.z.boolean().optional() }) .optional(), /** * UID is a type that holds unique ID values, including UUIDs. Because we * don't ONLY use UUIDs, this is an alias to string. Being a type captures * intent and helps make sure that UIDs and names do not get conflated. */ uid: zod_1.z.string().optional() })) .optional() })) .optional(), /** * NotReady is the number of bundle deployments that have been deployed * where some resources are not ready. */ notReady: zod_1.z.number().optional(), /** * OutOfSync is the number of bundle deployments that have been synced * from Fleet controller, but not yet by the downstream agent. */ outOfSync: zod_1.z.number().optional(), /** * Pending is the number of bundle deployments that are being processed * by Fleet controller. */ pending: zod_1.z.number().optional(), /** * Ready is the number of bundle deployments that have been deployed * where all resources are ready. */ ready: zod_1.z.number().optional(), /** * WaitApplied is the number of bundle deployments that have been * synced from Fleet controller and downstream cluster, but are waiting * to be deployed. */ waitApplied: zod_1.z.number().optional() }) .optional(), /** * Update generation is the force update generation if spec.forceSyncGeneration is set */ updateGeneration: zod_1.z.number().optional(), /** * WebhookCommit is the latest Git commit hash received from a webhook */ webhookCommit: zod_1.z.string().optional() }) .optional() });