UNPKG

@soft-stech/fleet

Version:
766 lines (765 loc) 32.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IBundleDeploymentSchema = 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"); /** * BundleDeployment is used internally by Fleet and should not be used directly. * When a Bundle is deployed to a cluster an instance of a Bundle is called a * BundleDeployment. A BundleDeployment represents the state of that Bundle on * a specific cluster with its cluster-specific customizations. The Fleet agent * is only aware of BundleDeployment resources that are created for the cluster * the agent is managing. */ exports.IBundleDeploymentSchema = 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("BundleDeployment"), metadata: ObjectMeta_schema_1.iObjectMetaSchema.optional(), spec: zod_1.z .object({ /** * 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(), /** * DependsOn refers to the bundles which must be ready before this bundle can be deployed. */ dependsOn: zod_1.z .array(zod_1.z.object({ /** * Name of the bundle. */ name: zod_1.z.string().optional(), /** * Selector matching bundle's labels. */ selector: 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() })) .optional(), /** * DeploymentID is the ID of the currently applied deployment. */ deploymentID: zod_1.z.string().optional(), /** * OCIContents is true when this deployment's contents is stored in an oci registry */ ociContents: zod_1.z.boolean().optional(), /** * Options are the deployment options, that are currently applied. */ options: zod_1.z .object({ /** * 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(), /** * DefaultNamespace is the namespace to use for resources that do not * specify a namespace. This field is not used to enforce or lock down * the deployment to a specific namespace. */ defaultNamespace: zod_1.z.string().optional(), /** * DeleteCRDResources deletes CRDs. Warning! this will also delete all your Custom Resources. */ deleteCRDResources: zod_1.z.boolean().optional(), /** * DeleteNamespace can be used to delete the deployed namespace when removing the bundle */ deleteNamespace: zod_1.z.boolean().optional(), /** * Diff can be used to ignore the modified state of objects which are amended at runtime. */ diff: zod_1.z .object({ /** * ComparePatches match a resource and remove fields from the check for modifications. */ comparePatches: zod_1.z .array(zod_1.z.object({ /** * APIVersion is the apiVersion of the resource to match. */ apiVersion: zod_1.z.string().optional(), /** * JSONPointers ignore diffs at a certain JSON path. */ jsonPointers: zod_1.z.array(zod_1.z.string()).optional(), /** * Kind is the kind of the resource to match. */ kind: zod_1.z.string().optional(), /** * Name is the name of the resource to match. */ name: zod_1.z.string().optional(), /** * Namespace is the namespace of the resource to match. */ namespace: zod_1.z.string().optional(), /** * Operations remove a JSON path from the resource. */ operations: zod_1.z .array(zod_1.z.object({ /** * Op is usually "remove" */ op: zod_1.z.string().optional(), /** * Path is the JSON path to remove. */ path: zod_1.z.string().optional(), /** * Value is usually empty. */ value: zod_1.z.string().optional() })) .optional() })) .optional() }) .optional(), /** * ForceSyncGeneration is used to force a redeployment */ forceSyncGeneration: zod_1.z.number().optional(), /** * Helm options for the deployment, like the chart name, repo and values. */ helm: zod_1.z .object({ /** * Atomic sets the --atomic flag when Helm is performing an upgrade */ atomic: zod_1.z.boolean().optional(), /** * Chart can refer to any go-getter URL or OCI registry based helm * chart URL. The chart will be downloaded. */ chart: zod_1.z.string().optional(), /** * DisableDNS can be used to customize Helm's EnableDNS option, which Fleet sets to `true` by default. */ disableDNS: zod_1.z.boolean().optional(), /** * DisableDependencyUpdate allows skipping chart dependencies update */ disableDependencyUpdate: zod_1.z.boolean().optional(), /** * DisablePreProcess disables template processing in values */ disablePreProcess: zod_1.z.boolean().optional(), /** * Force allows to override immutable resources. This could be dangerous. */ force: zod_1.z.boolean().optional(), /** * MaxHistory limits the maximum number of revisions saved per release by Helm. */ maxHistory: zod_1.z.number().optional(), /** * ReleaseName sets a custom release name to deploy the chart as. If * not specified a release name will be generated by combining the * invoking GitRepo.name + GitRepo.path. * @maxLength 53 * @pattern ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ */ releaseName: zod_1.z .string() .max(53) .regex(/^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/) .optional(), /** * Repo is the name of the HTTPS helm repo to download the chart from. */ repo: zod_1.z.string().optional(), /** * SkipSchemaValidation allows skipping schema validation against the chart values */ skipSchemaValidation: zod_1.z.boolean().optional(), /** * TakeOwnership makes helm skip the check for its own annotations */ takeOwnership: zod_1.z.boolean().optional(), /** * TimeoutSeconds is the time to wait for Helm operations. */ timeoutSeconds: zod_1.z.number().optional(), /** * Values passed to Helm. It is possible to specify the keys and values * as go template strings. */ values: zod_1.z.object({}).optional(), /** * ValuesFiles is a list of files to load values from. */ valuesFiles: zod_1.z.array(zod_1.z.string()).optional(), /** * ValuesFrom loads the values from configmaps and secrets. */ valuesFrom: zod_1.z .array(zod_1.z.object({ /** * The reference to a config map with release values. */ configMapKeyRef: zod_1.z .object({ key: zod_1.z.string().optional(), /** * Name of a resource in the same namespace as the referent. */ name: zod_1.z.string().optional(), namespace: zod_1.z.string().optional() }) .optional(), /** * The reference to a secret with release values. */ secretKeyRef: zod_1.z .object({ key: zod_1.z.string().optional(), /** * Name of a resource in the same namespace as the referent. */ name: zod_1.z.string().optional(), namespace: zod_1.z.string().optional() }) .optional() })) .optional(), /** * Version of the chart to download */ version: zod_1.z.string().optional(), /** * WaitForJobs if set and timeoutSeconds provided, will wait until all * Jobs have been completed before marking the GitRepo as ready. It * will wait for as long as timeoutSeconds */ waitForJobs: zod_1.z.boolean().optional() }) .optional(), /** * IgnoreOptions can be used to ignore fields when monitoring the bundle. */ ignore: zod_1.z .object({ /** * Conditions is a list of conditions to be ignored when monitoring the Bundle. */ conditions: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.string())).optional() }) .optional(), /** * KeepResources can be used to keep the deployed resources when removing the bundle */ keepResources: zod_1.z.boolean().optional(), /** * Kustomize options for the deployment, like the dir containing the * kustomization.yaml file. */ kustomize: zod_1.z .object({ /** * Dir points to a custom folder for kustomize resources. This folder must contain * a kustomization.yaml file. */ dir: zod_1.z.string().optional() }) .optional(), /** * TargetNamespace if present will assign all resource to this * namespace and if any cluster scoped resource exists the deployment * will fail. */ namespace: zod_1.z.string().optional(), /** * NamespaceAnnotations are annotations that will be appended to the namespace created by Fleet. */ namespaceAnnotations: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(), /** * NamespaceLabels are labels that will be appended to the namespace created by Fleet. */ namespaceLabels: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(), /** * ServiceAccount which will be used to perform this deployment. */ serviceAccount: zod_1.z.string().optional(), /** * YAML options, if using raw YAML these are names that map to * overlays/{name} files that will be used to replace or patch a resource. */ yaml: zod_1.z .object({ /** * Overlays is a list of names that maps to folders in "overlays/". * If you wish to customize the file ./subdir/resource.yaml then a file * ./overlays/myoverlay/subdir/resource.yaml will replace the base * file. * A file named ./overlays/myoverlay/subdir/resource_patch.yaml will patch the base file. */ overlays: zod_1.z.array(zod_1.z.string()).optional() }) .optional() }) .optional(), /** * Paused if set to true, will stop any BundleDeployments from being * updated. If true, BundleDeployments will be marked as out of sync * when changes are detected. */ paused: zod_1.z.boolean().optional(), /** * StagedDeploymentID is the ID of the staged deployment. */ stagedDeploymentID: zod_1.z.string().optional(), /** * StagedOptions are the deployment options, that are staged for * the next deployment. */ stagedOptions: zod_1.z .object({ /** * 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(), /** * DefaultNamespace is the namespace to use for resources that do not * specify a namespace. This field is not used to enforce or lock down * the deployment to a specific namespace. */ defaultNamespace: zod_1.z.string().optional(), /** * DeleteCRDResources deletes CRDs. Warning! this will also delete all your Custom Resources. */ deleteCRDResources: zod_1.z.boolean().optional(), /** * DeleteNamespace can be used to delete the deployed namespace when removing the bundle */ deleteNamespace: zod_1.z.boolean().optional(), /** * Diff can be used to ignore the modified state of objects which are amended at runtime. */ diff: zod_1.z .object({ /** * ComparePatches match a resource and remove fields from the check for modifications. */ comparePatches: zod_1.z .array(zod_1.z.object({ /** * APIVersion is the apiVersion of the resource to match. */ apiVersion: zod_1.z.string().optional(), /** * JSONPointers ignore diffs at a certain JSON path. */ jsonPointers: zod_1.z.array(zod_1.z.string()).optional(), /** * Kind is the kind of the resource to match. */ kind: zod_1.z.string().optional(), /** * Name is the name of the resource to match. */ name: zod_1.z.string().optional(), /** * Namespace is the namespace of the resource to match. */ namespace: zod_1.z.string().optional(), /** * Operations remove a JSON path from the resource. */ operations: zod_1.z .array(zod_1.z.object({ /** * Op is usually "remove" */ op: zod_1.z.string().optional(), /** * Path is the JSON path to remove. */ path: zod_1.z.string().optional(), /** * Value is usually empty. */ value: zod_1.z.string().optional() })) .optional() })) .optional() }) .optional(), /** * ForceSyncGeneration is used to force a redeployment */ forceSyncGeneration: zod_1.z.number().optional(), /** * Helm options for the deployment, like the chart name, repo and values. */ helm: zod_1.z .object({ /** * Atomic sets the --atomic flag when Helm is performing an upgrade */ atomic: zod_1.z.boolean().optional(), /** * Chart can refer to any go-getter URL or OCI registry based helm * chart URL. The chart will be downloaded. */ chart: zod_1.z.string().optional(), /** * DisableDNS can be used to customize Helm's EnableDNS option, which Fleet sets to `true` by default. */ disableDNS: zod_1.z.boolean().optional(), /** * DisableDependencyUpdate allows skipping chart dependencies update */ disableDependencyUpdate: zod_1.z.boolean().optional(), /** * DisablePreProcess disables template processing in values */ disablePreProcess: zod_1.z.boolean().optional(), /** * Force allows to override immutable resources. This could be dangerous. */ force: zod_1.z.boolean().optional(), /** * MaxHistory limits the maximum number of revisions saved per release by Helm. */ maxHistory: zod_1.z.number().optional(), /** * ReleaseName sets a custom release name to deploy the chart as. If * not specified a release name will be generated by combining the * invoking GitRepo.name + GitRepo.path. * @maxLength 53 * @pattern ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ */ releaseName: zod_1.z .string() .max(53) .regex(/^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/) .optional(), /** * Repo is the name of the HTTPS helm repo to download the chart from. */ repo: zod_1.z.string().optional(), /** * SkipSchemaValidation allows skipping schema validation against the chart values */ skipSchemaValidation: zod_1.z.boolean().optional(), /** * TakeOwnership makes helm skip the check for its own annotations */ takeOwnership: zod_1.z.boolean().optional(), /** * TimeoutSeconds is the time to wait for Helm operations. */ timeoutSeconds: zod_1.z.number().optional(), /** * Values passed to Helm. It is possible to specify the keys and values * as go template strings. */ values: zod_1.z.object({}).optional(), /** * ValuesFiles is a list of files to load values from. */ valuesFiles: zod_1.z.array(zod_1.z.string()).optional(), /** * ValuesFrom loads the values from configmaps and secrets. */ valuesFrom: zod_1.z .array(zod_1.z.object({ /** * The reference to a config map with release values. */ configMapKeyRef: zod_1.z .object({ key: zod_1.z.string().optional(), /** * Name of a resource in the same namespace as the referent. */ name: zod_1.z.string().optional(), namespace: zod_1.z.string().optional() }) .optional(), /** * The reference to a secret with release values. */ secretKeyRef: zod_1.z .object({ key: zod_1.z.string().optional(), /** * Name of a resource in the same namespace as the referent. */ name: zod_1.z.string().optional(), namespace: zod_1.z.string().optional() }) .optional() })) .optional(), /** * Version of the chart to download */ version: zod_1.z.string().optional(), /** * WaitForJobs if set and timeoutSeconds provided, will wait until all * Jobs have been completed before marking the GitRepo as ready. It * will wait for as long as timeoutSeconds */ waitForJobs: zod_1.z.boolean().optional() }) .optional(), /** * IgnoreOptions can be used to ignore fields when monitoring the bundle. */ ignore: zod_1.z .object({ /** * Conditions is a list of conditions to be ignored when monitoring the Bundle. */ conditions: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.string())).optional() }) .optional(), /** * KeepResources can be used to keep the deployed resources when removing the bundle */ keepResources: zod_1.z.boolean().optional(), /** * Kustomize options for the deployment, like the dir containing the * kustomization.yaml file. */ kustomize: zod_1.z .object({ /** * Dir points to a custom folder for kustomize resources. This folder must contain * a kustomization.yaml file. */ dir: zod_1.z.string().optional() }) .optional(), /** * TargetNamespace if present will assign all resource to this * namespace and if any cluster scoped resource exists the deployment * will fail. */ namespace: zod_1.z.string().optional(), /** * NamespaceAnnotations are annotations that will be appended to the namespace created by Fleet. */ namespaceAnnotations: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(), /** * NamespaceLabels are labels that will be appended to the namespace created by Fleet. */ namespaceLabels: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(), /** * ServiceAccount which will be used to perform this deployment. */ serviceAccount: zod_1.z.string().optional(), /** * YAML options, if using raw YAML these are names that map to * overlays/{name} files that will be used to replace or patch a resource. */ yaml: zod_1.z .object({ /** * Overlays is a list of names that maps to folders in "overlays/". * If you wish to customize the file ./subdir/resource.yaml then a file * ./overlays/myoverlay/subdir/resource.yaml will replace the base * file. * A file named ./overlays/myoverlay/subdir/resource_patch.yaml will patch the base file. */ overlays: zod_1.z.array(zod_1.z.string()).optional() }) .optional() }) .optional() }) .optional(), status: zod_1.z .object({ appliedDeploymentID: zod_1.z.string().optional(), 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(), display: zod_1.z .object({ deployed: zod_1.z.string().optional(), monitored: zod_1.z.string().optional(), state: zod_1.z.string().optional() }) .optional(), 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(), nonModified: zod_1.z.boolean().optional(), 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(), ready: zod_1.z.boolean().optional(), release: zod_1.z.string().optional(), /** * Resources lists the metadata of resources that were deployed * according to the helm release history. */ resources: zod_1.z .array(zod_1.z.object({ apiVersion: zod_1.z.string().optional(), /** * * @format date-time */ createdAt: zod_1.z.iso.datetime().optional().nullable(), kind: zod_1.z.string().optional(), name: zod_1.z.string().optional(), namespace: zod_1.z.string().optional() })) .optional(), syncGeneration: zod_1.z.number().optional() }) .optional() });