diff --git a/generation/generate-all.sh b/generation/generate-all.sh index c7f6d7a..b372f5c 100755 --- a/generation/generate-all.sh +++ b/generation/generate-all.sh @@ -1,16 +1,16 @@ #!/bin/sh -eux # https://github.com/kubernetes/kubernetes/releases -./generation/sources/builtin.sh v1.28.0 +./generation/sources/builtin.sh v1.30.4 # https://github.com/argoproj/argo-cd/releases -./generation/sources/argo-cd.sh v2.8.0 +./generation/sources/argo-cd.sh v2.12.3 # https://github.com/cert-manager/cert-manager/releases -./generation/sources/cert-manager.sh v1.12.3 +./generation/sources/cert-manager.sh v1.15.3 # https://github.com/kubernetes-sigs/external-dns/releases -./generation/sources/external-dns.sh v0.13.5 +./generation/sources/external-dns.sh v0.15.0 # https://github.com/kubernetes/autoscaler/releases?q=vertical -./generation/sources/vpa.sh 0.14.0 +./generation/sources/vpa.sh 1.2.1 diff --git a/lib/README.md b/lib/README.md index 7d14289..abcdff3 100644 --- a/lib/README.md +++ b/lib/README.md @@ -32,6 +32,13 @@ see `/x/kubernetes_client` for more information. ## Changelog +* `v0.5.2` on `2024-09-28`: + * Includes 'builtin' APIs generated from K8s `v1.30.4`. + * New kinds `ValidatingAdmissionPolicy`, `ServiceCIDR`, `ResourceSlice` + * Several API versions changed. You may need to update imports if you used one. + * Further API changes are detailed in Github Releases. + * `cert-manager`, `argo-cd`, `external-dns`, and `vpa` CRDs have been updated. + * `v0.5.1` on `2024-09-18`: * Updating `/x/kubernetes_client` API contract to `v0.7.3`. * Add [JSR publication](https://jsr.io/@cloudydeno/kubernetes-apis) of the module. diff --git a/lib/argo-cd/argoproj.io@v1alpha1/structs.ts b/lib/argo-cd/argoproj.io@v1alpha1/structs.ts index c6c4999..2dbc938 100644 --- a/lib/argo-cd/argoproj.io@v1alpha1/structs.ts +++ b/lib/argo-cd/argoproj.io@v1alpha1/structs.ts @@ -7,7 +7,8 @@ type ListOf = { items: Array; }; -/** Source overrides the source definition set in the application. This is typically set in a Rollback operation and is nil during a Sync operation */ +/** Source overrides the source definition set in the application. +This is typically set in a Rollback operation and is nil during a Sync operation */ export interface ApplicationSource { chart?: string | null; directory?: { @@ -51,12 +52,28 @@ export interface ApplicationSource { commonAnnotations?: Record | null; commonAnnotationsEnvsubst?: boolean | null; commonLabels?: Record | null; + components?: Array | null; forceCommonAnnotations?: boolean | null; forceCommonLabels?: boolean | null; images?: Array | null; + labelWithoutSelector?: boolean | null; namePrefix?: string | null; nameSuffix?: string | null; namespace?: string | null; + patches?: Array<{ + options?: Record | null; + patch?: string | null; + path?: string | null; + target?: { + annotationSelector?: string | null; + group?: string | null; + kind?: string | null; + labelSelector?: string | null; + name?: string | null; + namespace?: string | null; + version?: string | null; + } | null; + }> | null; replicas?: Array<{ count: c.IntOrString; name: string; @@ -126,12 +143,15 @@ function toApplicationSource_kustomize(input: c.JSONValue) { commonAnnotations: c.readOpt(obj["commonAnnotations"], x => c.readMap(x, c.checkStr)), commonAnnotationsEnvsubst: c.readOpt(obj["commonAnnotationsEnvsubst"], c.checkBool), commonLabels: c.readOpt(obj["commonLabels"], x => c.readMap(x, c.checkStr)), + components: c.readOpt(obj["components"], x => c.readList(x, c.checkStr)), forceCommonAnnotations: c.readOpt(obj["forceCommonAnnotations"], c.checkBool), forceCommonLabels: c.readOpt(obj["forceCommonLabels"], c.checkBool), images: c.readOpt(obj["images"], x => c.readList(x, c.checkStr)), + labelWithoutSelector: c.readOpt(obj["labelWithoutSelector"], c.checkBool), namePrefix: c.readOpt(obj["namePrefix"], c.checkStr), nameSuffix: c.readOpt(obj["nameSuffix"], c.checkStr), namespace: c.readOpt(obj["namespace"], c.checkStr), + patches: c.readOpt(obj["patches"], x => c.readList(x, toApplicationSource_kustomize_patches)), replicas: c.readOpt(obj["replicas"], x => c.readList(x, toApplicationSource_kustomize_replicas)), version: c.readOpt(obj["version"], c.checkStr), }} @@ -162,6 +182,14 @@ function toApplicationSource_helm_parameters(input: c.JSONValue) { name: c.readOpt(obj["name"], c.checkStr), value: c.readOpt(obj["value"], c.checkStr), }} +function toApplicationSource_kustomize_patches(input: c.JSONValue) { + const obj = c.checkObj(input); + return { + options: c.readOpt(obj["options"], x => c.readMap(x, c.checkBool)), + patch: c.readOpt(obj["patch"], c.checkStr), + path: c.readOpt(obj["path"], c.checkStr), + target: c.readOpt(obj["target"], toApplicationSource_kustomize_patches_target), + }} function toApplicationSource_kustomize_replicas(input: c.JSONValue) { const obj = c.checkObj(input); return { @@ -196,6 +224,17 @@ function toApplicationSource_directory_jsonnet_tlas(input: c.JSONValue) { name: c.checkStr(obj["name"]), value: c.checkStr(obj["value"]), }} +function toApplicationSource_kustomize_patches_target(input: c.JSONValue) { + const obj = c.checkObj(input); + return { + annotationSelector: c.readOpt(obj["annotationSelector"], c.checkStr), + group: c.readOpt(obj["group"], c.checkStr), + kind: c.readOpt(obj["kind"], c.checkStr), + labelSelector: c.readOpt(obj["labelSelector"], c.checkStr), + name: c.readOpt(obj["name"], c.checkStr), + namespace: c.readOpt(obj["namespace"], c.checkStr), + version: c.readOpt(obj["version"], c.checkStr), + }} /** Application is a definition of Application resource. */ export interface Application { @@ -303,6 +342,10 @@ export interface Application { deployStartedAt?: c.Time | null; deployedAt: c.Time; id: number; + initiatedBy?: { + automated?: boolean | null; + username?: string | null; + } | null; revision?: string | null; revisions?: Array | null; source?: ApplicationSource | null; @@ -618,6 +661,7 @@ function toApplication_status_history(input: c.JSONValue) { deployStartedAt: c.readOpt(obj["deployStartedAt"], c.toTime), deployedAt: c.toTime(obj["deployedAt"]), id: c.checkNum(obj["id"]), + initiatedBy: c.readOpt(obj["initiatedBy"], toApplication_status_history_initiatedBy), revision: c.readOpt(obj["revision"], c.checkStr), revisions: c.readOpt(obj["revisions"], x => c.readList(x, c.checkStr)), source: c.readOpt(obj["source"], toApplicationSource), @@ -702,6 +746,12 @@ function toApplication_spec_syncPolicy_retry(input: c.JSONValue) { backoff: c.readOpt(obj["backoff"], toApplication_spec_syncPolicy_retry_backoff), limit: c.readOpt(obj["limit"], c.checkNum), }} +function toApplication_status_history_initiatedBy(input: c.JSONValue) { + const obj = c.checkObj(input); + return { + automated: c.readOpt(obj["automated"], c.checkBool), + username: c.readOpt(obj["username"], c.checkStr), + }} function toApplication_status_operationState_operation(input: c.JSONValue) { const obj = c.checkObj(input); return { @@ -895,7 +945,7 @@ export interface ApplicationSetGenerator { values?: Record | null; } | null; list?: { - elements: Array; + elements?: Array | null; elementsYaml?: string | null; template?: ApplicationTemplate | null; } | null; @@ -1073,12 +1123,14 @@ export interface ApplicationSetGenerator { allBranches?: boolean | null; api?: string | null; group: string; + includeSharedProjects?: boolean | null; includeSubgroups?: boolean | null; insecure?: boolean | null; tokenRef?: { key: string; secretName: string; } | null; + topic?: string | null; } | null; requeueAfterSeconds?: number | null; template?: ApplicationTemplate | null; @@ -1177,7 +1229,7 @@ function toApplicationSetGenerator_git(input: c.JSONValue) { function toApplicationSetGenerator_list(input: c.JSONValue) { const obj = c.checkObj(input); return { - elements: c.readList(obj["elements"], c.identity), + elements: c.readOpt(obj["elements"], x => c.readList(x, c.identity)), elementsYaml: c.readOpt(obj["elementsYaml"], c.checkStr), template: c.readOpt(obj["template"], toApplicationTemplate), }} @@ -1381,9 +1433,11 @@ function toApplicationSetGenerator_scmProvider_gitlab(input: c.JSONValue) { allBranches: c.readOpt(obj["allBranches"], c.checkBool), api: c.readOpt(obj["api"], c.checkStr), group: c.checkStr(obj["group"]), + includeSharedProjects: c.readOpt(obj["includeSharedProjects"], c.checkBool), includeSubgroups: c.readOpt(obj["includeSubgroups"], c.checkBool), insecure: c.readOpt(obj["insecure"], c.checkBool), tokenRef: c.readOpt(obj["tokenRef"], toApplicationSetGenerator_scmProvider_gitlab_tokenRef), + topic: c.readOpt(obj["topic"], c.checkStr), }} function toApplicationSetGenerator_pullRequest_azuredevops_tokenRef(input: c.JSONValue) { const obj = c.checkObj(input); @@ -1650,8 +1704,14 @@ export interface ApplicationSet { generators: Array; goTemplate?: boolean | null; goTemplateOptions?: Array | null; + ignoreApplicationDifferences?: Array<{ + jqPathExpressions?: Array | null; + jsonPointers?: Array | null; + name?: string | null; + }> | null; preservedFields?: { annotations?: Array | null; + labels?: Array | null; } | null; strategy?: { rollingSync?: { @@ -1671,6 +1731,7 @@ export interface ApplicationSet { preserveResourcesOnDeletion?: boolean | null; } | null; template: ApplicationTemplate; + templatePatch?: string | null; }; status?: { applicationStatus?: Array<{ @@ -1679,6 +1740,7 @@ export interface ApplicationSet { message: string; status: string; step: string; + targetRevisions: Array; }> | null; conditions?: Array<{ lastTransitionTime?: c.Time | null; @@ -1687,6 +1749,21 @@ export interface ApplicationSet { status: string; type: string; }> | null; + resources?: Array<{ + group?: string | null; + health?: { + message?: string | null; + status?: string | null; + } | null; + hook?: boolean | null; + kind?: string | null; + name?: string | null; + namespace?: string | null; + requiresPruning?: boolean | null; + status?: string | null; + syncWave?: number | null; + version?: string | null; + }> | null; } | null; } export function toApplicationSet(input: c.JSONValue): ApplicationSet & c.ApiKind { @@ -1726,21 +1803,32 @@ function toApplicationSet_spec(input: c.JSONValue) { generators: c.readList(obj["generators"], toApplicationSetGenerator), goTemplate: c.readOpt(obj["goTemplate"], c.checkBool), goTemplateOptions: c.readOpt(obj["goTemplateOptions"], x => c.readList(x, c.checkStr)), + ignoreApplicationDifferences: c.readOpt(obj["ignoreApplicationDifferences"], x => c.readList(x, toApplicationSet_spec_ignoreApplicationDifferences)), preservedFields: c.readOpt(obj["preservedFields"], toApplicationSet_spec_preservedFields), strategy: c.readOpt(obj["strategy"], toApplicationSet_spec_strategy), syncPolicy: c.readOpt(obj["syncPolicy"], toApplicationSet_spec_syncPolicy), template: toApplicationTemplate(obj["template"]), + templatePatch: c.readOpt(obj["templatePatch"], c.checkStr), }} function toApplicationSet_status(input: c.JSONValue) { const obj = c.checkObj(input); return { applicationStatus: c.readOpt(obj["applicationStatus"], x => c.readList(x, toApplicationSet_status_applicationStatus)), conditions: c.readOpt(obj["conditions"], x => c.readList(x, toApplicationSet_status_conditions)), + resources: c.readOpt(obj["resources"], x => c.readList(x, toApplicationSet_status_resources)), + }} +function toApplicationSet_spec_ignoreApplicationDifferences(input: c.JSONValue) { + const obj = c.checkObj(input); + return { + jqPathExpressions: c.readOpt(obj["jqPathExpressions"], x => c.readList(x, c.checkStr)), + jsonPointers: c.readOpt(obj["jsonPointers"], x => c.readList(x, c.checkStr)), + name: c.readOpt(obj["name"], c.checkStr), }} function toApplicationSet_spec_preservedFields(input: c.JSONValue) { const obj = c.checkObj(input); return { annotations: c.readOpt(obj["annotations"], x => c.readList(x, c.checkStr)), + labels: c.readOpt(obj["labels"], x => c.readList(x, c.checkStr)), }} function toApplicationSet_spec_strategy(input: c.JSONValue) { const obj = c.checkObj(input); @@ -1762,6 +1850,7 @@ function toApplicationSet_status_applicationStatus(input: c.JSONValue) { message: c.checkStr(obj["message"]), status: c.checkStr(obj["status"]), step: c.checkStr(obj["step"]), + targetRevisions: c.readList(obj["targetRevisions"], c.checkStr), }} function toApplicationSet_status_conditions(input: c.JSONValue) { const obj = c.checkObj(input); @@ -1772,11 +1861,31 @@ function toApplicationSet_status_conditions(input: c.JSONValue) { status: c.checkStr(obj["status"]), type: c.checkStr(obj["type"]), }} +function toApplicationSet_status_resources(input: c.JSONValue) { + const obj = c.checkObj(input); + return { + group: c.readOpt(obj["group"], c.checkStr), + health: c.readOpt(obj["health"], toApplicationSet_status_resources_health), + hook: c.readOpt(obj["hook"], c.checkBool), + kind: c.readOpt(obj["kind"], c.checkStr), + name: c.readOpt(obj["name"], c.checkStr), + namespace: c.readOpt(obj["namespace"], c.checkStr), + requiresPruning: c.readOpt(obj["requiresPruning"], c.checkBool), + status: c.readOpt(obj["status"], c.checkStr), + syncWave: c.readOpt(obj["syncWave"], c.checkNum), + version: c.readOpt(obj["version"], c.checkStr), + }} function toApplicationSet_spec_strategy_rollingSync(input: c.JSONValue) { const obj = c.checkObj(input); return { steps: c.readOpt(obj["steps"], x => c.readList(x, toApplicationSet_spec_strategy_rollingSync_steps)), }} +function toApplicationSet_status_resources_health(input: c.JSONValue) { + const obj = c.checkObj(input); + return { + message: c.readOpt(obj["message"], c.checkStr), + status: c.readOpt(obj["status"], c.checkStr), + }} function toApplicationSet_spec_strategy_rollingSync_steps(input: c.JSONValue) { const obj = c.checkObj(input); return { @@ -1803,7 +1912,12 @@ export function toApplicationSetList(input: c.JSONValue): ApplicationSetList & c items: c.readList(obj.items, toApplicationSet), }} -/** AppProject provides a logical grouping of applications, providing controls for: * where the apps may deploy to (cluster whitelist) * what may be deployed (repository whitelist, resource whitelist/blacklist) * who can access these applications (roles, OIDC group claims bindings) * and what they can do (RBAC policies) * automation access to these roles (JWT tokens) */ +/** AppProject provides a logical grouping of applications, providing controls for: +* where the apps may deploy to (cluster whitelist) +* what may be deployed (repository whitelist, resource whitelist/blacklist) +* who can access these applications (roles, OIDC group claims bindings) +* and what they can do (RBAC policies) +* automation access to these roles (JWT tokens) */ export interface AppProject { apiVersion?: "argoproj.io/v1alpha1"; kind?: "AppProject"; diff --git a/lib/builtin/admissionregistration.k8s.io@v1/mod.ts b/lib/builtin/admissionregistration.k8s.io@v1/mod.ts index 00d2e2d..3a6487e 100644 --- a/lib/builtin/admissionregistration.k8s.io@v1/mod.ts +++ b/lib/builtin/admissionregistration.k8s.io@v1/mod.ts @@ -130,6 +130,287 @@ export class AdmissionregistrationV1Api { return AdmissionregistrationV1.toMutatingWebhookConfiguration(resp); } + async getValidatingAdmissionPolicyList( + opts: operations.GetListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}validatingadmissionpolicies`, + expectJson: true, + querystring: operations.formatGetListOpts(opts), + abortSignal: opts.abortSignal, + }); + return AdmissionregistrationV1.toValidatingAdmissionPolicyList(resp); + } + + async watchValidatingAdmissionPolicyList( + opts: operations.WatchListOpts = {}, + ): Promise> { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}validatingadmissionpolicies`, + expectJson: true, + expectStream: true, + querystring: operations.formatWatchListOpts(opts), + abortSignal: opts.abortSignal, + }); + return resp.pipeThrough(new c.WatchEventTransformer(AdmissionregistrationV1.toValidatingAdmissionPolicy, MetaV1.toStatus)); + } + + async createValidatingAdmissionPolicy( + body: AdmissionregistrationV1.ValidatingAdmissionPolicy, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "POST", + path: `${this.#root}validatingadmissionpolicies`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: AdmissionregistrationV1.fromValidatingAdmissionPolicy(body), + abortSignal: opts.abortSignal, + }); + return AdmissionregistrationV1.toValidatingAdmissionPolicy(resp); + } + + async deleteValidatingAdmissionPolicyList( + opts: operations.DeleteListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "DELETE", + path: `${this.#root}validatingadmissionpolicies`, + expectJson: true, + querystring: operations.formatDeleteListOpts(opts), + abortSignal: opts.abortSignal, + }); + return AdmissionregistrationV1.toValidatingAdmissionPolicyList(resp); + } + + async getValidatingAdmissionPolicy( + name: string, + opts: operations.NoOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}validatingadmissionpolicies/${name}`, + expectJson: true, + abortSignal: opts.abortSignal, + }); + return AdmissionregistrationV1.toValidatingAdmissionPolicy(resp); + } + + async deleteValidatingAdmissionPolicy( + name: string, + opts: operations.DeleteOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "DELETE", + path: `${this.#root}validatingadmissionpolicies/${name}`, + expectJson: true, + querystring: operations.formatDeleteOpts(opts), + abortSignal: opts.abortSignal, + }); + if (c.isStatusKind(resp)) return MetaV1.toStatus(resp); + return AdmissionregistrationV1.toValidatingAdmissionPolicy(resp); + } + + async replaceValidatingAdmissionPolicy( + name: string, + body: AdmissionregistrationV1.ValidatingAdmissionPolicy, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PUT", + path: `${this.#root}validatingadmissionpolicies/${name}`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: AdmissionregistrationV1.fromValidatingAdmissionPolicy(body), + abortSignal: opts.abortSignal, + }); + return AdmissionregistrationV1.toValidatingAdmissionPolicy(resp); + } + + async patchValidatingAdmissionPolicy( + name: string, + type: c.PatchType, + body: AdmissionregistrationV1.ValidatingAdmissionPolicy | c.JsonPatch, + opts: operations.PatchOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PATCH", + path: `${this.#root}validatingadmissionpolicies/${name}`, + expectJson: true, + querystring: operations.formatPatchOpts(opts), + contentType: c.getPatchContentType(type), + bodyJson: Array.isArray(body) ? body : AdmissionregistrationV1.fromValidatingAdmissionPolicy(body), + abortSignal: opts.abortSignal, + }); + return AdmissionregistrationV1.toValidatingAdmissionPolicy(resp); + } + + async getValidatingAdmissionPolicyStatus( + name: string, + opts: operations.NoOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}validatingadmissionpolicies/${name}/status`, + expectJson: true, + abortSignal: opts.abortSignal, + }); + return AdmissionregistrationV1.toValidatingAdmissionPolicy(resp); + } + + async replaceValidatingAdmissionPolicyStatus( + name: string, + body: AdmissionregistrationV1.ValidatingAdmissionPolicy, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PUT", + path: `${this.#root}validatingadmissionpolicies/${name}/status`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: AdmissionregistrationV1.fromValidatingAdmissionPolicy(body), + abortSignal: opts.abortSignal, + }); + return AdmissionregistrationV1.toValidatingAdmissionPolicy(resp); + } + + async patchValidatingAdmissionPolicyStatus( + name: string, + type: c.PatchType, + body: AdmissionregistrationV1.ValidatingAdmissionPolicy | c.JsonPatch, + opts: operations.PatchOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PATCH", + path: `${this.#root}validatingadmissionpolicies/${name}/status`, + expectJson: true, + querystring: operations.formatPatchOpts(opts), + contentType: c.getPatchContentType(type), + bodyJson: Array.isArray(body) ? body : AdmissionregistrationV1.fromValidatingAdmissionPolicy(body), + abortSignal: opts.abortSignal, + }); + return AdmissionregistrationV1.toValidatingAdmissionPolicy(resp); + } + + async getValidatingAdmissionPolicyBindingList( + opts: operations.GetListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}validatingadmissionpolicybindings`, + expectJson: true, + querystring: operations.formatGetListOpts(opts), + abortSignal: opts.abortSignal, + }); + return AdmissionregistrationV1.toValidatingAdmissionPolicyBindingList(resp); + } + + async watchValidatingAdmissionPolicyBindingList( + opts: operations.WatchListOpts = {}, + ): Promise> { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}validatingadmissionpolicybindings`, + expectJson: true, + expectStream: true, + querystring: operations.formatWatchListOpts(opts), + abortSignal: opts.abortSignal, + }); + return resp.pipeThrough(new c.WatchEventTransformer(AdmissionregistrationV1.toValidatingAdmissionPolicyBinding, MetaV1.toStatus)); + } + + async createValidatingAdmissionPolicyBinding( + body: AdmissionregistrationV1.ValidatingAdmissionPolicyBinding, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "POST", + path: `${this.#root}validatingadmissionpolicybindings`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: AdmissionregistrationV1.fromValidatingAdmissionPolicyBinding(body), + abortSignal: opts.abortSignal, + }); + return AdmissionregistrationV1.toValidatingAdmissionPolicyBinding(resp); + } + + async deleteValidatingAdmissionPolicyBindingList( + opts: operations.DeleteListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "DELETE", + path: `${this.#root}validatingadmissionpolicybindings`, + expectJson: true, + querystring: operations.formatDeleteListOpts(opts), + abortSignal: opts.abortSignal, + }); + return AdmissionregistrationV1.toValidatingAdmissionPolicyBindingList(resp); + } + + async getValidatingAdmissionPolicyBinding( + name: string, + opts: operations.NoOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}validatingadmissionpolicybindings/${name}`, + expectJson: true, + abortSignal: opts.abortSignal, + }); + return AdmissionregistrationV1.toValidatingAdmissionPolicyBinding(resp); + } + + async deleteValidatingAdmissionPolicyBinding( + name: string, + opts: operations.DeleteOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "DELETE", + path: `${this.#root}validatingadmissionpolicybindings/${name}`, + expectJson: true, + querystring: operations.formatDeleteOpts(opts), + abortSignal: opts.abortSignal, + }); + if (c.isStatusKind(resp)) return MetaV1.toStatus(resp); + return AdmissionregistrationV1.toValidatingAdmissionPolicyBinding(resp); + } + + async replaceValidatingAdmissionPolicyBinding( + name: string, + body: AdmissionregistrationV1.ValidatingAdmissionPolicyBinding, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PUT", + path: `${this.#root}validatingadmissionpolicybindings/${name}`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: AdmissionregistrationV1.fromValidatingAdmissionPolicyBinding(body), + abortSignal: opts.abortSignal, + }); + return AdmissionregistrationV1.toValidatingAdmissionPolicyBinding(resp); + } + + async patchValidatingAdmissionPolicyBinding( + name: string, + type: c.PatchType, + body: AdmissionregistrationV1.ValidatingAdmissionPolicyBinding | c.JsonPatch, + opts: operations.PatchOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PATCH", + path: `${this.#root}validatingadmissionpolicybindings/${name}`, + expectJson: true, + querystring: operations.formatPatchOpts(opts), + contentType: c.getPatchContentType(type), + bodyJson: Array.isArray(body) ? body : AdmissionregistrationV1.fromValidatingAdmissionPolicyBinding(body), + abortSignal: opts.abortSignal, + }); + return AdmissionregistrationV1.toValidatingAdmissionPolicyBinding(resp); + } + async getValidatingWebhookConfigurationList( opts: operations.GetListOpts = {}, ): Promise { diff --git a/lib/builtin/admissionregistration.k8s.io@v1/structs.ts b/lib/builtin/admissionregistration.k8s.io@v1/structs.ts index 6477855..d95f419 100644 --- a/lib/builtin/admissionregistration.k8s.io@v1/structs.ts +++ b/lib/builtin/admissionregistration.k8s.io@v1/structs.ts @@ -7,6 +7,38 @@ type ListOf = { items: Array; }; +/** AuditAnnotation describes how to produce an audit annotation for an API request. */ +export interface AuditAnnotation { + key: string; + valueExpression: string; +} +export function toAuditAnnotation(input: c.JSONValue): AuditAnnotation { + const obj = c.checkObj(input); + return { + key: c.checkStr(obj["key"]), + valueExpression: c.checkStr(obj["valueExpression"]), + }} +export function fromAuditAnnotation(input: AuditAnnotation): c.JSONValue { + return { + ...input, + }} + +/** ExpressionWarning is a warning information that targets a specific expression. */ +export interface ExpressionWarning { + fieldRef: string; + warning: string; +} +export function toExpressionWarning(input: c.JSONValue): ExpressionWarning { + const obj = c.checkObj(input); + return { + fieldRef: c.checkStr(obj["fieldRef"]), + warning: c.checkStr(obj["warning"]), + }} +export function fromExpressionWarning(input: ExpressionWarning): c.JSONValue { + return { + ...input, + }} + /** MatchCondition represents a condition which must by fulfilled for a request to be sent to a webhook. */ export interface MatchCondition { expression: string; @@ -23,6 +55,56 @@ export function fromMatchCondition(input: MatchCondition): c.JSONValue { ...input, }} +/** MatchResources decides whether to run the admission control policy on an object based on whether it meets the match criteria. The exclude rules take precedence over include rules (if a resource matches both, it is excluded) */ +export interface MatchResources { + excludeResourceRules?: Array | null; + matchPolicy?: string | null; + namespaceSelector?: MetaV1.LabelSelector | null; + objectSelector?: MetaV1.LabelSelector | null; + resourceRules?: Array | null; +} +export function toMatchResources(input: c.JSONValue): MatchResources { + const obj = c.checkObj(input); + return { + excludeResourceRules: c.readOpt(obj["excludeResourceRules"], x => c.readList(x, toNamedRuleWithOperations)), + matchPolicy: c.readOpt(obj["matchPolicy"], c.checkStr), + namespaceSelector: c.readOpt(obj["namespaceSelector"], MetaV1.toLabelSelector), + objectSelector: c.readOpt(obj["objectSelector"], MetaV1.toLabelSelector), + resourceRules: c.readOpt(obj["resourceRules"], x => c.readList(x, toNamedRuleWithOperations)), + }} +export function fromMatchResources(input: MatchResources): c.JSONValue { + return { + ...input, + excludeResourceRules: input.excludeResourceRules?.map(fromNamedRuleWithOperations), + namespaceSelector: input.namespaceSelector != null ? MetaV1.fromLabelSelector(input.namespaceSelector) : undefined, + objectSelector: input.objectSelector != null ? MetaV1.fromLabelSelector(input.objectSelector) : undefined, + resourceRules: input.resourceRules?.map(fromNamedRuleWithOperations), + }} + +/** NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. */ +export interface NamedRuleWithOperations { + apiGroups?: Array | null; + apiVersions?: Array | null; + operations?: Array | null; + resourceNames?: Array | null; + resources?: Array | null; + scope?: string | null; +} +export function toNamedRuleWithOperations(input: c.JSONValue): NamedRuleWithOperations { + const obj = c.checkObj(input); + return { + apiGroups: c.readOpt(obj["apiGroups"], x => c.readList(x, c.checkStr)), + apiVersions: c.readOpt(obj["apiVersions"], x => c.readList(x, c.checkStr)), + operations: c.readOpt(obj["operations"], x => c.readList(x, c.checkStr)), + resourceNames: c.readOpt(obj["resourceNames"], x => c.readList(x, c.checkStr)), + resources: c.readOpt(obj["resources"], x => c.readList(x, c.checkStr)), + scope: c.readOpt(obj["scope"], c.checkStr), + }} +export function fromNamedRuleWithOperations(input: NamedRuleWithOperations): c.JSONValue { + return { + ...input, + }} + /** MutatingWebhook describes an admission webhook and the resources and operations it applies to. */ export interface MutatingWebhook { admissionReviewVersions: Array; @@ -160,6 +242,245 @@ export function toMutatingWebhookConfigurationList(input: c.JSONValue): Mutating items: c.readList(obj.items, toMutatingWebhookConfiguration), }} +/** ParamKind is a tuple of Group Kind and Version. */ +export interface ParamKind { + apiVersion?: string | null; + kind?: string | null; +} +export function toParamKind(input: c.JSONValue): ParamKind { + const obj = c.checkObj(input); + return { + apiVersion: c.readOpt(obj["apiVersion"], c.checkStr), + kind: c.readOpt(obj["kind"], c.checkStr), + }} +export function fromParamKind(input: ParamKind): c.JSONValue { + return { + ...input, + }} + +/** ParamRef describes how to locate the params to be used as input to expressions of rules applied by a policy binding. */ +export interface ParamRef { + name?: string | null; + namespace?: string | null; + parameterNotFoundAction?: string | null; + selector?: MetaV1.LabelSelector | null; +} +export function toParamRef(input: c.JSONValue): ParamRef { + const obj = c.checkObj(input); + return { + name: c.readOpt(obj["name"], c.checkStr), + namespace: c.readOpt(obj["namespace"], c.checkStr), + parameterNotFoundAction: c.readOpt(obj["parameterNotFoundAction"], c.checkStr), + selector: c.readOpt(obj["selector"], MetaV1.toLabelSelector), + }} +export function fromParamRef(input: ParamRef): c.JSONValue { + return { + ...input, + selector: input.selector != null ? MetaV1.fromLabelSelector(input.selector) : undefined, + }} + +/** TypeChecking contains results of type checking the expressions in the ValidatingAdmissionPolicy */ +export interface TypeChecking { + expressionWarnings?: Array | null; +} +export function toTypeChecking(input: c.JSONValue): TypeChecking { + const obj = c.checkObj(input); + return { + expressionWarnings: c.readOpt(obj["expressionWarnings"], x => c.readList(x, toExpressionWarning)), + }} +export function fromTypeChecking(input: TypeChecking): c.JSONValue { + return { + ...input, + expressionWarnings: input.expressionWarnings?.map(fromExpressionWarning), + }} + +/** ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. */ +export interface ValidatingAdmissionPolicy { + apiVersion?: "admissionregistration.k8s.io/v1"; + kind?: "ValidatingAdmissionPolicy"; + metadata?: MetaV1.ObjectMeta | null; + spec?: ValidatingAdmissionPolicySpec | null; + status?: ValidatingAdmissionPolicyStatus | null; +} +export function toValidatingAdmissionPolicy(input: c.JSONValue): ValidatingAdmissionPolicy & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "admissionregistration.k8s.io/v1", "ValidatingAdmissionPolicy"), + metadata: c.readOpt(obj["metadata"], MetaV1.toObjectMeta), + spec: c.readOpt(obj["spec"], toValidatingAdmissionPolicySpec), + status: c.readOpt(obj["status"], toValidatingAdmissionPolicyStatus), + }} +export function fromValidatingAdmissionPolicy(input: ValidatingAdmissionPolicy): c.JSONValue { + return { + ...c.assertOrAddApiVersionAndKind(input, "admissionregistration.k8s.io/v1", "ValidatingAdmissionPolicy"), + ...input, + metadata: input.metadata != null ? MetaV1.fromObjectMeta(input.metadata) : undefined, + spec: input.spec != null ? fromValidatingAdmissionPolicySpec(input.spec) : undefined, + status: input.status != null ? fromValidatingAdmissionPolicyStatus(input.status) : undefined, + }} + +/** ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy. */ +export interface ValidatingAdmissionPolicySpec { + auditAnnotations?: Array | null; + failurePolicy?: string | null; + matchConditions?: Array | null; + matchConstraints?: MatchResources | null; + paramKind?: ParamKind | null; + validations?: Array | null; + variables?: Array | null; +} +export function toValidatingAdmissionPolicySpec(input: c.JSONValue): ValidatingAdmissionPolicySpec { + const obj = c.checkObj(input); + return { + auditAnnotations: c.readOpt(obj["auditAnnotations"], x => c.readList(x, toAuditAnnotation)), + failurePolicy: c.readOpt(obj["failurePolicy"], c.checkStr), + matchConditions: c.readOpt(obj["matchConditions"], x => c.readList(x, toMatchCondition)), + matchConstraints: c.readOpt(obj["matchConstraints"], toMatchResources), + paramKind: c.readOpt(obj["paramKind"], toParamKind), + validations: c.readOpt(obj["validations"], x => c.readList(x, toValidation)), + variables: c.readOpt(obj["variables"], x => c.readList(x, toVariable)), + }} +export function fromValidatingAdmissionPolicySpec(input: ValidatingAdmissionPolicySpec): c.JSONValue { + return { + ...input, + auditAnnotations: input.auditAnnotations?.map(fromAuditAnnotation), + matchConditions: input.matchConditions?.map(fromMatchCondition), + matchConstraints: input.matchConstraints != null ? fromMatchResources(input.matchConstraints) : undefined, + paramKind: input.paramKind != null ? fromParamKind(input.paramKind) : undefined, + validations: input.validations?.map(fromValidation), + variables: input.variables?.map(fromVariable), + }} + +/** Validation specifies the CEL expression which is used to apply the validation. */ +export interface Validation { + expression: string; + message?: string | null; + messageExpression?: string | null; + reason?: string | null; +} +export function toValidation(input: c.JSONValue): Validation { + const obj = c.checkObj(input); + return { + expression: c.checkStr(obj["expression"]), + message: c.readOpt(obj["message"], c.checkStr), + messageExpression: c.readOpt(obj["messageExpression"], c.checkStr), + reason: c.readOpt(obj["reason"], c.checkStr), + }} +export function fromValidation(input: Validation): c.JSONValue { + return { + ...input, + }} + +/** Variable is the definition of a variable that is used for composition. A variable is defined as a named expression. */ +export interface Variable { + expression: string; + name: string; +} +export function toVariable(input: c.JSONValue): Variable { + const obj = c.checkObj(input); + return { + expression: c.checkStr(obj["expression"]), + name: c.checkStr(obj["name"]), + }} +export function fromVariable(input: Variable): c.JSONValue { + return { + ...input, + }} + +/** ValidatingAdmissionPolicyStatus represents the status of an admission validation policy. */ +export interface ValidatingAdmissionPolicyStatus { + conditions?: Array | null; + observedGeneration?: number | null; + typeChecking?: TypeChecking | null; +} +export function toValidatingAdmissionPolicyStatus(input: c.JSONValue): ValidatingAdmissionPolicyStatus { + const obj = c.checkObj(input); + return { + conditions: c.readOpt(obj["conditions"], x => c.readList(x, MetaV1.toCondition)), + observedGeneration: c.readOpt(obj["observedGeneration"], c.checkNum), + typeChecking: c.readOpt(obj["typeChecking"], toTypeChecking), + }} +export function fromValidatingAdmissionPolicyStatus(input: ValidatingAdmissionPolicyStatus): c.JSONValue { + return { + ...input, + conditions: input.conditions?.map(MetaV1.fromCondition), + typeChecking: input.typeChecking != null ? fromTypeChecking(input.typeChecking) : undefined, + }} + +/** ValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources. ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters. + +For a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding. + +The CEL expressions of a policy must have a computed CEL cost below the maximum CEL budget. Each evaluation of the policy is given an independent CEL cost budget. Adding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget. */ +export interface ValidatingAdmissionPolicyBinding { + apiVersion?: "admissionregistration.k8s.io/v1"; + kind?: "ValidatingAdmissionPolicyBinding"; + metadata?: MetaV1.ObjectMeta | null; + spec?: ValidatingAdmissionPolicyBindingSpec | null; +} +export function toValidatingAdmissionPolicyBinding(input: c.JSONValue): ValidatingAdmissionPolicyBinding & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "admissionregistration.k8s.io/v1", "ValidatingAdmissionPolicyBinding"), + metadata: c.readOpt(obj["metadata"], MetaV1.toObjectMeta), + spec: c.readOpt(obj["spec"], toValidatingAdmissionPolicyBindingSpec), + }} +export function fromValidatingAdmissionPolicyBinding(input: ValidatingAdmissionPolicyBinding): c.JSONValue { + return { + ...c.assertOrAddApiVersionAndKind(input, "admissionregistration.k8s.io/v1", "ValidatingAdmissionPolicyBinding"), + ...input, + metadata: input.metadata != null ? MetaV1.fromObjectMeta(input.metadata) : undefined, + spec: input.spec != null ? fromValidatingAdmissionPolicyBindingSpec(input.spec) : undefined, + }} + +/** ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding. */ +export interface ValidatingAdmissionPolicyBindingSpec { + matchResources?: MatchResources | null; + paramRef?: ParamRef | null; + policyName?: string | null; + validationActions?: Array | null; +} +export function toValidatingAdmissionPolicyBindingSpec(input: c.JSONValue): ValidatingAdmissionPolicyBindingSpec { + const obj = c.checkObj(input); + return { + matchResources: c.readOpt(obj["matchResources"], toMatchResources), + paramRef: c.readOpt(obj["paramRef"], toParamRef), + policyName: c.readOpt(obj["policyName"], c.checkStr), + validationActions: c.readOpt(obj["validationActions"], x => c.readList(x, c.checkStr)), + }} +export function fromValidatingAdmissionPolicyBindingSpec(input: ValidatingAdmissionPolicyBindingSpec): c.JSONValue { + return { + ...input, + matchResources: input.matchResources != null ? fromMatchResources(input.matchResources) : undefined, + paramRef: input.paramRef != null ? fromParamRef(input.paramRef) : undefined, + }} + +/** ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding. */ +export interface ValidatingAdmissionPolicyBindingList extends ListOf { + apiVersion?: "admissionregistration.k8s.io/v1"; + kind?: "ValidatingAdmissionPolicyBindingList"; +}; +export function toValidatingAdmissionPolicyBindingList(input: c.JSONValue): ValidatingAdmissionPolicyBindingList & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "admissionregistration.k8s.io/v1", "ValidatingAdmissionPolicyBindingList"), + metadata: MetaV1.toListMeta(obj.metadata), + items: c.readList(obj.items, toValidatingAdmissionPolicyBinding), + }} + +/** ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy. */ +export interface ValidatingAdmissionPolicyList extends ListOf { + apiVersion?: "admissionregistration.k8s.io/v1"; + kind?: "ValidatingAdmissionPolicyList"; +}; +export function toValidatingAdmissionPolicyList(input: c.JSONValue): ValidatingAdmissionPolicyList & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "admissionregistration.k8s.io/v1", "ValidatingAdmissionPolicyList"), + metadata: MetaV1.toListMeta(obj.metadata), + items: c.readList(obj.items, toValidatingAdmissionPolicy), + }} + /** ValidatingWebhook describes an admission webhook and the resources and operations it applies to. */ export interface ValidatingWebhook { admissionReviewVersions: Array; diff --git a/lib/builtin/apiextensions.k8s.io@v1/structs.ts b/lib/builtin/apiextensions.k8s.io@v1/structs.ts index b489ee7..c82e346 100644 --- a/lib/builtin/apiextensions.k8s.io@v1/structs.ts +++ b/lib/builtin/apiextensions.k8s.io@v1/structs.ts @@ -187,6 +187,7 @@ export interface CustomResourceDefinitionVersion { deprecationWarning?: string | null; name: string; schema?: CustomResourceValidation | null; + selectableFields?: Array | null; served: boolean; storage: boolean; subresources?: CustomResourceSubresources | null; @@ -199,6 +200,7 @@ export function toCustomResourceDefinitionVersion(input: c.JSONValue): CustomRes deprecationWarning: c.readOpt(obj["deprecationWarning"], c.checkStr), name: c.checkStr(obj["name"]), schema: c.readOpt(obj["schema"], toCustomResourceValidation), + selectableFields: c.readOpt(obj["selectableFields"], x => c.readList(x, toSelectableField)), served: c.checkBool(obj["served"]), storage: c.checkBool(obj["storage"]), subresources: c.readOpt(obj["subresources"], toCustomResourceSubresources), @@ -208,6 +210,7 @@ export function fromCustomResourceDefinitionVersion(input: CustomResourceDefinit ...input, additionalPrinterColumns: input.additionalPrinterColumns?.map(fromCustomResourceColumnDefinition), schema: input.schema != null ? fromCustomResourceValidation(input.schema) : undefined, + selectableFields: input.selectableFields?.map(fromSelectableField), subresources: input.subresources != null ? fromCustomResourceSubresources(input.subresources) : undefined, }} @@ -368,6 +371,7 @@ export interface ValidationRule { fieldPath?: string | null; message?: string | null; messageExpression?: string | null; + optionalOldSelf?: boolean | null; reason?: string | null; rule: string; } @@ -377,6 +381,7 @@ export function toValidationRule(input: c.JSONValue): ValidationRule { fieldPath: c.readOpt(obj["fieldPath"], c.checkStr), message: c.readOpt(obj["message"], c.checkStr), messageExpression: c.readOpt(obj["messageExpression"], c.checkStr), + optionalOldSelf: c.readOpt(obj["optionalOldSelf"], c.checkBool), reason: c.readOpt(obj["reason"], c.checkStr), rule: c.checkStr(obj["rule"]), }} @@ -385,6 +390,20 @@ export function fromValidationRule(input: ValidationRule): c.JSONValue { ...input, }} +/** SelectableField specifies the JSON path of a field that may be used with field selectors. */ +export interface SelectableField { + jsonPath: string; +} +export function toSelectableField(input: c.JSONValue): SelectableField { + const obj = c.checkObj(input); + return { + jsonPath: c.checkStr(obj["jsonPath"]), + }} +export function fromSelectableField(input: SelectableField): c.JSONValue { + return { + ...input, + }} + /** CustomResourceSubresources defines the status and scale subresources for CustomResources. */ export interface CustomResourceSubresources { scale?: CustomResourceSubresourceScale | null; diff --git a/lib/builtin/batch@v1/structs.ts b/lib/builtin/batch@v1/structs.ts index c8d11d9..0587e4b 100644 --- a/lib/builtin/batch@v1/structs.ts +++ b/lib/builtin/batch@v1/structs.ts @@ -87,12 +87,14 @@ export interface JobSpec { backoffLimitPerIndex?: number | null; completionMode?: string | null; completions?: number | null; + managedBy?: string | null; manualSelector?: boolean | null; maxFailedIndexes?: number | null; parallelism?: number | null; podFailurePolicy?: PodFailurePolicy | null; podReplacementPolicy?: string | null; selector?: MetaV1.LabelSelector | null; + successPolicy?: SuccessPolicy | null; suspend?: boolean | null; template: CoreV1.PodTemplateSpec; ttlSecondsAfterFinished?: number | null; @@ -105,12 +107,14 @@ export function toJobSpec(input: c.JSONValue): JobSpec { backoffLimitPerIndex: c.readOpt(obj["backoffLimitPerIndex"], c.checkNum), completionMode: c.readOpt(obj["completionMode"], c.checkStr), completions: c.readOpt(obj["completions"], c.checkNum), + managedBy: c.readOpt(obj["managedBy"], c.checkStr), manualSelector: c.readOpt(obj["manualSelector"], c.checkBool), maxFailedIndexes: c.readOpt(obj["maxFailedIndexes"], c.checkNum), parallelism: c.readOpt(obj["parallelism"], c.checkNum), podFailurePolicy: c.readOpt(obj["podFailurePolicy"], toPodFailurePolicy), podReplacementPolicy: c.readOpt(obj["podReplacementPolicy"], c.checkStr), selector: c.readOpt(obj["selector"], MetaV1.toLabelSelector), + successPolicy: c.readOpt(obj["successPolicy"], toSuccessPolicy), suspend: c.readOpt(obj["suspend"], c.checkBool), template: CoreV1.toPodTemplateSpec(obj["template"]), ttlSecondsAfterFinished: c.readOpt(obj["ttlSecondsAfterFinished"], c.checkNum), @@ -120,6 +124,7 @@ export function fromJobSpec(input: JobSpec): c.JSONValue { ...input, podFailurePolicy: input.podFailurePolicy != null ? fromPodFailurePolicy(input.podFailurePolicy) : undefined, selector: input.selector != null ? MetaV1.fromLabelSelector(input.selector) : undefined, + successPolicy: input.successPolicy != null ? fromSuccessPolicy(input.successPolicy) : undefined, template: input.template != null ? CoreV1.fromPodTemplateSpec(input.template) : undefined, }} @@ -142,14 +147,14 @@ export function fromPodFailurePolicy(input: PodFailurePolicy): c.JSONValue { export interface PodFailurePolicyRule { action: string; onExitCodes?: PodFailurePolicyOnExitCodesRequirement | null; - onPodConditions: Array; + onPodConditions?: Array | null; } export function toPodFailurePolicyRule(input: c.JSONValue): PodFailurePolicyRule { const obj = c.checkObj(input); return { action: c.checkStr(obj["action"]), onExitCodes: c.readOpt(obj["onExitCodes"], toPodFailurePolicyOnExitCodesRequirement), - onPodConditions: c.readList(obj["onPodConditions"], toPodFailurePolicyOnPodConditionsPattern), + onPodConditions: c.readOpt(obj["onPodConditions"], x => c.readList(x, toPodFailurePolicyOnPodConditionsPattern)), }} export function fromPodFailurePolicyRule(input: PodFailurePolicyRule): c.JSONValue { return { @@ -192,6 +197,37 @@ export function fromPodFailurePolicyOnPodConditionsPattern(input: PodFailurePoli ...input, }} +/** SuccessPolicy describes when a Job can be declared as succeeded based on the success of some indexes. */ +export interface SuccessPolicy { + rules: Array; +} +export function toSuccessPolicy(input: c.JSONValue): SuccessPolicy { + const obj = c.checkObj(input); + return { + rules: c.readList(obj["rules"], toSuccessPolicyRule), + }} +export function fromSuccessPolicy(input: SuccessPolicy): c.JSONValue { + return { + ...input, + rules: input.rules?.map(fromSuccessPolicyRule), + }} + +/** SuccessPolicyRule describes rule for declaring a Job as succeeded. Each rule must have at least one of the "succeededIndexes" or "succeededCount" specified. */ +export interface SuccessPolicyRule { + succeededCount?: number | null; + succeededIndexes?: string | null; +} +export function toSuccessPolicyRule(input: c.JSONValue): SuccessPolicyRule { + const obj = c.checkObj(input); + return { + succeededCount: c.readOpt(obj["succeededCount"], c.checkNum), + succeededIndexes: c.readOpt(obj["succeededIndexes"], c.checkStr), + }} +export function fromSuccessPolicyRule(input: SuccessPolicyRule): c.JSONValue { + return { + ...input, + }} + /** CronJobStatus represents the current state of a cron job. */ export interface CronJobStatus { active?: Array | null; diff --git a/lib/builtin/core@v1/structs.ts b/lib/builtin/core@v1/structs.ts index 820a7eb..835f76c 100644 --- a/lib/builtin/core@v1/structs.ts +++ b/lib/builtin/core@v1/structs.ts @@ -174,6 +174,8 @@ export function fromWeightedPodAffinityTerm(input: WeightedPodAffinityTerm): c.J /** Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key matches that of any node on which a pod of the set of pods is running */ export interface PodAffinityTerm { labelSelector?: MetaV1.LabelSelector | null; + matchLabelKeys?: Array | null; + mismatchLabelKeys?: Array | null; namespaceSelector?: MetaV1.LabelSelector | null; namespaces?: Array | null; topologyKey: string; @@ -182,6 +184,8 @@ export function toPodAffinityTerm(input: c.JSONValue): PodAffinityTerm { const obj = c.checkObj(input); return { labelSelector: c.readOpt(obj["labelSelector"], MetaV1.toLabelSelector), + matchLabelKeys: c.readOpt(obj["matchLabelKeys"], x => c.readList(x, c.checkStr)), + mismatchLabelKeys: c.readOpt(obj["mismatchLabelKeys"], x => c.readList(x, c.checkStr)), namespaceSelector: c.readOpt(obj["namespaceSelector"], MetaV1.toLabelSelector), namespaces: c.readOpt(obj["namespaces"], x => c.readList(x, c.checkStr)), topologyKey: c.checkStr(obj["topologyKey"]), @@ -211,6 +215,22 @@ export function fromPodAntiAffinity(input: PodAntiAffinity): c.JSONValue { requiredDuringSchedulingIgnoredDuringExecution: input.requiredDuringSchedulingIgnoredDuringExecution?.map(fromPodAffinityTerm), }} +/** AppArmorProfile defines a pod or container's AppArmor settings. */ +export interface AppArmorProfile { + localhostProfile?: string | null; + type: string; +} +export function toAppArmorProfile(input: c.JSONValue): AppArmorProfile { + const obj = c.checkObj(input); + return { + localhostProfile: c.readOpt(obj["localhostProfile"], c.checkStr), + type: c.checkStr(obj["type"]), + }} +export function fromAppArmorProfile(input: AppArmorProfile): c.JSONValue { + return { + ...input, + }} + /** AttachedVolume describes a volume attached to a node */ export interface AttachedVolume { devicePath: string; @@ -567,6 +587,29 @@ export function fromClientIPConfig(input: ClientIPConfig): c.JSONValue { ...input, }} +/** ClusterTrustBundleProjection describes how to select a set of ClusterTrustBundle objects and project their contents into the pod filesystem. */ +export interface ClusterTrustBundleProjection { + labelSelector?: MetaV1.LabelSelector | null; + name?: string | null; + optional?: boolean | null; + path: string; + signerName?: string | null; +} +export function toClusterTrustBundleProjection(input: c.JSONValue): ClusterTrustBundleProjection { + const obj = c.checkObj(input); + return { + labelSelector: c.readOpt(obj["labelSelector"], MetaV1.toLabelSelector), + name: c.readOpt(obj["name"], c.checkStr), + optional: c.readOpt(obj["optional"], c.checkBool), + path: c.checkStr(obj["path"]), + signerName: c.readOpt(obj["signerName"], c.checkStr), + }} +export function fromClusterTrustBundleProjection(input: ClusterTrustBundleProjection): c.JSONValue { + return { + ...input, + labelSelector: input.labelSelector != null ? MetaV1.fromLabelSelector(input.labelSelector) : undefined, + }} + /** Information about the condition of a component. */ export interface ComponentCondition { error?: string | null; @@ -1008,6 +1051,7 @@ export function fromLifecycle(input: Lifecycle): c.JSONValue { export interface LifecycleHandler { exec?: ExecAction | null; httpGet?: HTTPGetAction | null; + sleep?: SleepAction | null; tcpSocket?: TCPSocketAction | null; } export function toLifecycleHandler(input: c.JSONValue): LifecycleHandler { @@ -1015,6 +1059,7 @@ export function toLifecycleHandler(input: c.JSONValue): LifecycleHandler { return { exec: c.readOpt(obj["exec"], toExecAction), httpGet: c.readOpt(obj["httpGet"], toHTTPGetAction), + sleep: c.readOpt(obj["sleep"], toSleepAction), tcpSocket: c.readOpt(obj["tcpSocket"], toTCPSocketAction), }} export function fromLifecycleHandler(input: LifecycleHandler): c.JSONValue { @@ -1022,6 +1067,7 @@ export function fromLifecycleHandler(input: LifecycleHandler): c.JSONValue { ...input, exec: input.exec != null ? fromExecAction(input.exec) : undefined, httpGet: input.httpGet != null ? fromHTTPGetAction(input.httpGet) : undefined, + sleep: input.sleep != null ? fromSleepAction(input.sleep) : undefined, tcpSocket: input.tcpSocket != null ? fromTCPSocketAction(input.tcpSocket) : undefined, }} @@ -1078,6 +1124,20 @@ export function fromHTTPHeader(input: HTTPHeader): c.JSONValue { ...input, }} +/** SleepAction describes a "sleep" action. */ +export interface SleepAction { + seconds: number; +} +export function toSleepAction(input: c.JSONValue): SleepAction { + const obj = c.checkObj(input); + return { + seconds: c.checkNum(obj["seconds"]), + }} +export function fromSleepAction(input: SleepAction): c.JSONValue { + return { + ...input, + }} + /** TCPSocketAction describes an action based on opening a socket */ export interface TCPSocketAction { host?: string | null; @@ -1221,6 +1281,7 @@ export function fromResourceClaim(input: ResourceClaim): c.JSONValue { /** SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence. */ export interface SecurityContext { allowPrivilegeEscalation?: boolean | null; + appArmorProfile?: AppArmorProfile | null; capabilities?: Capabilities | null; privileged?: boolean | null; procMount?: string | null; @@ -1236,6 +1297,7 @@ export function toSecurityContext(input: c.JSONValue): SecurityContext { const obj = c.checkObj(input); return { allowPrivilegeEscalation: c.readOpt(obj["allowPrivilegeEscalation"], c.checkBool), + appArmorProfile: c.readOpt(obj["appArmorProfile"], toAppArmorProfile), capabilities: c.readOpt(obj["capabilities"], toCapabilities), privileged: c.readOpt(obj["privileged"], c.checkBool), procMount: c.readOpt(obj["procMount"], c.checkStr), @@ -1250,6 +1312,7 @@ export function toSecurityContext(input: c.JSONValue): SecurityContext { export function fromSecurityContext(input: SecurityContext): c.JSONValue { return { ...input, + appArmorProfile: input.appArmorProfile != null ? fromAppArmorProfile(input.appArmorProfile) : undefined, capabilities: input.capabilities != null ? fromCapabilities(input.capabilities) : undefined, seLinuxOptions: input.seLinuxOptions != null ? fromSELinuxOptions(input.seLinuxOptions) : undefined, seccompProfile: input.seccompProfile != null ? fromSeccompProfile(input.seccompProfile) : undefined, @@ -1334,6 +1397,7 @@ export interface VolumeMount { mountPropagation?: string | null; name: string; readOnly?: boolean | null; + recursiveReadOnly?: string | null; subPath?: string | null; subPathExpr?: string | null; } @@ -1344,6 +1408,7 @@ export function toVolumeMount(input: c.JSONValue): VolumeMount { mountPropagation: c.readOpt(obj["mountPropagation"], c.checkStr), name: c.checkStr(obj["name"]), readOnly: c.readOpt(obj["readOnly"], c.checkBool), + recursiveReadOnly: c.readOpt(obj["recursiveReadOnly"], c.checkStr), subPath: c.readOpt(obj["subPath"], c.checkStr), subPathExpr: c.readOpt(obj["subPathExpr"], c.checkStr), }} @@ -1461,6 +1526,7 @@ export interface ContainerStatus { restartCount: number; started?: boolean | null; state?: ContainerState | null; + volumeMounts?: Array | null; } export function toContainerStatus(input: c.JSONValue): ContainerStatus { const obj = c.checkObj(input); @@ -1476,6 +1542,7 @@ export function toContainerStatus(input: c.JSONValue): ContainerStatus { restartCount: c.checkNum(obj["restartCount"]), started: c.readOpt(obj["started"], c.checkBool), state: c.readOpt(obj["state"], toContainerState), + volumeMounts: c.readOpt(obj["volumeMounts"], x => c.readList(x, toVolumeMountStatus)), }} export function fromContainerStatus(input: ContainerStatus): c.JSONValue { return { @@ -1484,6 +1551,27 @@ export function fromContainerStatus(input: ContainerStatus): c.JSONValue { lastState: input.lastState != null ? fromContainerState(input.lastState) : undefined, resources: input.resources != null ? fromResourceRequirements(input.resources) : undefined, state: input.state != null ? fromContainerState(input.state) : undefined, + volumeMounts: input.volumeMounts?.map(fromVolumeMountStatus), + }} + +/** VolumeMountStatus shows status of volume mounts. */ +export interface VolumeMountStatus { + mountPath: string; + name: string; + readOnly?: boolean | null; + recursiveReadOnly?: string | null; +} +export function toVolumeMountStatus(input: c.JSONValue): VolumeMountStatus { + const obj = c.checkObj(input); + return { + mountPath: c.checkStr(obj["mountPath"]), + name: c.checkStr(obj["name"]), + readOnly: c.readOpt(obj["readOnly"], c.checkBool), + recursiveReadOnly: c.readOpt(obj["recursiveReadOnly"], c.checkStr), + }} +export function fromVolumeMountStatus(input: VolumeMountStatus): c.JSONValue { + return { + ...input, }} /** DaemonEndpoint contains information about a single Daemon endpoint. */ @@ -1804,9 +1892,10 @@ export interface PersistentVolumeClaimSpec { accessModes?: Array | null; dataSource?: TypedLocalObjectReference | null; dataSourceRef?: TypedObjectReference | null; - resources?: ResourceRequirements | null; + resources?: VolumeResourceRequirements | null; selector?: MetaV1.LabelSelector | null; storageClassName?: string | null; + volumeAttributesClassName?: string | null; volumeMode?: string | null; volumeName?: string | null; } @@ -1816,9 +1905,10 @@ export function toPersistentVolumeClaimSpec(input: c.JSONValue): PersistentVolum accessModes: c.readOpt(obj["accessModes"], x => c.readList(x, c.checkStr)), dataSource: c.readOpt(obj["dataSource"], toTypedLocalObjectReference), dataSourceRef: c.readOpt(obj["dataSourceRef"], toTypedObjectReference), - resources: c.readOpt(obj["resources"], toResourceRequirements), + resources: c.readOpt(obj["resources"], toVolumeResourceRequirements), selector: c.readOpt(obj["selector"], MetaV1.toLabelSelector), storageClassName: c.readOpt(obj["storageClassName"], c.checkStr), + volumeAttributesClassName: c.readOpt(obj["volumeAttributesClassName"], c.checkStr), volumeMode: c.readOpt(obj["volumeMode"], c.checkStr), volumeName: c.readOpt(obj["volumeName"], c.checkStr), }} @@ -1827,7 +1917,7 @@ export function fromPersistentVolumeClaimSpec(input: PersistentVolumeClaimSpec): ...input, dataSource: input.dataSource != null ? fromTypedLocalObjectReference(input.dataSource) : undefined, dataSourceRef: input.dataSourceRef != null ? fromTypedObjectReference(input.dataSourceRef) : undefined, - resources: input.resources != null ? fromResourceRequirements(input.resources) : undefined, + resources: input.resources != null ? fromVolumeResourceRequirements(input.resources) : undefined, selector: input.selector != null ? MetaV1.fromLabelSelector(input.selector) : undefined, }} @@ -1868,6 +1958,24 @@ export function fromTypedObjectReference(input: TypedObjectReference): c.JSONVal ...input, }} +/** VolumeResourceRequirements describes the storage resource requirements for a volume. */ +export interface VolumeResourceRequirements { + limits?: Record | null; + requests?: Record | null; +} +export function toVolumeResourceRequirements(input: c.JSONValue): VolumeResourceRequirements { + const obj = c.checkObj(input); + return { + limits: c.readOpt(obj["limits"], x => c.readMap(x, c.toQuantity)), + requests: c.readOpt(obj["requests"], x => c.readMap(x, c.toQuantity)), + }} +export function fromVolumeResourceRequirements(input: VolumeResourceRequirements): c.JSONValue { + return { + ...input, + limits: c.writeMap(input.limits, c.fromQuantity), + requests: c.writeMap(input.requests, c.fromQuantity), + }} + /** Event is a report of an event somewhere in the cluster. Events have a limited retention time and triggers and messages may evolve with time. Event consumers should not rely on the timing of an event with a given Reason reflecting a consistent underlying trigger, or the continued existence of events with that Reason. Events should be treated as informative, best-effort, supplemental data. */ export interface Event { apiVersion?: "v1"; @@ -2135,13 +2243,13 @@ export function fromGlusterfsVolumeSource(input: GlusterfsVolumeSource): c.JSONV /** HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file. */ export interface HostAlias { hostnames?: Array | null; - ip?: string | null; + ip: string; } export function toHostAlias(input: c.JSONValue): HostAlias { const obj = c.checkObj(input); return { hostnames: c.readOpt(obj["hostnames"], x => c.readList(x, c.checkStr)), - ip: c.readOpt(obj["ip"], c.checkStr), + ip: c.checkStr(obj["ip"]), }} export function fromHostAlias(input: HostAlias): c.JSONValue { return { @@ -2331,6 +2439,7 @@ export function toLimitRangeList(input: c.JSONValue): LimitRangeList & c.ApiKind export interface LoadBalancerIngress { hostname?: string | null; ip?: string | null; + ipMode?: string | null; ports?: Array | null; } export function toLoadBalancerIngress(input: c.JSONValue): LoadBalancerIngress { @@ -2338,6 +2447,7 @@ export function toLoadBalancerIngress(input: c.JSONValue): LoadBalancerIngress { return { hostname: c.readOpt(obj["hostname"], c.checkStr), ip: c.readOpt(obj["ip"], c.checkStr), + ipMode: c.readOpt(obj["ipMode"], c.checkStr), ports: c.readOpt(obj["ports"], x => c.readList(x, toPortStatus)), }} export function fromLoadBalancerIngress(input: LoadBalancerIngress): c.JSONValue { @@ -2394,6 +2504,22 @@ export function fromLocalVolumeSource(input: LocalVolumeSource): c.JSONValue { ...input, }} +/** ModifyVolumeStatus represents the status object of ControllerModifyVolume operation */ +export interface ModifyVolumeStatus { + status: string; + targetVolumeAttributesClassName?: string | null; +} +export function toModifyVolumeStatus(input: c.JSONValue): ModifyVolumeStatus { + const obj = c.checkObj(input); + return { + status: c.checkStr(obj["status"]), + targetVolumeAttributesClassName: c.readOpt(obj["targetVolumeAttributesClassName"], c.checkStr), + }} +export function fromModifyVolumeStatus(input: ModifyVolumeStatus): c.JSONValue { + return { + ...input, + }} + /** Represents an NFS mount that lasts the lifetime of a pod. NFS volumes do not support ownership management or SELinux relabeling. */ export interface NFSVolumeSource { path: string; @@ -2604,6 +2730,7 @@ export interface NodeStatus { images?: Array | null; nodeInfo?: NodeSystemInfo | null; phase?: string | null; + runtimeHandlers?: Array | null; volumesAttached?: Array | null; volumesInUse?: Array | null; } @@ -2619,6 +2746,7 @@ export function toNodeStatus(input: c.JSONValue): NodeStatus { images: c.readOpt(obj["images"], x => c.readList(x, toContainerImage)), nodeInfo: c.readOpt(obj["nodeInfo"], toNodeSystemInfo), phase: c.readOpt(obj["phase"], c.checkStr), + runtimeHandlers: c.readOpt(obj["runtimeHandlers"], x => c.readList(x, toNodeRuntimeHandler)), volumesAttached: c.readOpt(obj["volumesAttached"], x => c.readList(x, toAttachedVolume)), volumesInUse: c.readOpt(obj["volumesInUse"], x => c.readList(x, c.checkStr)), }} @@ -2633,6 +2761,7 @@ export function fromNodeStatus(input: NodeStatus): c.JSONValue { daemonEndpoints: input.daemonEndpoints != null ? fromNodeDaemonEndpoints(input.daemonEndpoints) : undefined, images: input.images?.map(fromContainerImage), nodeInfo: input.nodeInfo != null ? fromNodeSystemInfo(input.nodeInfo) : undefined, + runtimeHandlers: input.runtimeHandlers?.map(fromNodeRuntimeHandler), volumesAttached: input.volumesAttached?.map(fromAttachedVolume), }} @@ -2748,6 +2877,37 @@ export function fromNodeSystemInfo(input: NodeSystemInfo): c.JSONValue { ...input, }} +/** NodeRuntimeHandler is a set of runtime handler information. */ +export interface NodeRuntimeHandler { + features?: NodeRuntimeHandlerFeatures | null; + name?: string | null; +} +export function toNodeRuntimeHandler(input: c.JSONValue): NodeRuntimeHandler { + const obj = c.checkObj(input); + return { + features: c.readOpt(obj["features"], toNodeRuntimeHandlerFeatures), + name: c.readOpt(obj["name"], c.checkStr), + }} +export function fromNodeRuntimeHandler(input: NodeRuntimeHandler): c.JSONValue { + return { + ...input, + features: input.features != null ? fromNodeRuntimeHandlerFeatures(input.features) : undefined, + }} + +/** NodeRuntimeHandlerFeatures is a set of runtime features. */ +export interface NodeRuntimeHandlerFeatures { + recursiveReadOnlyMounts?: boolean | null; +} +export function toNodeRuntimeHandlerFeatures(input: c.JSONValue): NodeRuntimeHandlerFeatures { + const obj = c.checkObj(input); + return { + recursiveReadOnlyMounts: c.readOpt(obj["recursiveReadOnlyMounts"], c.checkBool), + }} +export function fromNodeRuntimeHandlerFeatures(input: NodeRuntimeHandlerFeatures): c.JSONValue { + return { + ...input, + }} + /** NodeList is the whole list of all Nodes which have been registered with master. */ export interface NodeList extends ListOf { apiVersion?: "v1"; @@ -2816,6 +2976,7 @@ export interface PersistentVolumeSpec { scaleIO?: ScaleIOPersistentVolumeSource | null; storageClassName?: string | null; storageos?: StorageOSPersistentVolumeSource | null; + volumeAttributesClassName?: string | null; volumeMode?: string | null; vsphereVolume?: VsphereVirtualDiskVolumeSource | null; } @@ -2850,6 +3011,7 @@ export function toPersistentVolumeSpec(input: c.JSONValue): PersistentVolumeSpec scaleIO: c.readOpt(obj["scaleIO"], toScaleIOPersistentVolumeSource), storageClassName: c.readOpt(obj["storageClassName"], c.checkStr), storageos: c.readOpt(obj["storageos"], toStorageOSPersistentVolumeSource), + volumeAttributesClassName: c.readOpt(obj["volumeAttributesClassName"], c.checkStr), volumeMode: c.readOpt(obj["volumeMode"], c.checkStr), vsphereVolume: c.readOpt(obj["vsphereVolume"], toVsphereVirtualDiskVolumeSource), }} @@ -3114,6 +3276,8 @@ export interface PersistentVolumeClaimStatus { allocatedResources?: Record | null; capacity?: Record | null; conditions?: Array | null; + currentVolumeAttributesClassName?: string | null; + modifyVolumeStatus?: ModifyVolumeStatus | null; phase?: string | null; } export function toPersistentVolumeClaimStatus(input: c.JSONValue): PersistentVolumeClaimStatus { @@ -3124,6 +3288,8 @@ export function toPersistentVolumeClaimStatus(input: c.JSONValue): PersistentVol allocatedResources: c.readOpt(obj["allocatedResources"], x => c.readMap(x, c.toQuantity)), capacity: c.readOpt(obj["capacity"], x => c.readMap(x, c.toQuantity)), conditions: c.readOpt(obj["conditions"], x => c.readList(x, toPersistentVolumeClaimCondition)), + currentVolumeAttributesClassName: c.readOpt(obj["currentVolumeAttributesClassName"], c.checkStr), + modifyVolumeStatus: c.readOpt(obj["modifyVolumeStatus"], toModifyVolumeStatus), phase: c.readOpt(obj["phase"], c.checkStr), }} export function fromPersistentVolumeClaimStatus(input: PersistentVolumeClaimStatus): c.JSONValue { @@ -3132,6 +3298,7 @@ export function fromPersistentVolumeClaimStatus(input: PersistentVolumeClaimStat allocatedResources: c.writeMap(input.allocatedResources, c.fromQuantity), capacity: c.writeMap(input.capacity, c.fromQuantity), conditions: input.conditions?.map(fromPersistentVolumeClaimCondition), + modifyVolumeStatus: input.modifyVolumeStatus != null ? fromModifyVolumeStatus(input.modifyVolumeStatus) : undefined, }} /** PersistentVolumeClaimCondition contains details about state of pvc */ @@ -3429,6 +3596,7 @@ export function fromPodSchedulingGate(input: PodSchedulingGate): c.JSONValue { /** PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext. */ export interface PodSecurityContext { + appArmorProfile?: AppArmorProfile | null; fsGroup?: number | null; fsGroupChangePolicy?: string | null; runAsGroup?: number | null; @@ -3443,6 +3611,7 @@ export interface PodSecurityContext { export function toPodSecurityContext(input: c.JSONValue): PodSecurityContext { const obj = c.checkObj(input); return { + appArmorProfile: c.readOpt(obj["appArmorProfile"], toAppArmorProfile), fsGroup: c.readOpt(obj["fsGroup"], c.checkNum), fsGroupChangePolicy: c.readOpt(obj["fsGroupChangePolicy"], c.checkStr), runAsGroup: c.readOpt(obj["runAsGroup"], c.checkNum), @@ -3457,6 +3626,7 @@ export function toPodSecurityContext(input: c.JSONValue): PodSecurityContext { export function fromPodSecurityContext(input: PodSecurityContext): c.JSONValue { return { ...input, + appArmorProfile: input.appArmorProfile != null ? fromAppArmorProfile(input.appArmorProfile) : undefined, seLinuxOptions: input.seLinuxOptions != null ? fromSELinuxOptions(input.seLinuxOptions) : undefined, seccompProfile: input.seccompProfile != null ? fromSeccompProfile(input.seccompProfile) : undefined, sysctls: input.sysctls?.map(fromSysctl), @@ -3650,6 +3820,7 @@ export function fromProjectedVolumeSource(input: ProjectedVolumeSource): c.JSONV /** Projection that may be projected along with other supported volume types */ export interface VolumeProjection { + clusterTrustBundle?: ClusterTrustBundleProjection | null; configMap?: ConfigMapProjection | null; downwardAPI?: DownwardAPIProjection | null; secret?: SecretProjection | null; @@ -3658,6 +3829,7 @@ export interface VolumeProjection { export function toVolumeProjection(input: c.JSONValue): VolumeProjection { const obj = c.checkObj(input); return { + clusterTrustBundle: c.readOpt(obj["clusterTrustBundle"], toClusterTrustBundleProjection), configMap: c.readOpt(obj["configMap"], toConfigMapProjection), downwardAPI: c.readOpt(obj["downwardAPI"], toDownwardAPIProjection), secret: c.readOpt(obj["secret"], toSecretProjection), @@ -3666,6 +3838,7 @@ export function toVolumeProjection(input: c.JSONValue): VolumeProjection { export function fromVolumeProjection(input: VolumeProjection): c.JSONValue { return { ...input, + clusterTrustBundle: input.clusterTrustBundle != null ? fromClusterTrustBundleProjection(input.clusterTrustBundle) : undefined, configMap: input.configMap != null ? fromConfigMapProjection(input.configMap) : undefined, downwardAPI: input.downwardAPI != null ? fromDownwardAPIProjection(input.downwardAPI) : undefined, secret: input.secret != null ? fromSecretProjection(input.secret) : undefined, @@ -4294,6 +4467,7 @@ export interface ServiceSpec { selector?: Record | null; sessionAffinity?: string | null; sessionAffinityConfig?: SessionAffinityConfig | null; + trafficDistribution?: string | null; type?: string | null; } export function toServiceSpec(input: c.JSONValue): ServiceSpec { @@ -4317,6 +4491,7 @@ export function toServiceSpec(input: c.JSONValue): ServiceSpec { selector: c.readOpt(obj["selector"], x => c.readMap(x, c.checkStr)), sessionAffinity: c.readOpt(obj["sessionAffinity"], c.checkStr), sessionAffinityConfig: c.readOpt(obj["sessionAffinityConfig"], toSessionAffinityConfig), + trafficDistribution: c.readOpt(obj["trafficDistribution"], c.checkStr), type: c.readOpt(obj["type"], c.checkStr), }} export function fromServiceSpec(input: ServiceSpec): c.JSONValue { diff --git a/lib/builtin/flowcontrol.apiserver.k8s.io@v1beta2/mod.ts b/lib/builtin/flowcontrol.apiserver.k8s.io@v1/mod.ts similarity index 65% rename from lib/builtin/flowcontrol.apiserver.k8s.io@v1beta2/mod.ts rename to lib/builtin/flowcontrol.apiserver.k8s.io@v1/mod.ts index 94e7c0c..fdf80eb 100644 --- a/lib/builtin/flowcontrol.apiserver.k8s.io@v1beta2/mod.ts +++ b/lib/builtin/flowcontrol.apiserver.k8s.io@v1/mod.ts @@ -1,21 +1,21 @@ export * from "./structs.ts"; -// Autogenerated API file for FlowcontrolApiserverV1beta2 +// Autogenerated API file for FlowcontrolApiserverV1 import * as c from "../../common.ts"; import * as operations from "../../operations.ts"; import * as MetaV1 from "../meta@v1/structs.ts"; -import * as FlowcontrolApiserverV1beta2 from "./structs.ts"; +import * as FlowcontrolApiserverV1 from "./structs.ts"; -export class FlowcontrolApiserverV1beta2Api { +export class FlowcontrolApiserverV1Api { #client: c.RestClient; - #root = "/apis/flowcontrol.apiserver.k8s.io/v1beta2/"; + #root = "/apis/flowcontrol.apiserver.k8s.io/v1/"; constructor(client: c.RestClient) { this.#client = client; } async getFlowSchemaList( opts: operations.GetListOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "GET", path: `${this.#root}flowschemas`, @@ -23,12 +23,12 @@ export class FlowcontrolApiserverV1beta2Api { querystring: operations.formatGetListOpts(opts), abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toFlowSchemaList(resp); + return FlowcontrolApiserverV1.toFlowSchemaList(resp); } async watchFlowSchemaList( opts: operations.WatchListOpts = {}, - ): Promise> { + ): Promise> { const resp = await this.#client.performRequest({ method: "GET", path: `${this.#root}flowschemas`, @@ -37,27 +37,27 @@ export class FlowcontrolApiserverV1beta2Api { querystring: operations.formatWatchListOpts(opts), abortSignal: opts.abortSignal, }); - return resp.pipeThrough(new c.WatchEventTransformer(FlowcontrolApiserverV1beta2.toFlowSchema, MetaV1.toStatus)); + return resp.pipeThrough(new c.WatchEventTransformer(FlowcontrolApiserverV1.toFlowSchema, MetaV1.toStatus)); } async createFlowSchema( - body: FlowcontrolApiserverV1beta2.FlowSchema, + body: FlowcontrolApiserverV1.FlowSchema, opts: operations.PutOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "POST", path: `${this.#root}flowschemas`, expectJson: true, querystring: operations.formatPutOpts(opts), - bodyJson: FlowcontrolApiserverV1beta2.fromFlowSchema(body), + bodyJson: FlowcontrolApiserverV1.fromFlowSchema(body), abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toFlowSchema(resp); + return FlowcontrolApiserverV1.toFlowSchema(resp); } async deleteFlowSchemaList( opts: operations.DeleteListOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "DELETE", path: `${this.#root}flowschemas`, @@ -65,26 +65,26 @@ export class FlowcontrolApiserverV1beta2Api { querystring: operations.formatDeleteListOpts(opts), abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toFlowSchemaList(resp); + return FlowcontrolApiserverV1.toFlowSchemaList(resp); } async getFlowSchema( name: string, opts: operations.NoOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "GET", path: `${this.#root}flowschemas/${name}`, expectJson: true, abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toFlowSchema(resp); + return FlowcontrolApiserverV1.toFlowSchema(resp); } async deleteFlowSchema( name: string, opts: operations.DeleteOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "DELETE", path: `${this.#root}flowschemas/${name}`, @@ -93,93 +93,93 @@ export class FlowcontrolApiserverV1beta2Api { abortSignal: opts.abortSignal, }); if (c.isStatusKind(resp)) return MetaV1.toStatus(resp); - return FlowcontrolApiserverV1beta2.toFlowSchema(resp); + return FlowcontrolApiserverV1.toFlowSchema(resp); } async replaceFlowSchema( name: string, - body: FlowcontrolApiserverV1beta2.FlowSchema, + body: FlowcontrolApiserverV1.FlowSchema, opts: operations.PutOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "PUT", path: `${this.#root}flowschemas/${name}`, expectJson: true, querystring: operations.formatPutOpts(opts), - bodyJson: FlowcontrolApiserverV1beta2.fromFlowSchema(body), + bodyJson: FlowcontrolApiserverV1.fromFlowSchema(body), abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toFlowSchema(resp); + return FlowcontrolApiserverV1.toFlowSchema(resp); } async patchFlowSchema( name: string, type: c.PatchType, - body: FlowcontrolApiserverV1beta2.FlowSchema | c.JsonPatch, + body: FlowcontrolApiserverV1.FlowSchema | c.JsonPatch, opts: operations.PatchOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "PATCH", path: `${this.#root}flowschemas/${name}`, expectJson: true, querystring: operations.formatPatchOpts(opts), contentType: c.getPatchContentType(type), - bodyJson: Array.isArray(body) ? body : FlowcontrolApiserverV1beta2.fromFlowSchema(body), + bodyJson: Array.isArray(body) ? body : FlowcontrolApiserverV1.fromFlowSchema(body), abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toFlowSchema(resp); + return FlowcontrolApiserverV1.toFlowSchema(resp); } async getFlowSchemaStatus( name: string, opts: operations.NoOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "GET", path: `${this.#root}flowschemas/${name}/status`, expectJson: true, abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toFlowSchema(resp); + return FlowcontrolApiserverV1.toFlowSchema(resp); } async replaceFlowSchemaStatus( name: string, - body: FlowcontrolApiserverV1beta2.FlowSchema, + body: FlowcontrolApiserverV1.FlowSchema, opts: operations.PutOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "PUT", path: `${this.#root}flowschemas/${name}/status`, expectJson: true, querystring: operations.formatPutOpts(opts), - bodyJson: FlowcontrolApiserverV1beta2.fromFlowSchema(body), + bodyJson: FlowcontrolApiserverV1.fromFlowSchema(body), abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toFlowSchema(resp); + return FlowcontrolApiserverV1.toFlowSchema(resp); } async patchFlowSchemaStatus( name: string, type: c.PatchType, - body: FlowcontrolApiserverV1beta2.FlowSchema | c.JsonPatch, + body: FlowcontrolApiserverV1.FlowSchema | c.JsonPatch, opts: operations.PatchOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "PATCH", path: `${this.#root}flowschemas/${name}/status`, expectJson: true, querystring: operations.formatPatchOpts(opts), contentType: c.getPatchContentType(type), - bodyJson: Array.isArray(body) ? body : FlowcontrolApiserverV1beta2.fromFlowSchema(body), + bodyJson: Array.isArray(body) ? body : FlowcontrolApiserverV1.fromFlowSchema(body), abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toFlowSchema(resp); + return FlowcontrolApiserverV1.toFlowSchema(resp); } async getPriorityLevelConfigurationList( opts: operations.GetListOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "GET", path: `${this.#root}prioritylevelconfigurations`, @@ -187,12 +187,12 @@ export class FlowcontrolApiserverV1beta2Api { querystring: operations.formatGetListOpts(opts), abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toPriorityLevelConfigurationList(resp); + return FlowcontrolApiserverV1.toPriorityLevelConfigurationList(resp); } async watchPriorityLevelConfigurationList( opts: operations.WatchListOpts = {}, - ): Promise> { + ): Promise> { const resp = await this.#client.performRequest({ method: "GET", path: `${this.#root}prioritylevelconfigurations`, @@ -201,27 +201,27 @@ export class FlowcontrolApiserverV1beta2Api { querystring: operations.formatWatchListOpts(opts), abortSignal: opts.abortSignal, }); - return resp.pipeThrough(new c.WatchEventTransformer(FlowcontrolApiserverV1beta2.toPriorityLevelConfiguration, MetaV1.toStatus)); + return resp.pipeThrough(new c.WatchEventTransformer(FlowcontrolApiserverV1.toPriorityLevelConfiguration, MetaV1.toStatus)); } async createPriorityLevelConfiguration( - body: FlowcontrolApiserverV1beta2.PriorityLevelConfiguration, + body: FlowcontrolApiserverV1.PriorityLevelConfiguration, opts: operations.PutOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "POST", path: `${this.#root}prioritylevelconfigurations`, expectJson: true, querystring: operations.formatPutOpts(opts), - bodyJson: FlowcontrolApiserverV1beta2.fromPriorityLevelConfiguration(body), + bodyJson: FlowcontrolApiserverV1.fromPriorityLevelConfiguration(body), abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toPriorityLevelConfiguration(resp); + return FlowcontrolApiserverV1.toPriorityLevelConfiguration(resp); } async deletePriorityLevelConfigurationList( opts: operations.DeleteListOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "DELETE", path: `${this.#root}prioritylevelconfigurations`, @@ -229,26 +229,26 @@ export class FlowcontrolApiserverV1beta2Api { querystring: operations.formatDeleteListOpts(opts), abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toPriorityLevelConfigurationList(resp); + return FlowcontrolApiserverV1.toPriorityLevelConfigurationList(resp); } async getPriorityLevelConfiguration( name: string, opts: operations.NoOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "GET", path: `${this.#root}prioritylevelconfigurations/${name}`, expectJson: true, abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toPriorityLevelConfiguration(resp); + return FlowcontrolApiserverV1.toPriorityLevelConfiguration(resp); } async deletePriorityLevelConfiguration( name: string, opts: operations.DeleteOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "DELETE", path: `${this.#root}prioritylevelconfigurations/${name}`, @@ -257,88 +257,88 @@ export class FlowcontrolApiserverV1beta2Api { abortSignal: opts.abortSignal, }); if (c.isStatusKind(resp)) return MetaV1.toStatus(resp); - return FlowcontrolApiserverV1beta2.toPriorityLevelConfiguration(resp); + return FlowcontrolApiserverV1.toPriorityLevelConfiguration(resp); } async replacePriorityLevelConfiguration( name: string, - body: FlowcontrolApiserverV1beta2.PriorityLevelConfiguration, + body: FlowcontrolApiserverV1.PriorityLevelConfiguration, opts: operations.PutOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "PUT", path: `${this.#root}prioritylevelconfigurations/${name}`, expectJson: true, querystring: operations.formatPutOpts(opts), - bodyJson: FlowcontrolApiserverV1beta2.fromPriorityLevelConfiguration(body), + bodyJson: FlowcontrolApiserverV1.fromPriorityLevelConfiguration(body), abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toPriorityLevelConfiguration(resp); + return FlowcontrolApiserverV1.toPriorityLevelConfiguration(resp); } async patchPriorityLevelConfiguration( name: string, type: c.PatchType, - body: FlowcontrolApiserverV1beta2.PriorityLevelConfiguration | c.JsonPatch, + body: FlowcontrolApiserverV1.PriorityLevelConfiguration | c.JsonPatch, opts: operations.PatchOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "PATCH", path: `${this.#root}prioritylevelconfigurations/${name}`, expectJson: true, querystring: operations.formatPatchOpts(opts), contentType: c.getPatchContentType(type), - bodyJson: Array.isArray(body) ? body : FlowcontrolApiserverV1beta2.fromPriorityLevelConfiguration(body), + bodyJson: Array.isArray(body) ? body : FlowcontrolApiserverV1.fromPriorityLevelConfiguration(body), abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toPriorityLevelConfiguration(resp); + return FlowcontrolApiserverV1.toPriorityLevelConfiguration(resp); } async getPriorityLevelConfigurationStatus( name: string, opts: operations.NoOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "GET", path: `${this.#root}prioritylevelconfigurations/${name}/status`, expectJson: true, abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toPriorityLevelConfiguration(resp); + return FlowcontrolApiserverV1.toPriorityLevelConfiguration(resp); } async replacePriorityLevelConfigurationStatus( name: string, - body: FlowcontrolApiserverV1beta2.PriorityLevelConfiguration, + body: FlowcontrolApiserverV1.PriorityLevelConfiguration, opts: operations.PutOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "PUT", path: `${this.#root}prioritylevelconfigurations/${name}/status`, expectJson: true, querystring: operations.formatPutOpts(opts), - bodyJson: FlowcontrolApiserverV1beta2.fromPriorityLevelConfiguration(body), + bodyJson: FlowcontrolApiserverV1.fromPriorityLevelConfiguration(body), abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toPriorityLevelConfiguration(resp); + return FlowcontrolApiserverV1.toPriorityLevelConfiguration(resp); } async patchPriorityLevelConfigurationStatus( name: string, type: c.PatchType, - body: FlowcontrolApiserverV1beta2.PriorityLevelConfiguration | c.JsonPatch, + body: FlowcontrolApiserverV1.PriorityLevelConfiguration | c.JsonPatch, opts: operations.PatchOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "PATCH", path: `${this.#root}prioritylevelconfigurations/${name}/status`, expectJson: true, querystring: operations.formatPatchOpts(opts), contentType: c.getPatchContentType(type), - bodyJson: Array.isArray(body) ? body : FlowcontrolApiserverV1beta2.fromPriorityLevelConfiguration(body), + bodyJson: Array.isArray(body) ? body : FlowcontrolApiserverV1.fromPriorityLevelConfiguration(body), abortSignal: opts.abortSignal, }); - return FlowcontrolApiserverV1beta2.toPriorityLevelConfiguration(resp); + return FlowcontrolApiserverV1.toPriorityLevelConfiguration(resp); } } diff --git a/lib/builtin/flowcontrol.apiserver.k8s.io@v1beta2/structs.ts b/lib/builtin/flowcontrol.apiserver.k8s.io@v1/structs.ts similarity index 96% rename from lib/builtin/flowcontrol.apiserver.k8s.io@v1beta2/structs.ts rename to lib/builtin/flowcontrol.apiserver.k8s.io@v1/structs.ts index f08f9ec..4ba1c6a 100644 --- a/lib/builtin/flowcontrol.apiserver.k8s.io@v1beta2/structs.ts +++ b/lib/builtin/flowcontrol.apiserver.k8s.io@v1/structs.ts @@ -1,4 +1,4 @@ -// Autogenerated Schema file for FlowcontrolApiserverV1beta2 +// Autogenerated Schema file for FlowcontrolApiserverV1 import * as c from "../../common.ts"; import * as MetaV1 from "../meta@v1/structs.ts"; @@ -39,7 +39,7 @@ export function fromFlowDistinguisherMethod(input: FlowDistinguisherMethod): c.J /** FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". */ export interface FlowSchema { - apiVersion?: "flowcontrol.apiserver.k8s.io/v1beta2"; + apiVersion?: "flowcontrol.apiserver.k8s.io/v1"; kind?: "FlowSchema"; metadata?: MetaV1.ObjectMeta | null; spec?: FlowSchemaSpec | null; @@ -48,14 +48,14 @@ export interface FlowSchema { export function toFlowSchema(input: c.JSONValue): FlowSchema & c.ApiKind { const obj = c.checkObj(input); return { - ...c.assertOrAddApiVersionAndKind(obj, "flowcontrol.apiserver.k8s.io/v1beta2", "FlowSchema"), + ...c.assertOrAddApiVersionAndKind(obj, "flowcontrol.apiserver.k8s.io/v1", "FlowSchema"), metadata: c.readOpt(obj["metadata"], MetaV1.toObjectMeta), spec: c.readOpt(obj["spec"], toFlowSchemaSpec), status: c.readOpt(obj["status"], toFlowSchemaStatus), }} export function fromFlowSchema(input: FlowSchema): c.JSONValue { return { - ...c.assertOrAddApiVersionAndKind(input, "flowcontrol.apiserver.k8s.io/v1beta2", "FlowSchema"), + ...c.assertOrAddApiVersionAndKind(input, "flowcontrol.apiserver.k8s.io/v1", "FlowSchema"), ...input, metadata: input.metadata != null ? MetaV1.fromObjectMeta(input.metadata) : undefined, spec: input.spec != null ? fromFlowSchemaSpec(input.spec) : undefined, @@ -265,13 +265,13 @@ export function fromFlowSchemaCondition(input: FlowSchemaCondition): c.JSONValue /** FlowSchemaList is a list of FlowSchema objects. */ export interface FlowSchemaList extends ListOf { - apiVersion?: "flowcontrol.apiserver.k8s.io/v1beta2"; + apiVersion?: "flowcontrol.apiserver.k8s.io/v1"; kind?: "FlowSchemaList"; }; export function toFlowSchemaList(input: c.JSONValue): FlowSchemaList & c.ApiKind { const obj = c.checkObj(input); return { - ...c.assertOrAddApiVersionAndKind(obj, "flowcontrol.apiserver.k8s.io/v1beta2", "FlowSchemaList"), + ...c.assertOrAddApiVersionAndKind(obj, "flowcontrol.apiserver.k8s.io/v1", "FlowSchemaList"), metadata: MetaV1.toListMeta(obj.metadata), items: c.readList(obj.items, toFlowSchema), }} @@ -315,18 +315,18 @@ export function fromQueuingConfiguration(input: QueuingConfiguration): c.JSONVal - How are requests for this priority level limited? - What should be done with requests that exceed the limit? */ export interface LimitedPriorityLevelConfiguration { - assuredConcurrencyShares?: number | null; borrowingLimitPercent?: number | null; lendablePercent?: number | null; limitResponse?: LimitResponse | null; + nominalConcurrencyShares?: number | null; } export function toLimitedPriorityLevelConfiguration(input: c.JSONValue): LimitedPriorityLevelConfiguration { const obj = c.checkObj(input); return { - assuredConcurrencyShares: c.readOpt(obj["assuredConcurrencyShares"], c.checkNum), borrowingLimitPercent: c.readOpt(obj["borrowingLimitPercent"], c.checkNum), lendablePercent: c.readOpt(obj["lendablePercent"], c.checkNum), limitResponse: c.readOpt(obj["limitResponse"], toLimitResponse), + nominalConcurrencyShares: c.readOpt(obj["nominalConcurrencyShares"], c.checkNum), }} export function fromLimitedPriorityLevelConfiguration(input: LimitedPriorityLevelConfiguration): c.JSONValue { return { @@ -336,7 +336,7 @@ export function fromLimitedPriorityLevelConfiguration(input: LimitedPriorityLeve /** PriorityLevelConfiguration represents the configuration of a priority level. */ export interface PriorityLevelConfiguration { - apiVersion?: "flowcontrol.apiserver.k8s.io/v1beta2"; + apiVersion?: "flowcontrol.apiserver.k8s.io/v1"; kind?: "PriorityLevelConfiguration"; metadata?: MetaV1.ObjectMeta | null; spec?: PriorityLevelConfigurationSpec | null; @@ -345,14 +345,14 @@ export interface PriorityLevelConfiguration { export function toPriorityLevelConfiguration(input: c.JSONValue): PriorityLevelConfiguration & c.ApiKind { const obj = c.checkObj(input); return { - ...c.assertOrAddApiVersionAndKind(obj, "flowcontrol.apiserver.k8s.io/v1beta2", "PriorityLevelConfiguration"), + ...c.assertOrAddApiVersionAndKind(obj, "flowcontrol.apiserver.k8s.io/v1", "PriorityLevelConfiguration"), metadata: c.readOpt(obj["metadata"], MetaV1.toObjectMeta), spec: c.readOpt(obj["spec"], toPriorityLevelConfigurationSpec), status: c.readOpt(obj["status"], toPriorityLevelConfigurationStatus), }} export function fromPriorityLevelConfiguration(input: PriorityLevelConfiguration): c.JSONValue { return { - ...c.assertOrAddApiVersionAndKind(input, "flowcontrol.apiserver.k8s.io/v1beta2", "PriorityLevelConfiguration"), + ...c.assertOrAddApiVersionAndKind(input, "flowcontrol.apiserver.k8s.io/v1", "PriorityLevelConfiguration"), ...input, metadata: input.metadata != null ? MetaV1.fromObjectMeta(input.metadata) : undefined, spec: input.spec != null ? fromPriorityLevelConfigurationSpec(input.spec) : undefined, @@ -419,13 +419,13 @@ export function fromPriorityLevelConfigurationCondition(input: PriorityLevelConf /** PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects. */ export interface PriorityLevelConfigurationList extends ListOf { - apiVersion?: "flowcontrol.apiserver.k8s.io/v1beta2"; + apiVersion?: "flowcontrol.apiserver.k8s.io/v1"; kind?: "PriorityLevelConfigurationList"; }; export function toPriorityLevelConfigurationList(input: c.JSONValue): PriorityLevelConfigurationList & c.ApiKind { const obj = c.checkObj(input); return { - ...c.assertOrAddApiVersionAndKind(obj, "flowcontrol.apiserver.k8s.io/v1beta2", "PriorityLevelConfigurationList"), + ...c.assertOrAddApiVersionAndKind(obj, "flowcontrol.apiserver.k8s.io/v1", "PriorityLevelConfigurationList"), metadata: MetaV1.toListMeta(obj.metadata), items: c.readList(obj.items, toPriorityLevelConfiguration), }} diff --git a/lib/builtin/internal.apiserver.k8s.io@v1alpha1/structs.ts b/lib/builtin/internal.apiserver.k8s.io@v1alpha1/structs.ts index 0c9ac9c..3316f38 100644 --- a/lib/builtin/internal.apiserver.k8s.io@v1alpha1/structs.ts +++ b/lib/builtin/internal.apiserver.k8s.io@v1alpha1/structs.ts @@ -87,7 +87,7 @@ export function fromStorageVersionStatus(input: StorageVersionStatus): c.JSONVal /** Describes the state of the storageVersion at a certain point. */ export interface StorageVersionCondition { lastTransitionTime?: c.Time | null; - message?: string | null; + message: string; observedGeneration?: number | null; reason: string; status: string; @@ -97,7 +97,7 @@ export function toStorageVersionCondition(input: c.JSONValue): StorageVersionCon const obj = c.checkObj(input); return { lastTransitionTime: c.readOpt(obj["lastTransitionTime"], c.toTime), - message: c.readOpt(obj["message"], c.checkStr), + message: c.checkStr(obj["message"]), observedGeneration: c.readOpt(obj["observedGeneration"], c.checkNum), reason: c.checkStr(obj["reason"]), status: c.checkStr(obj["status"]), diff --git a/lib/builtin/networking.k8s.io@v1alpha1/mod.ts b/lib/builtin/networking.k8s.io@v1alpha1/mod.ts index 945842d..b48b9ae 100644 --- a/lib/builtin/networking.k8s.io@v1alpha1/mod.ts +++ b/lib/builtin/networking.k8s.io@v1alpha1/mod.ts @@ -13,238 +13,285 @@ export class NetworkingV1alpha1Api { this.#client = client; } - async getClusterCIDRList( + async getIPAddressList( opts: operations.GetListOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "GET", - path: `${this.#root}clustercidrs`, + path: `${this.#root}ipaddresses`, expectJson: true, querystring: operations.formatGetListOpts(opts), abortSignal: opts.abortSignal, }); - return NetworkingV1alpha1.toClusterCIDRList(resp); + return NetworkingV1alpha1.toIPAddressList(resp); } - async watchClusterCIDRList( + async watchIPAddressList( opts: operations.WatchListOpts = {}, - ): Promise> { + ): Promise> { const resp = await this.#client.performRequest({ method: "GET", - path: `${this.#root}clustercidrs`, + path: `${this.#root}ipaddresses`, expectJson: true, expectStream: true, querystring: operations.formatWatchListOpts(opts), abortSignal: opts.abortSignal, }); - return resp.pipeThrough(new c.WatchEventTransformer(NetworkingV1alpha1.toClusterCIDR, MetaV1.toStatus)); + return resp.pipeThrough(new c.WatchEventTransformer(NetworkingV1alpha1.toIPAddress, MetaV1.toStatus)); } - async createClusterCIDR( - body: NetworkingV1alpha1.ClusterCIDR, + async createIPAddress( + body: NetworkingV1alpha1.IPAddress, opts: operations.PutOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "POST", - path: `${this.#root}clustercidrs`, + path: `${this.#root}ipaddresses`, expectJson: true, querystring: operations.formatPutOpts(opts), - bodyJson: NetworkingV1alpha1.fromClusterCIDR(body), + bodyJson: NetworkingV1alpha1.fromIPAddress(body), abortSignal: opts.abortSignal, }); - return NetworkingV1alpha1.toClusterCIDR(resp); + return NetworkingV1alpha1.toIPAddress(resp); } - async deleteClusterCIDRList( + async deleteIPAddressList( opts: operations.DeleteListOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "DELETE", - path: `${this.#root}clustercidrs`, + path: `${this.#root}ipaddresses`, expectJson: true, querystring: operations.formatDeleteListOpts(opts), abortSignal: opts.abortSignal, }); - return NetworkingV1alpha1.toClusterCIDRList(resp); + return NetworkingV1alpha1.toIPAddressList(resp); } - async getClusterCIDR( + async getIPAddress( name: string, opts: operations.NoOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "GET", - path: `${this.#root}clustercidrs/${name}`, + path: `${this.#root}ipaddresses/${name}`, expectJson: true, abortSignal: opts.abortSignal, }); - return NetworkingV1alpha1.toClusterCIDR(resp); + return NetworkingV1alpha1.toIPAddress(resp); } - async deleteClusterCIDR( + async deleteIPAddress( name: string, opts: operations.DeleteOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "DELETE", - path: `${this.#root}clustercidrs/${name}`, + path: `${this.#root}ipaddresses/${name}`, expectJson: true, querystring: operations.formatDeleteOpts(opts), abortSignal: opts.abortSignal, }); if (c.isStatusKind(resp)) return MetaV1.toStatus(resp); - return NetworkingV1alpha1.toClusterCIDR(resp); + return NetworkingV1alpha1.toIPAddress(resp); } - async replaceClusterCIDR( + async replaceIPAddress( name: string, - body: NetworkingV1alpha1.ClusterCIDR, + body: NetworkingV1alpha1.IPAddress, opts: operations.PutOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "PUT", - path: `${this.#root}clustercidrs/${name}`, + path: `${this.#root}ipaddresses/${name}`, expectJson: true, querystring: operations.formatPutOpts(opts), - bodyJson: NetworkingV1alpha1.fromClusterCIDR(body), + bodyJson: NetworkingV1alpha1.fromIPAddress(body), abortSignal: opts.abortSignal, }); - return NetworkingV1alpha1.toClusterCIDR(resp); + return NetworkingV1alpha1.toIPAddress(resp); } - async patchClusterCIDR( + async patchIPAddress( name: string, type: c.PatchType, - body: NetworkingV1alpha1.ClusterCIDR | c.JsonPatch, + body: NetworkingV1alpha1.IPAddress | c.JsonPatch, opts: operations.PatchOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "PATCH", - path: `${this.#root}clustercidrs/${name}`, + path: `${this.#root}ipaddresses/${name}`, expectJson: true, querystring: operations.formatPatchOpts(opts), contentType: c.getPatchContentType(type), - bodyJson: Array.isArray(body) ? body : NetworkingV1alpha1.fromClusterCIDR(body), + bodyJson: Array.isArray(body) ? body : NetworkingV1alpha1.fromIPAddress(body), abortSignal: opts.abortSignal, }); - return NetworkingV1alpha1.toClusterCIDR(resp); + return NetworkingV1alpha1.toIPAddress(resp); } - async getIPAddressList( + async getServiceCIDRList( opts: operations.GetListOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "GET", - path: `${this.#root}ipaddresses`, + path: `${this.#root}servicecidrs`, expectJson: true, querystring: operations.formatGetListOpts(opts), abortSignal: opts.abortSignal, }); - return NetworkingV1alpha1.toIPAddressList(resp); + return NetworkingV1alpha1.toServiceCIDRList(resp); } - async watchIPAddressList( + async watchServiceCIDRList( opts: operations.WatchListOpts = {}, - ): Promise> { + ): Promise> { const resp = await this.#client.performRequest({ method: "GET", - path: `${this.#root}ipaddresses`, + path: `${this.#root}servicecidrs`, expectJson: true, expectStream: true, querystring: operations.formatWatchListOpts(opts), abortSignal: opts.abortSignal, }); - return resp.pipeThrough(new c.WatchEventTransformer(NetworkingV1alpha1.toIPAddress, MetaV1.toStatus)); + return resp.pipeThrough(new c.WatchEventTransformer(NetworkingV1alpha1.toServiceCIDR, MetaV1.toStatus)); } - async createIPAddress( - body: NetworkingV1alpha1.IPAddress, + async createServiceCIDR( + body: NetworkingV1alpha1.ServiceCIDR, opts: operations.PutOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "POST", - path: `${this.#root}ipaddresses`, + path: `${this.#root}servicecidrs`, expectJson: true, querystring: operations.formatPutOpts(opts), - bodyJson: NetworkingV1alpha1.fromIPAddress(body), + bodyJson: NetworkingV1alpha1.fromServiceCIDR(body), abortSignal: opts.abortSignal, }); - return NetworkingV1alpha1.toIPAddress(resp); + return NetworkingV1alpha1.toServiceCIDR(resp); } - async deleteIPAddressList( + async deleteServiceCIDRList( opts: operations.DeleteListOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "DELETE", - path: `${this.#root}ipaddresses`, + path: `${this.#root}servicecidrs`, expectJson: true, querystring: operations.formatDeleteListOpts(opts), abortSignal: opts.abortSignal, }); - return NetworkingV1alpha1.toIPAddressList(resp); + return NetworkingV1alpha1.toServiceCIDRList(resp); } - async getIPAddress( + async getServiceCIDR( name: string, opts: operations.NoOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "GET", - path: `${this.#root}ipaddresses/${name}`, + path: `${this.#root}servicecidrs/${name}`, expectJson: true, abortSignal: opts.abortSignal, }); - return NetworkingV1alpha1.toIPAddress(resp); + return NetworkingV1alpha1.toServiceCIDR(resp); } - async deleteIPAddress( + async deleteServiceCIDR( name: string, opts: operations.DeleteOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "DELETE", - path: `${this.#root}ipaddresses/${name}`, + path: `${this.#root}servicecidrs/${name}`, expectJson: true, querystring: operations.formatDeleteOpts(opts), abortSignal: opts.abortSignal, }); if (c.isStatusKind(resp)) return MetaV1.toStatus(resp); - return NetworkingV1alpha1.toIPAddress(resp); + return NetworkingV1alpha1.toServiceCIDR(resp); } - async replaceIPAddress( + async replaceServiceCIDR( name: string, - body: NetworkingV1alpha1.IPAddress, + body: NetworkingV1alpha1.ServiceCIDR, opts: operations.PutOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "PUT", - path: `${this.#root}ipaddresses/${name}`, + path: `${this.#root}servicecidrs/${name}`, expectJson: true, querystring: operations.formatPutOpts(opts), - bodyJson: NetworkingV1alpha1.fromIPAddress(body), + bodyJson: NetworkingV1alpha1.fromServiceCIDR(body), abortSignal: opts.abortSignal, }); - return NetworkingV1alpha1.toIPAddress(resp); + return NetworkingV1alpha1.toServiceCIDR(resp); } - async patchIPAddress( + async patchServiceCIDR( name: string, type: c.PatchType, - body: NetworkingV1alpha1.IPAddress | c.JsonPatch, + body: NetworkingV1alpha1.ServiceCIDR | c.JsonPatch, opts: operations.PatchOpts = {}, - ): Promise { + ): Promise { const resp = await this.#client.performRequest({ method: "PATCH", - path: `${this.#root}ipaddresses/${name}`, + path: `${this.#root}servicecidrs/${name}`, expectJson: true, querystring: operations.formatPatchOpts(opts), contentType: c.getPatchContentType(type), - bodyJson: Array.isArray(body) ? body : NetworkingV1alpha1.fromIPAddress(body), + bodyJson: Array.isArray(body) ? body : NetworkingV1alpha1.fromServiceCIDR(body), abortSignal: opts.abortSignal, }); - return NetworkingV1alpha1.toIPAddress(resp); + return NetworkingV1alpha1.toServiceCIDR(resp); + } + + async getServiceCIDRStatus( + name: string, + opts: operations.NoOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}servicecidrs/${name}/status`, + expectJson: true, + abortSignal: opts.abortSignal, + }); + return NetworkingV1alpha1.toServiceCIDR(resp); + } + + async replaceServiceCIDRStatus( + name: string, + body: NetworkingV1alpha1.ServiceCIDR, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PUT", + path: `${this.#root}servicecidrs/${name}/status`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: NetworkingV1alpha1.fromServiceCIDR(body), + abortSignal: opts.abortSignal, + }); + return NetworkingV1alpha1.toServiceCIDR(resp); + } + + async patchServiceCIDRStatus( + name: string, + type: c.PatchType, + body: NetworkingV1alpha1.ServiceCIDR | c.JsonPatch, + opts: operations.PatchOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PATCH", + path: `${this.#root}servicecidrs/${name}/status`, + expectJson: true, + querystring: operations.formatPatchOpts(opts), + contentType: c.getPatchContentType(type), + bodyJson: Array.isArray(body) ? body : NetworkingV1alpha1.fromServiceCIDR(body), + abortSignal: opts.abortSignal, + }); + return NetworkingV1alpha1.toServiceCIDR(resp); } } diff --git a/lib/builtin/networking.k8s.io@v1alpha1/structs.ts b/lib/builtin/networking.k8s.io@v1alpha1/structs.ts index c6ce877..6b771e9 100644 --- a/lib/builtin/networking.k8s.io@v1alpha1/structs.ts +++ b/lib/builtin/networking.k8s.io@v1alpha1/structs.ts @@ -1,69 +1,12 @@ // Autogenerated Schema file for NetworkingV1alpha1 import * as c from "../../common.ts"; -import * as CoreV1 from "../core@v1/structs.ts"; import * as MetaV1 from "../meta@v1/structs.ts"; type ListOf = { metadata: MetaV1.ListMeta; items: Array; }; -/** ClusterCIDR represents a single configuration for per-Node Pod CIDR allocations when the MultiCIDRRangeAllocator is enabled (see the config for kube-controller-manager). A cluster may have any number of ClusterCIDR resources, all of which will be considered when allocating a CIDR for a Node. A ClusterCIDR is eligible to be used for a given Node when the node selector matches the node in question and has free CIDRs to allocate. In case of multiple matching ClusterCIDR resources, the allocator will attempt to break ties using internal heuristics, but any ClusterCIDR whose node selector matches the Node may be used. */ -export interface ClusterCIDR { - apiVersion?: "networking.k8s.io/v1alpha1"; - kind?: "ClusterCIDR"; - metadata?: MetaV1.ObjectMeta | null; - spec?: ClusterCIDRSpec | null; -} -export function toClusterCIDR(input: c.JSONValue): ClusterCIDR & c.ApiKind { - const obj = c.checkObj(input); - return { - ...c.assertOrAddApiVersionAndKind(obj, "networking.k8s.io/v1alpha1", "ClusterCIDR"), - metadata: c.readOpt(obj["metadata"], MetaV1.toObjectMeta), - spec: c.readOpt(obj["spec"], toClusterCIDRSpec), - }} -export function fromClusterCIDR(input: ClusterCIDR): c.JSONValue { - return { - ...c.assertOrAddApiVersionAndKind(input, "networking.k8s.io/v1alpha1", "ClusterCIDR"), - ...input, - metadata: input.metadata != null ? MetaV1.fromObjectMeta(input.metadata) : undefined, - spec: input.spec != null ? fromClusterCIDRSpec(input.spec) : undefined, - }} - -/** ClusterCIDRSpec defines the desired state of ClusterCIDR. */ -export interface ClusterCIDRSpec { - ipv4?: string | null; - ipv6?: string | null; - nodeSelector?: CoreV1.NodeSelector | null; - perNodeHostBits: number; -} -export function toClusterCIDRSpec(input: c.JSONValue): ClusterCIDRSpec { - const obj = c.checkObj(input); - return { - ipv4: c.readOpt(obj["ipv4"], c.checkStr), - ipv6: c.readOpt(obj["ipv6"], c.checkStr), - nodeSelector: c.readOpt(obj["nodeSelector"], CoreV1.toNodeSelector), - perNodeHostBits: c.checkNum(obj["perNodeHostBits"]), - }} -export function fromClusterCIDRSpec(input: ClusterCIDRSpec): c.JSONValue { - return { - ...input, - nodeSelector: input.nodeSelector != null ? CoreV1.fromNodeSelector(input.nodeSelector) : undefined, - }} - -/** ClusterCIDRList contains a list of ClusterCIDR. */ -export interface ClusterCIDRList extends ListOf { - apiVersion?: "networking.k8s.io/v1alpha1"; - kind?: "ClusterCIDRList"; -}; -export function toClusterCIDRList(input: c.JSONValue): ClusterCIDRList & c.ApiKind { - const obj = c.checkObj(input); - return { - ...c.assertOrAddApiVersionAndKind(obj, "networking.k8s.io/v1alpha1", "ClusterCIDRList"), - metadata: MetaV1.toListMeta(obj.metadata), - items: c.readList(obj.items, toClusterCIDR), - }} - /** IPAddress represents a single IP of a single IP Family. The object is designed to be used by APIs that operate on IP addresses. The object is used by the Service core API for allocation of IP addresses. An IP address can be represented in different formats, to guarantee the uniqueness of the IP, the name of the object is the IP address in canonical format, four decimal digits separated by dots suppressing leading zeros for IPv4 and the representation defined by RFC 5952 for IPv6. Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1 Invalid: 10.01.2.3 or 2001:db8:0:0:0::1 */ export interface IPAddress { apiVersion?: "networking.k8s.io/v1alpha1"; @@ -88,12 +31,12 @@ export function fromIPAddress(input: IPAddress): c.JSONValue { /** IPAddressSpec describe the attributes in an IP Address. */ export interface IPAddressSpec { - parentRef?: ParentReference | null; + parentRef: ParentReference; } export function toIPAddressSpec(input: c.JSONValue): IPAddressSpec { const obj = c.checkObj(input); return { - parentRef: c.readOpt(obj["parentRef"], toParentReference), + parentRef: toParentReference(obj["parentRef"]), }} export function fromIPAddressSpec(input: IPAddressSpec): c.JSONValue { return { @@ -104,19 +47,17 @@ export function fromIPAddressSpec(input: IPAddressSpec): c.JSONValue { /** ParentReference describes a reference to a parent object. */ export interface ParentReference { group?: string | null; - name?: string | null; + name: string; namespace?: string | null; - resource?: string | null; - uid?: string | null; + resource: string; } export function toParentReference(input: c.JSONValue): ParentReference { const obj = c.checkObj(input); return { group: c.readOpt(obj["group"], c.checkStr), - name: c.readOpt(obj["name"], c.checkStr), + name: c.checkStr(obj["name"]), namespace: c.readOpt(obj["namespace"], c.checkStr), - resource: c.readOpt(obj["resource"], c.checkStr), - uid: c.readOpt(obj["uid"], c.checkStr), + resource: c.checkStr(obj["resource"]), }} export function fromParentReference(input: ParentReference): c.JSONValue { return { @@ -135,3 +76,70 @@ export function toIPAddressList(input: c.JSONValue): IPAddressList & c.ApiKind { metadata: MetaV1.toListMeta(obj.metadata), items: c.readList(obj.items, toIPAddress), }} + +/** ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64). This range is used to allocate ClusterIPs to Service objects. */ +export interface ServiceCIDR { + apiVersion?: "networking.k8s.io/v1alpha1"; + kind?: "ServiceCIDR"; + metadata?: MetaV1.ObjectMeta | null; + spec?: ServiceCIDRSpec | null; + status?: ServiceCIDRStatus | null; +} +export function toServiceCIDR(input: c.JSONValue): ServiceCIDR & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "networking.k8s.io/v1alpha1", "ServiceCIDR"), + metadata: c.readOpt(obj["metadata"], MetaV1.toObjectMeta), + spec: c.readOpt(obj["spec"], toServiceCIDRSpec), + status: c.readOpt(obj["status"], toServiceCIDRStatus), + }} +export function fromServiceCIDR(input: ServiceCIDR): c.JSONValue { + return { + ...c.assertOrAddApiVersionAndKind(input, "networking.k8s.io/v1alpha1", "ServiceCIDR"), + ...input, + metadata: input.metadata != null ? MetaV1.fromObjectMeta(input.metadata) : undefined, + spec: input.spec != null ? fromServiceCIDRSpec(input.spec) : undefined, + status: input.status != null ? fromServiceCIDRStatus(input.status) : undefined, + }} + +/** ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services. */ +export interface ServiceCIDRSpec { + cidrs?: Array | null; +} +export function toServiceCIDRSpec(input: c.JSONValue): ServiceCIDRSpec { + const obj = c.checkObj(input); + return { + cidrs: c.readOpt(obj["cidrs"], x => c.readList(x, c.checkStr)), + }} +export function fromServiceCIDRSpec(input: ServiceCIDRSpec): c.JSONValue { + return { + ...input, + }} + +/** ServiceCIDRStatus describes the current state of the ServiceCIDR. */ +export interface ServiceCIDRStatus { + conditions?: Array | null; +} +export function toServiceCIDRStatus(input: c.JSONValue): ServiceCIDRStatus { + const obj = c.checkObj(input); + return { + conditions: c.readOpt(obj["conditions"], x => c.readList(x, MetaV1.toCondition)), + }} +export function fromServiceCIDRStatus(input: ServiceCIDRStatus): c.JSONValue { + return { + ...input, + conditions: input.conditions?.map(MetaV1.fromCondition), + }} + +/** ServiceCIDRList contains a list of ServiceCIDR objects. */ +export interface ServiceCIDRList extends ListOf { + apiVersion?: "networking.k8s.io/v1alpha1"; + kind?: "ServiceCIDRList"; +}; +export function toServiceCIDRList(input: c.JSONValue): ServiceCIDRList & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "networking.k8s.io/v1alpha1", "ServiceCIDRList"), + metadata: MetaV1.toListMeta(obj.metadata), + items: c.readList(obj.items, toServiceCIDR), + }} diff --git a/lib/builtin/resource.k8s.io@v1alpha2/mod.ts b/lib/builtin/resource.k8s.io@v1alpha2/mod.ts index 911d38c..8b4073b 100644 --- a/lib/builtin/resource.k8s.io@v1alpha2/mod.ts +++ b/lib/builtin/resource.k8s.io@v1alpha2/mod.ts @@ -48,6 +48,33 @@ export class ResourceV1alpha2Api { return resp.pipeThrough(new c.WatchEventTransformer(ResourceV1alpha2.toPodSchedulingContext, MetaV1.toStatus)); } + async getResourceClaimParametersListForAllNamespaces( + opts: operations.GetListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}resourceclaimparameters`, + expectJson: true, + querystring: operations.formatGetListOpts(opts), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceClaimParametersList(resp); + } + + async watchResourceClaimParametersListForAllNamespaces( + opts: operations.WatchListOpts = {}, + ): Promise> { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}resourceclaimparameters`, + expectJson: true, + expectStream: true, + querystring: operations.formatWatchListOpts(opts), + abortSignal: opts.abortSignal, + }); + return resp.pipeThrough(new c.WatchEventTransformer(ResourceV1alpha2.toResourceClaimParameters, MetaV1.toStatus)); + } + async getResourceClaimListForAllNamespaces( opts: operations.GetListOpts = {}, ): Promise { @@ -219,6 +246,150 @@ export class ResourceV1alpha2Api { return ResourceV1alpha2.toResourceClass(resp); } + async getResourceClassParametersListForAllNamespaces( + opts: operations.GetListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}resourceclassparameters`, + expectJson: true, + querystring: operations.formatGetListOpts(opts), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceClassParametersList(resp); + } + + async watchResourceClassParametersListForAllNamespaces( + opts: operations.WatchListOpts = {}, + ): Promise> { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}resourceclassparameters`, + expectJson: true, + expectStream: true, + querystring: operations.formatWatchListOpts(opts), + abortSignal: opts.abortSignal, + }); + return resp.pipeThrough(new c.WatchEventTransformer(ResourceV1alpha2.toResourceClassParameters, MetaV1.toStatus)); + } + + async getResourceSliceList( + opts: operations.GetListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}resourceslices`, + expectJson: true, + querystring: operations.formatGetListOpts(opts), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceSliceList(resp); + } + + async watchResourceSliceList( + opts: operations.WatchListOpts = {}, + ): Promise> { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}resourceslices`, + expectJson: true, + expectStream: true, + querystring: operations.formatWatchListOpts(opts), + abortSignal: opts.abortSignal, + }); + return resp.pipeThrough(new c.WatchEventTransformer(ResourceV1alpha2.toResourceSlice, MetaV1.toStatus)); + } + + async createResourceSlice( + body: ResourceV1alpha2.ResourceSlice, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "POST", + path: `${this.#root}resourceslices`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: ResourceV1alpha2.fromResourceSlice(body), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceSlice(resp); + } + + async deleteResourceSliceList( + opts: operations.DeleteListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "DELETE", + path: `${this.#root}resourceslices`, + expectJson: true, + querystring: operations.formatDeleteListOpts(opts), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceSliceList(resp); + } + + async getResourceSlice( + name: string, + opts: operations.NoOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}resourceslices/${name}`, + expectJson: true, + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceSlice(resp); + } + + async deleteResourceSlice( + name: string, + opts: operations.DeleteOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "DELETE", + path: `${this.#root}resourceslices/${name}`, + expectJson: true, + querystring: operations.formatDeleteOpts(opts), + abortSignal: opts.abortSignal, + }); + if (c.isStatusKind(resp)) return MetaV1.toStatus(resp); + return ResourceV1alpha2.toResourceSlice(resp); + } + + async replaceResourceSlice( + name: string, + body: ResourceV1alpha2.ResourceSlice, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PUT", + path: `${this.#root}resourceslices/${name}`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: ResourceV1alpha2.fromResourceSlice(body), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceSlice(resp); + } + + async patchResourceSlice( + name: string, + type: c.PatchType, + body: ResourceV1alpha2.ResourceSlice | c.JsonPatch, + opts: operations.PatchOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PATCH", + path: `${this.#root}resourceslices/${name}`, + expectJson: true, + querystring: operations.formatPatchOpts(opts), + contentType: c.getPatchContentType(type), + bodyJson: Array.isArray(body) ? body : ResourceV1alpha2.fromResourceSlice(body), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceSlice(resp); + } + } export class ResourceV1alpha2NamespacedApi { @@ -393,6 +564,123 @@ export class ResourceV1alpha2NamespacedApi { return ResourceV1alpha2.toPodSchedulingContext(resp); } + async getResourceClaimParametersList( + opts: operations.GetListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}resourceclaimparameters`, + expectJson: true, + querystring: operations.formatGetListOpts(opts), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceClaimParametersList(resp); + } + + async watchResourceClaimParametersList( + opts: operations.WatchListOpts = {}, + ): Promise> { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}resourceclaimparameters`, + expectJson: true, + expectStream: true, + querystring: operations.formatWatchListOpts(opts), + abortSignal: opts.abortSignal, + }); + return resp.pipeThrough(new c.WatchEventTransformer(ResourceV1alpha2.toResourceClaimParameters, MetaV1.toStatus)); + } + + async createResourceClaimParameters( + body: ResourceV1alpha2.ResourceClaimParameters, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "POST", + path: `${this.#root}resourceclaimparameters`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: ResourceV1alpha2.fromResourceClaimParameters(body), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceClaimParameters(resp); + } + + async deleteResourceClaimParametersList( + opts: operations.DeleteListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "DELETE", + path: `${this.#root}resourceclaimparameters`, + expectJson: true, + querystring: operations.formatDeleteListOpts(opts), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceClaimParametersList(resp); + } + + async getResourceClaimParameters( + name: string, + opts: operations.NoOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}resourceclaimparameters/${name}`, + expectJson: true, + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceClaimParameters(resp); + } + + async deleteResourceClaimParameters( + name: string, + opts: operations.DeleteOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "DELETE", + path: `${this.#root}resourceclaimparameters/${name}`, + expectJson: true, + querystring: operations.formatDeleteOpts(opts), + abortSignal: opts.abortSignal, + }); + if (c.isStatusKind(resp)) return MetaV1.toStatus(resp); + return ResourceV1alpha2.toResourceClaimParameters(resp); + } + + async replaceResourceClaimParameters( + name: string, + body: ResourceV1alpha2.ResourceClaimParameters, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PUT", + path: `${this.#root}resourceclaimparameters/${name}`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: ResourceV1alpha2.fromResourceClaimParameters(body), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceClaimParameters(resp); + } + + async patchResourceClaimParameters( + name: string, + type: c.PatchType, + body: ResourceV1alpha2.ResourceClaimParameters | c.JsonPatch, + opts: operations.PatchOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PATCH", + path: `${this.#root}resourceclaimparameters/${name}`, + expectJson: true, + querystring: operations.formatPatchOpts(opts), + contentType: c.getPatchContentType(type), + bodyJson: Array.isArray(body) ? body : ResourceV1alpha2.fromResourceClaimParameters(body), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceClaimParameters(resp); + } + async getResourceClaimList( opts: operations.GetListOpts = {}, ): Promise { @@ -674,4 +962,121 @@ export class ResourceV1alpha2NamespacedApi { return ResourceV1alpha2.toResourceClaimTemplate(resp); } + async getResourceClassParametersList( + opts: operations.GetListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}resourceclassparameters`, + expectJson: true, + querystring: operations.formatGetListOpts(opts), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceClassParametersList(resp); + } + + async watchResourceClassParametersList( + opts: operations.WatchListOpts = {}, + ): Promise> { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}resourceclassparameters`, + expectJson: true, + expectStream: true, + querystring: operations.formatWatchListOpts(opts), + abortSignal: opts.abortSignal, + }); + return resp.pipeThrough(new c.WatchEventTransformer(ResourceV1alpha2.toResourceClassParameters, MetaV1.toStatus)); + } + + async createResourceClassParameters( + body: ResourceV1alpha2.ResourceClassParameters, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "POST", + path: `${this.#root}resourceclassparameters`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: ResourceV1alpha2.fromResourceClassParameters(body), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceClassParameters(resp); + } + + async deleteResourceClassParametersList( + opts: operations.DeleteListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "DELETE", + path: `${this.#root}resourceclassparameters`, + expectJson: true, + querystring: operations.formatDeleteListOpts(opts), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceClassParametersList(resp); + } + + async getResourceClassParameters( + name: string, + opts: operations.NoOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}resourceclassparameters/${name}`, + expectJson: true, + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceClassParameters(resp); + } + + async deleteResourceClassParameters( + name: string, + opts: operations.DeleteOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "DELETE", + path: `${this.#root}resourceclassparameters/${name}`, + expectJson: true, + querystring: operations.formatDeleteOpts(opts), + abortSignal: opts.abortSignal, + }); + if (c.isStatusKind(resp)) return MetaV1.toStatus(resp); + return ResourceV1alpha2.toResourceClassParameters(resp); + } + + async replaceResourceClassParameters( + name: string, + body: ResourceV1alpha2.ResourceClassParameters, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PUT", + path: `${this.#root}resourceclassparameters/${name}`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: ResourceV1alpha2.fromResourceClassParameters(body), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceClassParameters(resp); + } + + async patchResourceClassParameters( + name: string, + type: c.PatchType, + body: ResourceV1alpha2.ResourceClassParameters | c.JsonPatch, + opts: operations.PatchOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PATCH", + path: `${this.#root}resourceclassparameters/${name}`, + expectJson: true, + querystring: operations.formatPatchOpts(opts), + contentType: c.getPatchContentType(type), + bodyJson: Array.isArray(body) ? body : ResourceV1alpha2.fromResourceClassParameters(body), + abortSignal: opts.abortSignal, + }); + return ResourceV1alpha2.toResourceClassParameters(resp); + } + } diff --git a/lib/builtin/resource.k8s.io@v1alpha2/structs.ts b/lib/builtin/resource.k8s.io@v1alpha2/structs.ts index 855ea4f..dd04d3c 100644 --- a/lib/builtin/resource.k8s.io@v1alpha2/structs.ts +++ b/lib/builtin/resource.k8s.io@v1alpha2/structs.ts @@ -32,16 +32,226 @@ export function fromAllocationResult(input: AllocationResult): c.JSONValue { export interface ResourceHandle { data?: string | null; driverName?: string | null; + structuredData?: StructuredResourceHandle | null; } export function toResourceHandle(input: c.JSONValue): ResourceHandle { const obj = c.checkObj(input); return { data: c.readOpt(obj["data"], c.checkStr), driverName: c.readOpt(obj["driverName"], c.checkStr), + structuredData: c.readOpt(obj["structuredData"], toStructuredResourceHandle), }} export function fromResourceHandle(input: ResourceHandle): c.JSONValue { return { ...input, + structuredData: input.structuredData != null ? fromStructuredResourceHandle(input.structuredData) : undefined, + }} + +/** StructuredResourceHandle is the in-tree representation of the allocation result. */ +export interface StructuredResourceHandle { + nodeName?: string | null; + results: Array; + vendorClaimParameters?: c.JSONValue | null; + vendorClassParameters?: c.JSONValue | null; +} +export function toStructuredResourceHandle(input: c.JSONValue): StructuredResourceHandle { + const obj = c.checkObj(input); + return { + nodeName: c.readOpt(obj["nodeName"], c.checkStr), + results: c.readList(obj["results"], toDriverAllocationResult), + vendorClaimParameters: c.readOpt(obj["vendorClaimParameters"], c.identity), + vendorClassParameters: c.readOpt(obj["vendorClassParameters"], c.identity), + }} +export function fromStructuredResourceHandle(input: StructuredResourceHandle): c.JSONValue { + return { + ...input, + results: input.results?.map(fromDriverAllocationResult), + }} + +/** DriverAllocationResult contains vendor parameters and the allocation result for one request. */ +export interface DriverAllocationResult { + namedResources?: NamedResourcesAllocationResult | null; + vendorRequestParameters?: c.JSONValue | null; +} +export function toDriverAllocationResult(input: c.JSONValue): DriverAllocationResult { + const obj = c.checkObj(input); + return { + namedResources: c.readOpt(obj["namedResources"], toNamedResourcesAllocationResult), + vendorRequestParameters: c.readOpt(obj["vendorRequestParameters"], c.identity), + }} +export function fromDriverAllocationResult(input: DriverAllocationResult): c.JSONValue { + return { + ...input, + namedResources: input.namedResources != null ? fromNamedResourcesAllocationResult(input.namedResources) : undefined, + }} + +/** NamedResourcesAllocationResult is used in AllocationResultModel. */ +export interface NamedResourcesAllocationResult { + name: string; +} +export function toNamedResourcesAllocationResult(input: c.JSONValue): NamedResourcesAllocationResult { + const obj = c.checkObj(input); + return { + name: c.checkStr(obj["name"]), + }} +export function fromNamedResourcesAllocationResult(input: NamedResourcesAllocationResult): c.JSONValue { + return { + ...input, + }} + +/** DriverRequests describes all resources that are needed from one particular driver. */ +export interface DriverRequests { + driverName?: string | null; + requests?: Array | null; + vendorParameters?: c.JSONValue | null; +} +export function toDriverRequests(input: c.JSONValue): DriverRequests { + const obj = c.checkObj(input); + return { + driverName: c.readOpt(obj["driverName"], c.checkStr), + requests: c.readOpt(obj["requests"], x => c.readList(x, toResourceRequest)), + vendorParameters: c.readOpt(obj["vendorParameters"], c.identity), + }} +export function fromDriverRequests(input: DriverRequests): c.JSONValue { + return { + ...input, + requests: input.requests?.map(fromResourceRequest), + }} + +/** ResourceRequest is a request for resources from one particular driver. */ +export interface ResourceRequest { + namedResources?: NamedResourcesRequest | null; + vendorParameters?: c.JSONValue | null; +} +export function toResourceRequest(input: c.JSONValue): ResourceRequest { + const obj = c.checkObj(input); + return { + namedResources: c.readOpt(obj["namedResources"], toNamedResourcesRequest), + vendorParameters: c.readOpt(obj["vendorParameters"], c.identity), + }} +export function fromResourceRequest(input: ResourceRequest): c.JSONValue { + return { + ...input, + namedResources: input.namedResources != null ? fromNamedResourcesRequest(input.namedResources) : undefined, + }} + +/** NamedResourcesRequest is used in ResourceRequestModel. */ +export interface NamedResourcesRequest { + selector: string; +} +export function toNamedResourcesRequest(input: c.JSONValue): NamedResourcesRequest { + const obj = c.checkObj(input); + return { + selector: c.checkStr(obj["selector"]), + }} +export function fromNamedResourcesRequest(input: NamedResourcesRequest): c.JSONValue { + return { + ...input, + }} + +/** NamedResourcesAttribute is a combination of an attribute name and its value. */ +export interface NamedResourcesAttribute { + bool?: boolean | null; + int?: number | null; + intSlice?: NamedResourcesIntSlice | null; + name: string; + quantity?: c.Quantity | null; + string?: string | null; + stringSlice?: NamedResourcesStringSlice | null; + version?: string | null; +} +export function toNamedResourcesAttribute(input: c.JSONValue): NamedResourcesAttribute { + const obj = c.checkObj(input); + return { + bool: c.readOpt(obj["bool"], c.checkBool), + int: c.readOpt(obj["int"], c.checkNum), + intSlice: c.readOpt(obj["intSlice"], toNamedResourcesIntSlice), + name: c.checkStr(obj["name"]), + quantity: c.readOpt(obj["quantity"], c.toQuantity), + string: c.readOpt(obj["string"], c.checkStr), + stringSlice: c.readOpt(obj["stringSlice"], toNamedResourcesStringSlice), + version: c.readOpt(obj["version"], c.checkStr), + }} +export function fromNamedResourcesAttribute(input: NamedResourcesAttribute): c.JSONValue { + return { + ...input, + intSlice: input.intSlice != null ? fromNamedResourcesIntSlice(input.intSlice) : undefined, + quantity: input.quantity != null ? c.fromQuantity(input.quantity) : undefined, + stringSlice: input.stringSlice != null ? fromNamedResourcesStringSlice(input.stringSlice) : undefined, + }} + +/** NamedResourcesIntSlice contains a slice of 64-bit integers. */ +export interface NamedResourcesIntSlice { + ints: Array; +} +export function toNamedResourcesIntSlice(input: c.JSONValue): NamedResourcesIntSlice { + const obj = c.checkObj(input); + return { + ints: c.readList(obj["ints"], c.checkNum), + }} +export function fromNamedResourcesIntSlice(input: NamedResourcesIntSlice): c.JSONValue { + return { + ...input, + }} + +/** NamedResourcesStringSlice contains a slice of strings. */ +export interface NamedResourcesStringSlice { + strings: Array; +} +export function toNamedResourcesStringSlice(input: c.JSONValue): NamedResourcesStringSlice { + const obj = c.checkObj(input); + return { + strings: c.readList(obj["strings"], c.checkStr), + }} +export function fromNamedResourcesStringSlice(input: NamedResourcesStringSlice): c.JSONValue { + return { + ...input, + }} + +/** NamedResourcesFilter is used in ResourceFilterModel. */ +export interface NamedResourcesFilter { + selector: string; +} +export function toNamedResourcesFilter(input: c.JSONValue): NamedResourcesFilter { + const obj = c.checkObj(input); + return { + selector: c.checkStr(obj["selector"]), + }} +export function fromNamedResourcesFilter(input: NamedResourcesFilter): c.JSONValue { + return { + ...input, + }} + +/** NamedResourcesInstance represents one individual hardware instance that can be selected based on its attributes. */ +export interface NamedResourcesInstance { + attributes?: Array | null; + name: string; +} +export function toNamedResourcesInstance(input: c.JSONValue): NamedResourcesInstance { + const obj = c.checkObj(input); + return { + attributes: c.readOpt(obj["attributes"], x => c.readList(x, toNamedResourcesAttribute)), + name: c.checkStr(obj["name"]), + }} +export function fromNamedResourcesInstance(input: NamedResourcesInstance): c.JSONValue { + return { + ...input, + attributes: input.attributes?.map(fromNamedResourcesAttribute), + }} + +/** NamedResourcesResources is used in ResourceModel. */ +export interface NamedResourcesResources { + instances: Array; +} +export function toNamedResourcesResources(input: c.JSONValue): NamedResourcesResources { + const obj = c.checkObj(input); + return { + instances: c.readList(obj["instances"], toNamedResourcesInstance), + }} +export function fromNamedResourcesResources(input: NamedResourcesResources): c.JSONValue { + return { + ...input, + instances: input.instances?.map(fromNamedResourcesInstance), }} /** PodSchedulingContext objects hold information that is needed to schedule a Pod with ResourceClaims that use "WaitForFirstConsumer" allocation mode. @@ -250,6 +460,46 @@ export function toResourceClaimList(input: c.JSONValue): ResourceClaimList & c.A items: c.readList(obj.items, toResourceClaim), }} +/** ResourceClaimParameters defines resource requests for a ResourceClaim in an in-tree format understood by Kubernetes. */ +export interface ResourceClaimParameters { + apiVersion?: "resource.k8s.io/v1alpha2"; + kind?: "ResourceClaimParameters"; + driverRequests?: Array | null; + generatedFrom?: ResourceClaimParametersReference | null; + metadata?: MetaV1.ObjectMeta | null; + shareable?: boolean | null; +} +export function toResourceClaimParameters(input: c.JSONValue): ResourceClaimParameters & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "resource.k8s.io/v1alpha2", "ResourceClaimParameters"), + driverRequests: c.readOpt(obj["driverRequests"], x => c.readList(x, toDriverRequests)), + generatedFrom: c.readOpt(obj["generatedFrom"], toResourceClaimParametersReference), + metadata: c.readOpt(obj["metadata"], MetaV1.toObjectMeta), + shareable: c.readOpt(obj["shareable"], c.checkBool), + }} +export function fromResourceClaimParameters(input: ResourceClaimParameters): c.JSONValue { + return { + ...c.assertOrAddApiVersionAndKind(input, "resource.k8s.io/v1alpha2", "ResourceClaimParameters"), + ...input, + driverRequests: input.driverRequests?.map(fromDriverRequests), + generatedFrom: input.generatedFrom != null ? fromResourceClaimParametersReference(input.generatedFrom) : undefined, + metadata: input.metadata != null ? MetaV1.fromObjectMeta(input.metadata) : undefined, + }} + +/** ResourceClaimParametersList is a collection of ResourceClaimParameters. */ +export interface ResourceClaimParametersList extends ListOf { + apiVersion?: "resource.k8s.io/v1alpha2"; + kind?: "ResourceClaimParametersList"; +}; +export function toResourceClaimParametersList(input: c.JSONValue): ResourceClaimParametersList & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "resource.k8s.io/v1alpha2", "ResourceClaimParametersList"), + metadata: MetaV1.toListMeta(obj.metadata), + items: c.readList(obj.items, toResourceClaimParameters), + }} + /** ResourceClaimTemplate is used to produce ResourceClaim objects. */ export interface ResourceClaimTemplate { apiVersion?: "resource.k8s.io/v1alpha2"; @@ -312,6 +562,7 @@ export interface ResourceClass { driverName: string; metadata?: MetaV1.ObjectMeta | null; parametersRef?: ResourceClassParametersReference | null; + structuredParameters?: boolean | null; suitableNodes?: CoreV1.NodeSelector | null; } export function toResourceClass(input: c.JSONValue): ResourceClass & c.ApiKind { @@ -321,6 +572,7 @@ export function toResourceClass(input: c.JSONValue): ResourceClass & c.ApiKind { driverName: c.checkStr(obj["driverName"]), metadata: c.readOpt(obj["metadata"], MetaV1.toObjectMeta), parametersRef: c.readOpt(obj["parametersRef"], toResourceClassParametersReference), + structuredParameters: c.readOpt(obj["structuredParameters"], c.checkBool), suitableNodes: c.readOpt(obj["suitableNodes"], CoreV1.toNodeSelector), }} export function fromResourceClass(input: ResourceClass): c.JSONValue { @@ -364,3 +616,116 @@ export function toResourceClassList(input: c.JSONValue): ResourceClassList & c.A metadata: MetaV1.toListMeta(obj.metadata), items: c.readList(obj.items, toResourceClass), }} + +/** ResourceClassParameters defines resource requests for a ResourceClass in an in-tree format understood by Kubernetes. */ +export interface ResourceClassParameters { + apiVersion?: "resource.k8s.io/v1alpha2"; + kind?: "ResourceClassParameters"; + filters?: Array | null; + generatedFrom?: ResourceClassParametersReference | null; + metadata?: MetaV1.ObjectMeta | null; + vendorParameters?: Array | null; +} +export function toResourceClassParameters(input: c.JSONValue): ResourceClassParameters & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "resource.k8s.io/v1alpha2", "ResourceClassParameters"), + filters: c.readOpt(obj["filters"], x => c.readList(x, toResourceFilter)), + generatedFrom: c.readOpt(obj["generatedFrom"], toResourceClassParametersReference), + metadata: c.readOpt(obj["metadata"], MetaV1.toObjectMeta), + vendorParameters: c.readOpt(obj["vendorParameters"], x => c.readList(x, toVendorParameters)), + }} +export function fromResourceClassParameters(input: ResourceClassParameters): c.JSONValue { + return { + ...c.assertOrAddApiVersionAndKind(input, "resource.k8s.io/v1alpha2", "ResourceClassParameters"), + ...input, + filters: input.filters?.map(fromResourceFilter), + generatedFrom: input.generatedFrom != null ? fromResourceClassParametersReference(input.generatedFrom) : undefined, + metadata: input.metadata != null ? MetaV1.fromObjectMeta(input.metadata) : undefined, + vendorParameters: input.vendorParameters?.map(fromVendorParameters), + }} + +/** ResourceFilter is a filter for resources from one particular driver. */ +export interface ResourceFilter { + driverName?: string | null; + namedResources?: NamedResourcesFilter | null; +} +export function toResourceFilter(input: c.JSONValue): ResourceFilter { + const obj = c.checkObj(input); + return { + driverName: c.readOpt(obj["driverName"], c.checkStr), + namedResources: c.readOpt(obj["namedResources"], toNamedResourcesFilter), + }} +export function fromResourceFilter(input: ResourceFilter): c.JSONValue { + return { + ...input, + namedResources: input.namedResources != null ? fromNamedResourcesFilter(input.namedResources) : undefined, + }} + +/** VendorParameters are opaque parameters for one particular driver. */ +export interface VendorParameters { + driverName?: string | null; + parameters?: c.JSONValue | null; +} +export function toVendorParameters(input: c.JSONValue): VendorParameters { + const obj = c.checkObj(input); + return { + driverName: c.readOpt(obj["driverName"], c.checkStr), + parameters: c.readOpt(obj["parameters"], c.identity), + }} +export function fromVendorParameters(input: VendorParameters): c.JSONValue { + return { + ...input, + }} + +/** ResourceClassParametersList is a collection of ResourceClassParameters. */ +export interface ResourceClassParametersList extends ListOf { + apiVersion?: "resource.k8s.io/v1alpha2"; + kind?: "ResourceClassParametersList"; +}; +export function toResourceClassParametersList(input: c.JSONValue): ResourceClassParametersList & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "resource.k8s.io/v1alpha2", "ResourceClassParametersList"), + metadata: MetaV1.toListMeta(obj.metadata), + items: c.readList(obj.items, toResourceClassParameters), + }} + +/** ResourceSlice provides information about available resources on individual nodes. */ +export interface ResourceSlice { + apiVersion?: "resource.k8s.io/v1alpha2"; + kind?: "ResourceSlice"; + driverName: string; + metadata?: MetaV1.ObjectMeta | null; + namedResources?: NamedResourcesResources | null; + nodeName?: string | null; +} +export function toResourceSlice(input: c.JSONValue): ResourceSlice & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "resource.k8s.io/v1alpha2", "ResourceSlice"), + driverName: c.checkStr(obj["driverName"]), + metadata: c.readOpt(obj["metadata"], MetaV1.toObjectMeta), + namedResources: c.readOpt(obj["namedResources"], toNamedResourcesResources), + nodeName: c.readOpt(obj["nodeName"], c.checkStr), + }} +export function fromResourceSlice(input: ResourceSlice): c.JSONValue { + return { + ...c.assertOrAddApiVersionAndKind(input, "resource.k8s.io/v1alpha2", "ResourceSlice"), + ...input, + metadata: input.metadata != null ? MetaV1.fromObjectMeta(input.metadata) : undefined, + namedResources: input.namedResources != null ? fromNamedResourcesResources(input.namedResources) : undefined, + }} + +/** ResourceSliceList is a collection of ResourceSlices. */ +export interface ResourceSliceList extends ListOf { + apiVersion?: "resource.k8s.io/v1alpha2"; + kind?: "ResourceSliceList"; +}; +export function toResourceSliceList(input: c.JSONValue): ResourceSliceList & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "resource.k8s.io/v1alpha2", "ResourceSliceList"), + metadata: MetaV1.toListMeta(obj.metadata), + items: c.readList(obj.items, toResourceSlice), + }} diff --git a/lib/builtin/storage.k8s.io@v1alpha1/mod.ts b/lib/builtin/storage.k8s.io@v1alpha1/mod.ts new file mode 100644 index 0000000..9d0b5f2 --- /dev/null +++ b/lib/builtin/storage.k8s.io@v1alpha1/mod.ts @@ -0,0 +1,133 @@ +export * from "./structs.ts"; + +// Autogenerated API file for StorageV1alpha1 +import * as c from "../../common.ts"; +import * as operations from "../../operations.ts"; +import * as MetaV1 from "../meta@v1/structs.ts"; +import * as StorageV1alpha1 from "./structs.ts"; + +export class StorageV1alpha1Api { + #client: c.RestClient; + #root = "/apis/storage.k8s.io/v1alpha1/"; + constructor(client: c.RestClient) { + this.#client = client; + } + + async getVolumeAttributesClassList( + opts: operations.GetListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}volumeattributesclasses`, + expectJson: true, + querystring: operations.formatGetListOpts(opts), + abortSignal: opts.abortSignal, + }); + return StorageV1alpha1.toVolumeAttributesClassList(resp); + } + + async watchVolumeAttributesClassList( + opts: operations.WatchListOpts = {}, + ): Promise> { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}volumeattributesclasses`, + expectJson: true, + expectStream: true, + querystring: operations.formatWatchListOpts(opts), + abortSignal: opts.abortSignal, + }); + return resp.pipeThrough(new c.WatchEventTransformer(StorageV1alpha1.toVolumeAttributesClass, MetaV1.toStatus)); + } + + async createVolumeAttributesClass( + body: StorageV1alpha1.VolumeAttributesClass, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "POST", + path: `${this.#root}volumeattributesclasses`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: StorageV1alpha1.fromVolumeAttributesClass(body), + abortSignal: opts.abortSignal, + }); + return StorageV1alpha1.toVolumeAttributesClass(resp); + } + + async deleteVolumeAttributesClassList( + opts: operations.DeleteListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "DELETE", + path: `${this.#root}volumeattributesclasses`, + expectJson: true, + querystring: operations.formatDeleteListOpts(opts), + abortSignal: opts.abortSignal, + }); + return StorageV1alpha1.toVolumeAttributesClassList(resp); + } + + async getVolumeAttributesClass( + name: string, + opts: operations.NoOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}volumeattributesclasses/${name}`, + expectJson: true, + abortSignal: opts.abortSignal, + }); + return StorageV1alpha1.toVolumeAttributesClass(resp); + } + + async deleteVolumeAttributesClass( + name: string, + opts: operations.DeleteOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "DELETE", + path: `${this.#root}volumeattributesclasses/${name}`, + expectJson: true, + querystring: operations.formatDeleteOpts(opts), + abortSignal: opts.abortSignal, + }); + if (c.isStatusKind(resp)) return MetaV1.toStatus(resp); + return StorageV1alpha1.toVolumeAttributesClass(resp); + } + + async replaceVolumeAttributesClass( + name: string, + body: StorageV1alpha1.VolumeAttributesClass, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PUT", + path: `${this.#root}volumeattributesclasses/${name}`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: StorageV1alpha1.fromVolumeAttributesClass(body), + abortSignal: opts.abortSignal, + }); + return StorageV1alpha1.toVolumeAttributesClass(resp); + } + + async patchVolumeAttributesClass( + name: string, + type: c.PatchType, + body: StorageV1alpha1.VolumeAttributesClass | c.JsonPatch, + opts: operations.PatchOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PATCH", + path: `${this.#root}volumeattributesclasses/${name}`, + expectJson: true, + querystring: operations.formatPatchOpts(opts), + contentType: c.getPatchContentType(type), + bodyJson: Array.isArray(body) ? body : StorageV1alpha1.fromVolumeAttributesClass(body), + abortSignal: opts.abortSignal, + }); + return StorageV1alpha1.toVolumeAttributesClass(resp); + } + +} diff --git a/lib/builtin/storage.k8s.io@v1alpha1/structs.ts b/lib/builtin/storage.k8s.io@v1alpha1/structs.ts new file mode 100644 index 0000000..7f3b9e8 --- /dev/null +++ b/lib/builtin/storage.k8s.io@v1alpha1/structs.ts @@ -0,0 +1,44 @@ +// Autogenerated Schema file for StorageV1alpha1 +import * as c from "../../common.ts"; + +import * as MetaV1 from "../meta@v1/structs.ts"; +type ListOf = { + metadata: MetaV1.ListMeta; + items: Array; +}; + +/** VolumeAttributesClass represents a specification of mutable volume attributes defined by the CSI driver. The class can be specified during dynamic provisioning of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning. */ +export interface VolumeAttributesClass { + apiVersion?: "storage.k8s.io/v1alpha1"; + kind?: "VolumeAttributesClass"; + driverName: string; + metadata?: MetaV1.ObjectMeta | null; + parameters?: Record | null; +} +export function toVolumeAttributesClass(input: c.JSONValue): VolumeAttributesClass & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "storage.k8s.io/v1alpha1", "VolumeAttributesClass"), + driverName: c.checkStr(obj["driverName"]), + metadata: c.readOpt(obj["metadata"], MetaV1.toObjectMeta), + parameters: c.readOpt(obj["parameters"], x => c.readMap(x, c.checkStr)), + }} +export function fromVolumeAttributesClass(input: VolumeAttributesClass): c.JSONValue { + return { + ...c.assertOrAddApiVersionAndKind(input, "storage.k8s.io/v1alpha1", "VolumeAttributesClass"), + ...input, + metadata: input.metadata != null ? MetaV1.fromObjectMeta(input.metadata) : undefined, + }} + +/** VolumeAttributesClassList is a collection of VolumeAttributesClass objects. */ +export interface VolumeAttributesClassList extends ListOf { + apiVersion?: "storage.k8s.io/v1alpha1"; + kind?: "VolumeAttributesClassList"; +}; +export function toVolumeAttributesClassList(input: c.JSONValue): VolumeAttributesClassList & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "storage.k8s.io/v1alpha1", "VolumeAttributesClassList"), + metadata: MetaV1.toListMeta(obj.metadata), + items: c.readList(obj.items, toVolumeAttributesClass), + }} diff --git a/lib/builtin/storagemigration.k8s.io@v1alpha1/mod.ts b/lib/builtin/storagemigration.k8s.io@v1alpha1/mod.ts new file mode 100644 index 0000000..e0aa13e --- /dev/null +++ b/lib/builtin/storagemigration.k8s.io@v1alpha1/mod.ts @@ -0,0 +1,180 @@ +export * from "./structs.ts"; + +// Autogenerated API file for StoragemigrationV1alpha1 +import * as c from "../../common.ts"; +import * as operations from "../../operations.ts"; +import * as MetaV1 from "../meta@v1/structs.ts"; +import * as StoragemigrationV1alpha1 from "./structs.ts"; + +export class StoragemigrationV1alpha1Api { + #client: c.RestClient; + #root = "/apis/storagemigration.k8s.io/v1alpha1/"; + constructor(client: c.RestClient) { + this.#client = client; + } + + async getStorageVersionMigrationList( + opts: operations.GetListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}storageversionmigrations`, + expectJson: true, + querystring: operations.formatGetListOpts(opts), + abortSignal: opts.abortSignal, + }); + return StoragemigrationV1alpha1.toStorageVersionMigrationList(resp); + } + + async watchStorageVersionMigrationList( + opts: operations.WatchListOpts = {}, + ): Promise> { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}storageversionmigrations`, + expectJson: true, + expectStream: true, + querystring: operations.formatWatchListOpts(opts), + abortSignal: opts.abortSignal, + }); + return resp.pipeThrough(new c.WatchEventTransformer(StoragemigrationV1alpha1.toStorageVersionMigration, MetaV1.toStatus)); + } + + async createStorageVersionMigration( + body: StoragemigrationV1alpha1.StorageVersionMigration, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "POST", + path: `${this.#root}storageversionmigrations`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: StoragemigrationV1alpha1.fromStorageVersionMigration(body), + abortSignal: opts.abortSignal, + }); + return StoragemigrationV1alpha1.toStorageVersionMigration(resp); + } + + async deleteStorageVersionMigrationList( + opts: operations.DeleteListOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "DELETE", + path: `${this.#root}storageversionmigrations`, + expectJson: true, + querystring: operations.formatDeleteListOpts(opts), + abortSignal: opts.abortSignal, + }); + return StoragemigrationV1alpha1.toStorageVersionMigrationList(resp); + } + + async getStorageVersionMigration( + name: string, + opts: operations.NoOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}storageversionmigrations/${name}`, + expectJson: true, + abortSignal: opts.abortSignal, + }); + return StoragemigrationV1alpha1.toStorageVersionMigration(resp); + } + + async deleteStorageVersionMigration( + name: string, + opts: operations.DeleteOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "DELETE", + path: `${this.#root}storageversionmigrations/${name}`, + expectJson: true, + querystring: operations.formatDeleteOpts(opts), + abortSignal: opts.abortSignal, + }); + if (c.isStatusKind(resp)) return MetaV1.toStatus(resp); + return StoragemigrationV1alpha1.toStorageVersionMigration(resp); + } + + async replaceStorageVersionMigration( + name: string, + body: StoragemigrationV1alpha1.StorageVersionMigration, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PUT", + path: `${this.#root}storageversionmigrations/${name}`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: StoragemigrationV1alpha1.fromStorageVersionMigration(body), + abortSignal: opts.abortSignal, + }); + return StoragemigrationV1alpha1.toStorageVersionMigration(resp); + } + + async patchStorageVersionMigration( + name: string, + type: c.PatchType, + body: StoragemigrationV1alpha1.StorageVersionMigration | c.JsonPatch, + opts: operations.PatchOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PATCH", + path: `${this.#root}storageversionmigrations/${name}`, + expectJson: true, + querystring: operations.formatPatchOpts(opts), + contentType: c.getPatchContentType(type), + bodyJson: Array.isArray(body) ? body : StoragemigrationV1alpha1.fromStorageVersionMigration(body), + abortSignal: opts.abortSignal, + }); + return StoragemigrationV1alpha1.toStorageVersionMigration(resp); + } + + async getStorageVersionMigrationStatus( + name: string, + opts: operations.NoOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}storageversionmigrations/${name}/status`, + expectJson: true, + abortSignal: opts.abortSignal, + }); + return StoragemigrationV1alpha1.toStorageVersionMigration(resp); + } + + async replaceStorageVersionMigrationStatus( + name: string, + body: StoragemigrationV1alpha1.StorageVersionMigration, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PUT", + path: `${this.#root}storageversionmigrations/${name}/status`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: StoragemigrationV1alpha1.fromStorageVersionMigration(body), + abortSignal: opts.abortSignal, + }); + return StoragemigrationV1alpha1.toStorageVersionMigration(resp); + } + + async patchStorageVersionMigrationStatus( + name: string, + type: c.PatchType, + body: StoragemigrationV1alpha1.StorageVersionMigration | c.JsonPatch, + opts: operations.PatchOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PATCH", + path: `${this.#root}storageversionmigrations/${name}/status`, + expectJson: true, + querystring: operations.formatPatchOpts(opts), + contentType: c.getPatchContentType(type), + bodyJson: Array.isArray(body) ? body : StoragemigrationV1alpha1.fromStorageVersionMigration(body), + abortSignal: opts.abortSignal, + }); + return StoragemigrationV1alpha1.toStorageVersionMigration(resp); + } + +} diff --git a/lib/builtin/storagemigration.k8s.io@v1alpha1/structs.ts b/lib/builtin/storagemigration.k8s.io@v1alpha1/structs.ts new file mode 100644 index 0000000..ecd54b0 --- /dev/null +++ b/lib/builtin/storagemigration.k8s.io@v1alpha1/structs.ts @@ -0,0 +1,121 @@ +// Autogenerated Schema file for StoragemigrationV1alpha1 +import * as c from "../../common.ts"; + +import * as MetaV1 from "../meta@v1/structs.ts"; +type ListOf = { + metadata: MetaV1.ListMeta; + items: Array; +}; + +/** The names of the group, the version, and the resource. */ +export interface GroupVersionResource { + group?: string | null; + resource?: string | null; + version?: string | null; +} +export function toGroupVersionResource(input: c.JSONValue): GroupVersionResource { + const obj = c.checkObj(input); + return { + group: c.readOpt(obj["group"], c.checkStr), + resource: c.readOpt(obj["resource"], c.checkStr), + version: c.readOpt(obj["version"], c.checkStr), + }} +export function fromGroupVersionResource(input: GroupVersionResource): c.JSONValue { + return { + ...input, + }} + +/** Describes the state of a migration at a certain point. */ +export interface MigrationCondition { + lastUpdateTime?: c.Time | null; + message?: string | null; + reason?: string | null; + status: string; + type: string; +} +export function toMigrationCondition(input: c.JSONValue): MigrationCondition { + const obj = c.checkObj(input); + return { + lastUpdateTime: c.readOpt(obj["lastUpdateTime"], c.toTime), + message: c.readOpt(obj["message"], c.checkStr), + reason: c.readOpt(obj["reason"], c.checkStr), + status: c.checkStr(obj["status"]), + type: c.checkStr(obj["type"]), + }} +export function fromMigrationCondition(input: MigrationCondition): c.JSONValue { + return { + ...input, + lastUpdateTime: input.lastUpdateTime != null ? c.fromTime(input.lastUpdateTime) : undefined, + }} + +/** StorageVersionMigration represents a migration of stored data to the latest storage version. */ +export interface StorageVersionMigration { + apiVersion?: "storagemigration.k8s.io/v1alpha1"; + kind?: "StorageVersionMigration"; + metadata?: MetaV1.ObjectMeta | null; + spec?: StorageVersionMigrationSpec | null; + status?: StorageVersionMigrationStatus | null; +} +export function toStorageVersionMigration(input: c.JSONValue): StorageVersionMigration & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "storagemigration.k8s.io/v1alpha1", "StorageVersionMigration"), + metadata: c.readOpt(obj["metadata"], MetaV1.toObjectMeta), + spec: c.readOpt(obj["spec"], toStorageVersionMigrationSpec), + status: c.readOpt(obj["status"], toStorageVersionMigrationStatus), + }} +export function fromStorageVersionMigration(input: StorageVersionMigration): c.JSONValue { + return { + ...c.assertOrAddApiVersionAndKind(input, "storagemigration.k8s.io/v1alpha1", "StorageVersionMigration"), + ...input, + metadata: input.metadata != null ? MetaV1.fromObjectMeta(input.metadata) : undefined, + spec: input.spec != null ? fromStorageVersionMigrationSpec(input.spec) : undefined, + status: input.status != null ? fromStorageVersionMigrationStatus(input.status) : undefined, + }} + +/** Spec of the storage version migration. */ +export interface StorageVersionMigrationSpec { + continueToken?: string | null; + resource: GroupVersionResource; +} +export function toStorageVersionMigrationSpec(input: c.JSONValue): StorageVersionMigrationSpec { + const obj = c.checkObj(input); + return { + continueToken: c.readOpt(obj["continueToken"], c.checkStr), + resource: toGroupVersionResource(obj["resource"]), + }} +export function fromStorageVersionMigrationSpec(input: StorageVersionMigrationSpec): c.JSONValue { + return { + ...input, + resource: input.resource != null ? fromGroupVersionResource(input.resource) : undefined, + }} + +/** Status of the storage version migration. */ +export interface StorageVersionMigrationStatus { + conditions?: Array | null; + resourceVersion?: string | null; +} +export function toStorageVersionMigrationStatus(input: c.JSONValue): StorageVersionMigrationStatus { + const obj = c.checkObj(input); + return { + conditions: c.readOpt(obj["conditions"], x => c.readList(x, toMigrationCondition)), + resourceVersion: c.readOpt(obj["resourceVersion"], c.checkStr), + }} +export function fromStorageVersionMigrationStatus(input: StorageVersionMigrationStatus): c.JSONValue { + return { + ...input, + conditions: input.conditions?.map(fromMigrationCondition), + }} + +/** StorageVersionMigrationList is a collection of storage version migrations. */ +export interface StorageVersionMigrationList extends ListOf { + apiVersion?: "storagemigration.k8s.io/v1alpha1"; + kind?: "StorageVersionMigrationList"; +}; +export function toStorageVersionMigrationList(input: c.JSONValue): StorageVersionMigrationList & c.ApiKind { + const obj = c.checkObj(input); + return { + ...c.assertOrAddApiVersionAndKind(obj, "storagemigration.k8s.io/v1alpha1", "StorageVersionMigrationList"), + metadata: MetaV1.toListMeta(obj.metadata), + items: c.readList(obj.items, toStorageVersionMigration), + }} diff --git a/lib/cert-manager/cert-manager.io@v1/structs.ts b/lib/cert-manager/cert-manager.io@v1/structs.ts index 4cee0f8..57973e4 100644 --- a/lib/cert-manager/cert-manager.io@v1/structs.ts +++ b/lib/cert-manager/cert-manager.io@v1/structs.ts @@ -8,14 +8,22 @@ type ListOf = { items: Array; }; -/** A CertificateRequest is used to request a signed certificate from one of the configured issuers. - All fields within the CertificateRequest's `spec` are immutable after creation. A CertificateRequest will either succeed or fail, as denoted by its `status.state` field. - A CertificateRequest is a one-shot resource, meaning it represents a single point in time request for a certificate and cannot be re-used. */ +/** A CertificateRequest is used to request a signed certificate from one of the +configured issuers. + + +All fields within the CertificateRequest's `spec` are immutable after creation. +A CertificateRequest will either succeed or fail, as denoted by its `Ready` status +condition and its `status.failureTime` field. + + +A CertificateRequest is a one-shot resource, meaning it represents a single +point in time request for a certificate and cannot be re-used. */ export interface CertificateRequest { apiVersion?: "cert-manager.io/v1"; kind?: "CertificateRequest"; metadata?: MetaV1.ObjectMeta | null; - spec: { + spec?: { duration?: string | null; extra?: Record> | null; groups?: Array | null; @@ -29,7 +37,7 @@ export interface CertificateRequest { uid?: string | null; usages?: Array<"signing" | "digital signature" | "content commitment" | "key encipherment" | "key agreement" | "data encipherment" | "cert sign" | "crl sign" | "encipher only" | "decipher only" | "any" | "server auth" | "client auth" | "code signing" | "email protection" | "s/mime" | "ipsec end system" | "ipsec tunnel" | "ipsec user" | "timestamping" | "ocsp signing" | "microsoft sgc" | "netscape sgc" | c.UnexpectedEnumValue> | null; username?: string | null; - }; + } | null; status?: { ca?: string | null; certificate?: string | null; @@ -48,7 +56,7 @@ export function toCertificateRequest(input: c.JSONValue): CertificateRequest & c return { ...c.assertOrAddApiVersionAndKind(obj, "cert-manager.io/v1", "CertificateRequest"), metadata: c.readOpt(obj["metadata"], MetaV1.toObjectMeta), - spec: toCertificateRequest_spec(obj["spec"]), + spec: c.readOpt(obj["spec"], toCertificateRequest_spec), status: c.readOpt(obj["status"], toCertificateRequest_status), }} export function fromCertificateRequest(input: CertificateRequest): c.JSONValue { @@ -131,13 +139,16 @@ export function fromSecretRef(input: SecretRef): c.JSONValue { ...input, }} -/** A Certificate resource should be created to ensure an up to date and signed x509 certificate is stored in the Kubernetes Secret resource named in `spec.secretName`. - The stored certificate will be renewed before it expires (as configured by `spec.renewBefore`). */ +/** A Certificate resource should be created to ensure an up to date and signed +X.509 certificate is stored in the Kubernetes Secret resource named in `spec.secretName`. + + +The stored certificate will be renewed before it expires (as configured by `spec.renewBefore`). */ export interface Certificate { apiVersion?: "cert-manager.io/v1"; kind?: "Certificate"; metadata?: MetaV1.ObjectMeta | null; - spec: { + spec?: { additionalOutputFormats?: Array<{ type: "DER" | "CombinedPEM" | c.UnexpectedEnumValue; }> | null; @@ -155,15 +166,36 @@ export interface Certificate { }; keystores?: { jks?: { + alias?: string | null; create: boolean; passwordSecretRef: SecretRef; } | null; pkcs12?: { create: boolean; passwordSecretRef: SecretRef; + profile?: "LegacyRC2" | "LegacyDES" | "Modern2023" | c.UnexpectedEnumValue | null; } | null; } | null; literalSubject?: string | null; + nameConstraints?: { + critical?: boolean | null; + excluded?: { + dnsDomains?: Array | null; + emailAddresses?: Array | null; + ipRanges?: Array | null; + uriDomains?: Array | null; + } | null; + permitted?: { + dnsDomains?: Array | null; + emailAddresses?: Array | null; + ipRanges?: Array | null; + uriDomains?: Array | null; + } | null; + } | null; + otherNames?: Array<{ + oid?: string | null; + utf8Value?: string | null; + }> | null; privateKey?: { algorithm?: "RSA" | "ECDSA" | "Ed25519" | c.UnexpectedEnumValue | null; encoding?: "PKCS1" | "PKCS8" | c.UnexpectedEnumValue | null; @@ -189,7 +221,7 @@ export interface Certificate { } | null; uris?: Array | null; usages?: Array<"signing" | "digital signature" | "content commitment" | "key encipherment" | "key agreement" | "data encipherment" | "cert sign" | "crl sign" | "encipher only" | "decipher only" | "any" | "server auth" | "client auth" | "code signing" | "email protection" | "s/mime" | "ipsec end system" | "ipsec tunnel" | "ipsec user" | "timestamping" | "ocsp signing" | "microsoft sgc" | "netscape sgc" | c.UnexpectedEnumValue> | null; - }; + } | null; status?: { conditions?: Array<{ lastTransitionTime?: c.Time | null; @@ -213,7 +245,7 @@ export function toCertificate(input: c.JSONValue): Certificate & c.ApiKind { return { ...c.assertOrAddApiVersionAndKind(obj, "cert-manager.io/v1", "Certificate"), metadata: c.readOpt(obj["metadata"], MetaV1.toObjectMeta), - spec: toCertificate_spec(obj["spec"]), + spec: c.readOpt(obj["spec"], toCertificate_spec), status: c.readOpt(obj["status"], toCertificate_status), }} export function fromCertificate(input: Certificate): c.JSONValue { @@ -261,6 +293,8 @@ function toCertificate_spec(input: c.JSONValue) { issuerRef: toCertificate_spec_issuerRef(obj["issuerRef"]), keystores: c.readOpt(obj["keystores"], toCertificate_spec_keystores), literalSubject: c.readOpt(obj["literalSubject"], c.checkStr), + nameConstraints: c.readOpt(obj["nameConstraints"], toCertificate_spec_nameConstraints), + otherNames: c.readOpt(obj["otherNames"], x => c.readList(x, toCertificate_spec_otherNames)), privateKey: c.readOpt(obj["privateKey"], toCertificate_spec_privateKey), renewBefore: c.readOpt(obj["renewBefore"], c.checkStr), revisionHistoryLimit: c.readOpt(obj["revisionHistoryLimit"], c.checkNum), @@ -300,6 +334,19 @@ function toCertificate_spec_keystores(input: c.JSONValue) { jks: c.readOpt(obj["jks"], toCertificate_spec_keystores_jks), pkcs12: c.readOpt(obj["pkcs12"], toCertificate_spec_keystores_pkcs12), }} +function toCertificate_spec_nameConstraints(input: c.JSONValue) { + const obj = c.checkObj(input); + return { + critical: c.readOpt(obj["critical"], c.checkBool), + excluded: c.readOpt(obj["excluded"], toCertificate_spec_nameConstraints_excluded), + permitted: c.readOpt(obj["permitted"], toCertificate_spec_nameConstraints_permitted), + }} +function toCertificate_spec_otherNames(input: c.JSONValue) { + const obj = c.checkObj(input); + return { + oid: c.readOpt(obj["oid"], c.checkStr), + utf8Value: c.readOpt(obj["utf8Value"], c.checkStr), + }} function toCertificate_spec_privateKey(input: c.JSONValue) { const obj = c.checkObj(input); return { @@ -339,6 +386,7 @@ function toCertificate_status_conditions(input: c.JSONValue) { function toCertificate_spec_keystores_jks(input: c.JSONValue) { const obj = c.checkObj(input); return { + alias: c.readOpt(obj["alias"], c.checkStr), create: c.checkBool(obj["create"]), passwordSecretRef: toSecretRef(obj["passwordSecretRef"]), }} @@ -347,6 +395,23 @@ function toCertificate_spec_keystores_pkcs12(input: c.JSONValue) { return { create: c.checkBool(obj["create"]), passwordSecretRef: toSecretRef(obj["passwordSecretRef"]), + profile: c.readOpt(obj["profile"], (x => c.readEnum<"LegacyRC2" | "LegacyDES" | "Modern2023" | c.UnexpectedEnumValue>(x))), + }} +function toCertificate_spec_nameConstraints_excluded(input: c.JSONValue) { + const obj = c.checkObj(input); + return { + dnsDomains: c.readOpt(obj["dnsDomains"], x => c.readList(x, c.checkStr)), + emailAddresses: c.readOpt(obj["emailAddresses"], x => c.readList(x, c.checkStr)), + ipRanges: c.readOpt(obj["ipRanges"], x => c.readList(x, c.checkStr)), + uriDomains: c.readOpt(obj["uriDomains"], x => c.readList(x, c.checkStr)), + }} +function toCertificate_spec_nameConstraints_permitted(input: c.JSONValue) { + const obj = c.checkObj(input); + return { + dnsDomains: c.readOpt(obj["dnsDomains"], x => c.readList(x, c.checkStr)), + emailAddresses: c.readOpt(obj["emailAddresses"], x => c.readList(x, c.checkStr)), + ipRanges: c.readOpt(obj["ipRanges"], x => c.readList(x, c.checkStr)), + uriDomains: c.readOpt(obj["uriDomains"], x => c.readList(x, c.checkStr)), }} export interface CertificateList extends ListOf { @@ -381,6 +446,7 @@ export interface IssuerSpec { } | null; ca?: { crlDistributionPoints?: Array | null; + issuingCertificateURLs?: Array | null; ocspServers?: Array | null; secretName: string; } | null; @@ -399,6 +465,7 @@ export interface IssuerSpec { role: string; secretRef?: SecretRef | null; serviceAccountRef?: { + audiences?: Array | null; name: string; } | null; } | null; @@ -406,6 +473,8 @@ export interface IssuerSpec { }; caBundle?: string | null; caBundleSecretRef?: SecretRef | null; + clientCertSecretRef?: SecretRef | null; + clientKeySecretRef?: SecretRef | null; namespace?: string | null; path: string; server: string; @@ -461,6 +530,8 @@ export function fromIssuerSpec(input: IssuerSpec): c.JSONValue { tokenSecretRef: input.vault.auth.tokenSecretRef != null ? fromSecretRef(input.vault.auth.tokenSecretRef) : undefined, } : undefined, caBundleSecretRef: input.vault.caBundleSecretRef != null ? fromSecretRef(input.vault.caBundleSecretRef) : undefined, + clientCertSecretRef: input.vault.clientCertSecretRef != null ? fromSecretRef(input.vault.clientCertSecretRef) : undefined, + clientKeySecretRef: input.vault.clientKeySecretRef != null ? fromSecretRef(input.vault.clientKeySecretRef) : undefined, } : undefined, venafi: input.venafi != null ? { ...input.venafi, @@ -488,6 +559,7 @@ function toIssuerSpec_ca(input: c.JSONValue) { const obj = c.checkObj(input); return { crlDistributionPoints: c.readOpt(obj["crlDistributionPoints"], x => c.readList(x, c.checkStr)), + issuingCertificateURLs: c.readOpt(obj["issuingCertificateURLs"], x => c.readList(x, c.checkStr)), ocspServers: c.readOpt(obj["ocspServers"], x => c.readList(x, c.checkStr)), secretName: c.checkStr(obj["secretName"]), }} @@ -502,6 +574,8 @@ function toIssuerSpec_vault(input: c.JSONValue) { auth: toIssuerSpec_vault_auth(obj["auth"]), caBundle: c.readOpt(obj["caBundle"], c.checkStr), caBundleSecretRef: c.readOpt(obj["caBundleSecretRef"], toSecretRef), + clientCertSecretRef: c.readOpt(obj["clientCertSecretRef"], toSecretRef), + clientKeySecretRef: c.readOpt(obj["clientKeySecretRef"], toSecretRef), namespace: c.readOpt(obj["namespace"], c.checkStr), path: c.checkStr(obj["path"]), server: c.checkStr(obj["server"]), @@ -563,10 +637,13 @@ function toIssuerSpec_venafi_tpp_credentialsRef(input: c.JSONValue) { function toIssuerSpec_vault_auth_kubernetes_serviceAccountRef(input: c.JSONValue) { const obj = c.checkObj(input); return { + audiences: c.readOpt(obj["audiences"], x => c.readList(x, c.checkStr)), name: c.checkStr(obj["name"]), }} -/** An ACMEChallengeSolver describes how to solve ACME challenges for the issuer it is part of. A selector may be provided to use different solving strategies for different DNS names. Only one of HTTP01 or DNS01 must be provided. */ +/** An ACMEChallengeSolver describes how to solve ACME challenges for the issuer it is part of. +A selector may be provided to use different solving strategies for different DNS names. +Only one of HTTP01 or DNS01 must be provided. */ export interface SolverSpec { dns01?: { acmeDNS?: { @@ -615,6 +692,14 @@ export interface SolverSpec { route53?: { accessKeyID?: string | null; accessKeyIDSecretRef?: SecretRef | null; + auth?: { + kubernetes: { + serviceAccountRef: { + audiences?: Array | null; + name: string; + }; + }; + } | null; hostedZoneID?: string | null; region: string; role?: string | null; @@ -828,6 +913,7 @@ function toSolverSpec_dns01_route53(input: c.JSONValue) { return { accessKeyID: c.readOpt(obj["accessKeyID"], c.checkStr), accessKeyIDSecretRef: c.readOpt(obj["accessKeyIDSecretRef"], toSecretRef), + auth: c.readOpt(obj["auth"], toSolverSpec_dns01_route53_auth), hostedZoneID: c.readOpt(obj["hostedZoneID"], c.checkStr), region: c.checkStr(obj["region"]), role: c.readOpt(obj["role"], c.checkStr), @@ -863,6 +949,11 @@ function toSolverSpec_dns01_azureDNS_managedIdentity(input: c.JSONValue) { clientID: c.readOpt(obj["clientID"], c.checkStr), resourceID: c.readOpt(obj["resourceID"], c.checkStr), }} +function toSolverSpec_dns01_route53_auth(input: c.JSONValue) { + const obj = c.checkObj(input); + return { + kubernetes: toSolverSpec_dns01_route53_auth_kubernetes(obj["kubernetes"]), + }} function toSolverSpec_http01_gatewayHTTPRoute_parentRefs(input: c.JSONValue) { const obj = c.checkObj(input); return { @@ -884,6 +975,11 @@ function toSolverSpec_http01_ingress_podTemplate(input: c.JSONValue) { metadata: c.readOpt(obj["metadata"], toSolverSpec_http01_ingress_podTemplate_metadata), spec: c.readOpt(obj["spec"], toSolverSpec_http01_ingress_podTemplate_spec), }} +function toSolverSpec_dns01_route53_auth_kubernetes(input: c.JSONValue) { + const obj = c.checkObj(input); + return { + serviceAccountRef: toSolverSpec_dns01_route53_auth_kubernetes_serviceAccountRef(obj["serviceAccountRef"]), + }} function toSolverSpec_http01_ingress_ingressTemplate_metadata(input: c.JSONValue) { const obj = c.checkObj(input); return { @@ -906,6 +1002,12 @@ function toSolverSpec_http01_ingress_podTemplate_spec(input: c.JSONValue) { serviceAccountName: c.readOpt(obj["serviceAccountName"], c.checkStr), tolerations: c.readOpt(obj["tolerations"], x => c.readList(x, toSolverSpec_http01_ingress_podTemplate_spec_tolerations)), }} +function toSolverSpec_dns01_route53_auth_kubernetes_serviceAccountRef(input: c.JSONValue) { + const obj = c.checkObj(input); + return { + audiences: c.readOpt(obj["audiences"], x => c.readList(x, c.checkStr)), + name: c.checkStr(obj["name"]), + }} function toSolverSpec_http01_ingress_podTemplate_spec_imagePullSecrets(input: c.JSONValue) { const obj = c.checkObj(input); return { @@ -969,7 +1071,11 @@ function toIssuerStatus_conditions(input: c.JSONValue) { type: c.checkStr(obj["type"]), }} -/** A ClusterIssuer represents a certificate issuing authority which can be referenced as part of `issuerRef` fields. It is similar to an Issuer, however it is cluster-scoped and therefore can be referenced by resources that exist in *any* namespace, not just the same namespace as the referent. */ +/** A ClusterIssuer represents a certificate issuing authority which can be +referenced as part of `issuerRef` fields. +It is similar to an Issuer, however it is cluster-scoped and therefore can +be referenced by resources that exist in *any* namespace, not just the same +namespace as the referent. */ export interface ClusterIssuer { apiVersion?: "cert-manager.io/v1"; kind?: "ClusterIssuer"; @@ -1006,7 +1112,10 @@ export function toClusterIssuerList(input: c.JSONValue): ClusterIssuerList & c.A items: c.readList(obj.items, toClusterIssuer), }} -/** An Issuer represents a certificate issuing authority which can be referenced as part of `issuerRef` fields. It is scoped to a single namespace and can therefore only be referenced by resources within the same namespace. */ +/** An Issuer represents a certificate issuing authority which can be +referenced as part of `issuerRef` fields. +It is scoped to a single namespace and can therefore only be referenced by +resources within the same namespace. */ export interface Issuer { apiVersion?: "cert-manager.io/v1"; kind?: "Issuer"; diff --git a/lib/jsr.json b/lib/jsr.json index 7feb660..3c362fc 100644 --- a/lib/jsr.json +++ b/lib/jsr.json @@ -1,6 +1,6 @@ { "name": "@cloudydeno/kubernetes-apis", - "version": "0.5.1", + "version": "0.5.2", "exports": { "./admissionregistration.k8s.io/v1": "./builtin/admissionregistration.k8s.io@v1/mod.ts", @@ -22,7 +22,7 @@ "./core/v1": "./builtin/core@v1/mod.ts", "./discovery.k8s.io/v1": "./builtin/discovery.k8s.io@v1/mod.ts", "./events.k8s.io/v1": "./builtin/events.k8s.io@v1/mod.ts", - "./flowcontrol.apiserver.k8s.io/v1beta2": "./builtin/flowcontrol.apiserver.k8s.io@v1beta2/mod.ts", + "./flowcontrol.apiserver.k8s.io/v1": "./builtin/flowcontrol.apiserver.k8s.io@v1/mod.ts", "./flowcontrol.apiserver.k8s.io/v1beta3": "./builtin/flowcontrol.apiserver.k8s.io@v1beta3/mod.ts", "./internal.apiserver.k8s.io/v1alpha1": "./builtin/internal.apiserver.k8s.io@v1alpha1/mod.ts", "./meta/v1": "./builtin/meta@v1/structs.ts", @@ -34,6 +34,8 @@ "./resource.k8s.io/v1alpha2": "./builtin/resource.k8s.io@v1alpha2/mod.ts", "./scheduling.k8s.io/v1": "./builtin/scheduling.k8s.io@v1/mod.ts", "./storage.k8s.io/v1": "./builtin/storage.k8s.io@v1/mod.ts", + "./storage.k8s.io/v1alpha1": "./builtin/storage.k8s.io@v1alpha1/mod.ts", + "./storagemigration.k8s.io/v1alpha1": "./builtin/storagemigration.k8s.io@v1alpha1/mod.ts", "./argoproj.io/v1alpha1": "./argo-cd/argoproj.io@v1alpha1/mod.ts", diff --git a/lib/vpa/autoscaling.k8s.io@v1/mod.ts b/lib/vpa/autoscaling.k8s.io@v1/mod.ts index 1cf1459..e3b1764 100644 --- a/lib/vpa/autoscaling.k8s.io@v1/mod.ts +++ b/lib/vpa/autoscaling.k8s.io@v1/mod.ts @@ -319,4 +319,51 @@ export class AutoscalingV1NamespacedApi { return AutoscalingV1.toVerticalPodAutoscaler(resp); } + async getVerticalPodAutoscalerStatus( + name: string, + opts: operations.NoOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "GET", + path: `${this.#root}verticalpodautoscalers/${name}/status`, + expectJson: true, + abortSignal: opts.abortSignal, + }); + return AutoscalingV1.toVerticalPodAutoscaler(resp); + } + + async replaceVerticalPodAutoscalerStatus( + name: string, + body: AutoscalingV1.VerticalPodAutoscaler, + opts: operations.PutOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PUT", + path: `${this.#root}verticalpodautoscalers/${name}/status`, + expectJson: true, + querystring: operations.formatPutOpts(opts), + bodyJson: AutoscalingV1.fromVerticalPodAutoscaler(body), + abortSignal: opts.abortSignal, + }); + return AutoscalingV1.toVerticalPodAutoscaler(resp); + } + + async patchVerticalPodAutoscalerStatus( + name: string, + type: c.PatchType, + body: AutoscalingV1.VerticalPodAutoscaler | c.JsonPatch, + opts: operations.PatchOpts = {}, + ): Promise { + const resp = await this.#client.performRequest({ + method: "PATCH", + path: `${this.#root}verticalpodautoscalers/${name}/status`, + expectJson: true, + querystring: operations.formatPatchOpts(opts), + contentType: c.getPatchContentType(type), + bodyJson: Array.isArray(body) ? body : AutoscalingV1.fromVerticalPodAutoscaler(body), + abortSignal: opts.abortSignal, + }); + return AutoscalingV1.toVerticalPodAutoscaler(resp); + } + } diff --git a/lib/vpa/autoscaling.k8s.io@v1/structs.ts b/lib/vpa/autoscaling.k8s.io@v1/structs.ts index c5bce3e..c339f6d 100644 --- a/lib/vpa/autoscaling.k8s.io@v1/structs.ts +++ b/lib/vpa/autoscaling.k8s.io@v1/structs.ts @@ -131,6 +131,10 @@ export interface VerticalPodAutoscaler { name: string; }; updatePolicy?: { + evictionRequirements?: Array<{ + changeRequirement: "TargetHigherThanRequests" | "TargetLowerThanRequests" | c.UnexpectedEnumValue; + resources: Array; + }> | null; minReplicas?: number | null; updateMode?: "Off" | "Initial" | "Recreate" | "Auto" | c.UnexpectedEnumValue | null; } | null; @@ -209,6 +213,7 @@ function toVerticalPodAutoscaler_spec_targetRef(input: c.JSONValue) { function toVerticalPodAutoscaler_spec_updatePolicy(input: c.JSONValue) { const obj = c.checkObj(input); return { + evictionRequirements: c.readOpt(obj["evictionRequirements"], x => c.readList(x, toVerticalPodAutoscaler_spec_updatePolicy_evictionRequirements)), minReplicas: c.readOpt(obj["minReplicas"], c.checkNum), updateMode: c.readOpt(obj["updateMode"], (x => c.readEnum<"Off" | "Initial" | "Recreate" | "Auto" | c.UnexpectedEnumValue>(x))), }} @@ -236,6 +241,12 @@ function toVerticalPodAutoscaler_spec_resourcePolicy_containerPolicies(input: c. minAllowed: c.readOpt(obj["minAllowed"], x => c.readMap(x, c.toIntOrString)), mode: c.readOpt(obj["mode"], (x => c.readEnum<"Auto" | "Off" | c.UnexpectedEnumValue>(x))), }} +function toVerticalPodAutoscaler_spec_updatePolicy_evictionRequirements(input: c.JSONValue) { + const obj = c.checkObj(input); + return { + changeRequirement: (x => c.readEnum<"TargetHigherThanRequests" | "TargetLowerThanRequests" | c.UnexpectedEnumValue>(x))(obj["changeRequirement"]), + resources: c.readList(obj["resources"], c.checkStr), + }} function toVerticalPodAutoscaler_status_recommendation_containerRecommendations(input: c.JSONValue) { const obj = c.checkObj(input); return {